(you are viewing a thread; or go back to
list of threads)
count down timer with lcd (by Rajeev)
Do you have any example of pic base count down timer 99.9 second with lcd and also with increment & decrement by swithes.
thanks in advance.
regards
(no subject) (by MGP)
Rajeev and others!
Short questions come through the language differences but there you have translators on the Internet.
A program like this is 1/2 hour of work including testing but:
With such questions no one can help you, it's like asking: I have a motor and would like to build a car, can someone help me.
We need more information and do you have a serial (UART) LCD display? I suspect not and LDmicro need one.
Can you customize a program if it's not 100% your taste?
If not, then it's a waste of time for us
So, what do you have as hardware?
(no subject) (by Rajeev)
Dear MGP Sir,
Thanks for reply.
Please accept my apologies if I didn't asked perfectly.
I have made simple pre programmed PLC using PIC16F887 with help of LDMICRO and I made PCB with 8 opto isolated Inputs and 8 relay outputs.
I am new to SERIAL UART LCD DISPLAY.
Yes I can customize a program if it's not 100% of my taste.
Now I am trying to make a simple industrial timer with lcd (16x2) of only 99.9 sec with increment and decrement switches also a RESET swith. I have seen few Sample files from LDMICRO and learnt lot of things.
I would be really grateful if could help.
Thanks & regards,
Rajeev
(no subject) (by Rajeev)
Dear MGP Sir,
Thanks for prompt reply. I really really appreciate for great help.
Please tell me how pic16f887 will talk to LCD. I know how to declare same variables in count up and count down counters but don't know how serial (UART) will transmit same variable value to LCD.
Thanks & best regards,
Rajeev
(no subject) (by MGP)
Here you have your program.
You need 5 pushbuttons ; xset, xslowup, wslowdn, xrun, xreset.
For set time, push xset and xslowup or xslowdn.
After 1 sec its go faster.
Release xset button and settings are stored in eeprom.
xrun is a button or you can change it in a internal relais contact....
Ydone is the output when time = zero.
The time is displayed on a serial lcd.
The program can always made better but that's up to you.
(no subject) (by Rajeev)
Dear MGP Sir,
Thanks for great help.
I really want to appreciate.
Rajeev
(no subject) (by MGP)
I have made a error, you must change in rung 5
time <= 999 must be time <= 998
(no subject) (by Rajeev)
Dear MGP Sir,
You did great help.
Yes it was a error and I had changed.
Thanks and best regards,
Rajeev
(no subject) (by Rajeev)
Dear MGP Sir,
Can you guide me if I want to make 2 timer in sequence like Timer one and Timer two, both works same way 99.9 seconds.
We can add two more pushbuttons in your given Program for Timer one and Timer two with 5 pushbuttons xset, xslowup, wslowdn, xrun, xreset.
Also I want to use 20X4 LCD,
(1) Ist line- I want to print "Any Name"(declare character variable) it will be fix in Center.
(2) Second line- I want to print Timer one or Timer two (in character variable) when Timer one is in operation it will show Timer one and when Timer two in operations it will show timer two.
(3) Third line- I want to print working timer duration (in 99.9 seconds), in Timer Set mode I want to use same this line for Timers settings.
(4) Fourth Line- I want to print Timers Set Points in 99.9 format like if Timer one is running it will show Timer one set Point and if Timer two is running than it will show Timer two set point.
I will be really thankful if you could help.
Can you please give in any ref. book or website for Serial (UART) I want to study deeply.
best regards,
Rajeev
(no subject) (by MGP)
Rajeev, you have everything you need how to do this.
You said you could costumize a program.
As concerned the LCD, every LCD has other control characters, so I can not help you.
This program works also on a 4x20 serial lcd so you can start and look how it works.
Read the manual of the lcd, how to control the cursor.
UART, RS232 you can find millions of pages on this topic on the internet, use google, bing, etc....
https://forum.crystalfontz.com/forum.php
(no subject) (by Rajeev)
Dear MGP Sir,
Thanks for reply and link for guidance.
Best regards,
Rajeev
(no subject) (by Rajeev)
Dear MGP Sir,
Thanks once again for great help.
I have checked program successfully with pic16f887, serial LCD controller, LCD 20x4, with 5 Buttons.
I have made changes few things as per my taste like cycle time to .2 ms, created new rung for new internal relay and set of timers no/off to set mode and running mode for perfection. LCD Display looking really perfect.
I have searched Google but could not found enough.
Can you explain little more about UART only, like how Time is coming on LCD in first line and why its repeating.
If possible Please explain more about advance level of UART.
Thanks & best regards,
Rajeev
(no subject) (by MGP)
If you have a lcd then look in the manual for cursor movements.
In this example you can see \r\n this means "return" and "newline" as explaned in ldmicro's "helpfile" -> press F1 in the program (see the jpg file attached)
You must search for the command "home".
I don't have the manual of your lcd display, I cannot help you.
(no subject) (by Rajeev)
Dear MGP Sir,
Thanks a lot.
Best regards,
Rajeev
(no subject) (by Rajeev)
Dear MGP Sir,
Now everything is clear to me what is all about uart.
Now problem is that timer is working very well and storing variable data in memory with help of PERSISTENT. I think its storing in RAM not in EEprom that is reason when powers off than it shows 00 value not last stored value in Variable.
Please guide me any solution.
Can you please give me logic if I want to make count up timer instead of count down timer.
Thanks & regards,
Rajeev
(no subject) (by MGP)
I added a rung (3).
That happens when you program without testing it in real.
Simulation does not always detect such errors.
And I am not your personal programmer :-)
A countup timer is for you, you can learn a lot from it.
(no subject) (by MGP)
Sorry, I forgot the file.
(no subject) (by Rajeev)
Thank you MGP sIR.
(no subject) (by Rajeev)
Thank you MGP Sir.
(no subject) (by Rajeev)
Dear MGP Sir,
In version 2 even the Problem is same, not storing variable data in EEPROM.
When power goes off variable value is 00 not last saved value.
I can humbly request only if you could help.
Thanks & regards,
Rajeev
(no subject) (by MGP)
If I have time I setup a demo board.
I do not know why it does not work, maybe the cycle time.
At 10mS you have a debounce effect, at 0.2mS you dont.
(no subject) (by Rajeev)
Dear MGP Sir,
Its not working even at 10mS cycle time.
Should i use External EEPROM?
thanks & Best regards,
Rajeev
(no subject) (by MGP)
You cannot use external eeprom.
(no subject) (by MGP)
Now it works, I had to move rung 3 below the memo(persist) instruction and also set the memo(persist) instruction in a new rung.
It's probably how ldmicro reads the memory locations.
(no subject) (by Rajeev)
Dear MGP Sir,
Yes yes yes, it is working very well now it is storing in EEPROM.
Now power goes off still variable value is last saved value.
I don't have words to say thank you for your help and support.
best regards,
Rajeev
(no subject) (by Rajeev)
Dear MGP Sir,
I am in trouble again, actually I want to make 5 timers in sequence with the help of your given program and I made all changes but my pic16f887 goes out of memory.
Please guide me or give any solution for this problem, what should I do.
Can I use I2C to add one more controller to add up memory?
Thanks & best regards,
Rajeev
(no subject) (by MGP)
There is nothing you can do, only shorten your program.
Serial output uses a huges amount of memory.
I2C is not supported by ldmicro
(no subject) (by Rajeev)
Dear MGP Sir,
Can I use ATMEL AVR ATMEGA 32 (PDIP 40 PINS)it has 32k memory size and support by LDMICRO and also UART is available.
Thanks & best regards,
Rajeev
(no subject) (by MGP)
I have no experience with AVR's, maybe someone can try it if you post your program.
You have 2 types of memory, data and program memory and I dont know what memory you have shortage.
(no subject) (by Rajeev)
Dear MGP Sir,
It is shortage of program memory. When I go for compile than LDmicro Error comes and display that "Out of memory; simplify program or choose microcontroller with more memory."
Thanks & regards,
Rajeev
MGP Sir need your help again (by Rajeev Rawal)
Dear MGP Sir,
Can you help me to convert that program with 4 Digit 7 Segment display instead of LCD.
Thanks & best regards,
Rajeev
(no subject) (by MGP)
I posted long time ago a 4digit voltmeter, the only thing you must do is to merge the 2 programs.
Simply replace the 2 first rungs (analog reading) with the time variable (speed = time) after merging the two programs, not that difficult...
Good luck..
https://cq.cx/ladder-forum.pl?...;parent=5604&tt=1477936580
MGP Sir Thanks a lot (by Rajeev Rawal)
Dear MGP Sir,
Thanks a lot.
I appreciate your reply.
Best regards,
Rajeev
MGP Sir, Can I use i2c Medule (by Rajeev Rawal)
MGP Sir,
Can I use i2c medule, TM1637 4 Bits Digital Tube LED Display Module.
In Release 5.3.1.0 the i2c is ready to use.
I am asking because just two wires to connect and it is very easy to make hardware.
Thanks in advance.
(no subject) (by Rajeev Rawal)
Thanks for reply and help.
MGP Sir need your advice. (by Rajeev Rawal)
Dear MGP Sir,
Need your advice that I want to add two 4 Digit 7 Segment display in above count down timer ladder.
No.1: it will display programmable set point time.(like Thumb wheel BCD)
No.2: As usual display for count down time.
I would really appreciate if could spare some time to advice me in this regard.
Thanks & best regards,
Rajeev
(no subject) (by MGP)
Rajeev, I am not going to write a program due to lack of time but am always willing to check programs.
The countdown timer above has a set-up/dwn and the number is stored in eeprom, which works better than thumbwheel switches.
4 thumb wheel switches occupy many IO ports.
In this link you can see how you I did it some time ago.
https://cq.cx/ladder-forum.pl?...;parent=2154&tt=1314803385
Thanks MGP Sir. (by Rajeev Rawal)
Thanks MGP Sir for your reply.
Best regards,
Rajeev
MGP Sir need your help again (by Rajeev Rawal)
Dear MGP Sir,
Please visit my given link
https://youtu.be/HZjaIBXKDzA
Why 7 segments not showing so clean in real Hardware.
I just modify Mr. Jonathan file from samples with name of 7seg-display-analog.
I tried every thing but failed, could not fix that error.
Even original file giving same error in real Hardware.
I tried to run your file in same Hardware but your given file of 4 Digit Volt Meter not running properly.
https://cq.cx/ladder-forum.pl?...;parent=5604&tt=1477936580
I would be grateful if you could help me.
Thanks in Advance,
Best regards,
Rajeev
(no subject) (by MGP)
I'll look at it during the weekend.
Which 7-segment display do you have?
MGP Sir Thanks a lot (by Rajeev Rawal)
MGP Sir,
Thanks a lot for reply.
I am using Common Cathode 7-Segment Display model is SP40561CR HILITE as Mr. Jonathan suggested on file.
Please find attached file of circuit.
Thanks & best regards,
Rajeev
(no subject) (by MGP)
I found the time to test this program I made 4years ago and it works good.
The test were done with a 16F877a and 16F887 and both showed the same result.
And I also made a video
https://youtu.be/wFBa9bkIMZs
Attached the 16F887 version
BTW : you also have to pay attention when you enter the configbits.
MGP Sir Thanks a lot once again (by Rajeev Rawal)
Dear MGP Sir,
WOW!
Hard to find words to say Thank you.
Now I understand how you set configuration bits 0x3FFF20C2.
Hex value 20C2 = Binary 10000011000010.
Now Its working perfectly like your video.
But you can improve more to last digit of 7 segments not showing perfectly, the transition is not 100% perfect.
I am using 10K pot but still not perfect.
If you could find some time please see this issue and guide me how I can add one more 4 Digit 7 Segments to this program for SET POINT of Temperature.
Thanks & best regards,
Rajeev
(no subject) (by MGP)
Change your 330 ohm resistors in 180 ohm because the diplays are multiplexed then you have a better view.
As I wrote earlier, programming is for you ;)
(no subject) (by MGP)
LDmicro has also a 7 segment instruction which is much faster and shorter, look in the wiki pages or in the manual how to use it.
MGP Sir Thanks (by Rajeev Rawal)
Dear MGP Sir,
I really appreciate your kindness.
You did great help.
Please check this circuit for Dual Display of 4 Digit 7-Segments.
Best Regards,
Rajeev
(no subject) (by MGP)
If you are using 8 digits for multyplexing then you must use the new 7segment instruction, it's much faster.
Otherwise you will get a very weak reading .
My old version is only good for max. 5 digits.
(no subject) (by Rajeev Rawal)
Dear MGP Sir,
I just gone through new 7segment instruction, yes it is perfect but same time little complicated.
Do you have any Simple example.
Thanks
(no subject) (by MGP)
I had some time today and here is your program for 2 x 4 digit 7seg display with the new 7seg. instructiona and thanks to Ihor examples.
All necessary comments are included.
I tested it and it works, if something goes wrong with yours you have made an error.
You don't have to ask for more programs that's up to you now.
Practice a lot and you'll learn ;)
Good luck.
MGP Sir Thanks a lot. (by Rajeev Rawal)
Dear MGP Sir,
Thanks a lot once again.
God Bless you.
MGP Sir please have a look (by Rajeev Rawal)
MGP Sir please have a look and tell me your view on it.
I could not understand the value added on PIECEWISE LINEAR TABLE.
Please give me link to understand deep PIECEWISE LINEAR TABLE if possible.
Thanks & best regards.
(no subject) (by Ziggy)
google piecewise linear function
(no subject) (by MGP)
In samples you can find a program that is using the PWL function, study that a great subject to keep you busy ;)
MGP Sir Thanks a lot once again (by Rajeev Rawal)
MGP Sir,
Thanks a lot once again for sharing.
I didn't know about that Samples_V2.
It helped me.
Best regards,
Rajeev
(no subject) (by MGP)
Do you understand it.. really ? ;-)
(no subject) (by Rajeev Rawal)
Dear MGP Sir,
Yes I really understand how values added in PWL of my given program.
Because he doesn't want to use math instruction so he used PWL and just making any point (x0,y0) , (x1,y1) etc to get the value.
temperature in degree Celsius = 2 x ADC Value from AN0.
For Example when ADC = 2 then temperature = 1 Celsius.
Values will store in Variable "result" from there to W register than PORT B for display.
Please correct me if I am wrong.
Thanks & best regards,
Rajeev
(no subject) (by MGP)
Not true, the calculation of the degrees is ADC*500/1023.
At 100°C (99.7 exactly) you have an ADC input of 204 and because the lack of floating point calculations it's not precise enouch.
You need to add an opamp (4x) at the output so that 100°C = 816.
If you want to try with PWL .... attached your updated program.
PWL needs 2 points, start 2 (0°C) and end 204 (100°C)
0°C (x0,y0)0,2 and 100°C (x1,y1)204,100
Remember when testing, ADCin = 204 for 100°C and is very difficult to simulate
(no subject) (by Rajeev Rawal)
Thanks MGP Sir.
MGP Sir I have Trouble again (by Rajeev Rawal)
Dear MGP Sir,
Your all files of 4Digit working very well on my Dev. Board but that your file with name of (2x 4digit_voltmeter_CC-display.ld) not running at all.
May be I needed some extra circuitry in real hardware.
If yes please share your circuit with me if possible.
Thanks in advance.
Best regards,
Rajeev
(no subject) (by MGP)
How do you made yours? maybe I can see what you did wrong.
I tested my circuit again, 10min ago and it works 100% sure.
It's like your circuit attached, only the 330ohm resistors are 100ohm.
(no subject) (by Rajeev Rawal)
Dear MGP Sir,
Same circuit I am using and your program with name of (4digit_voltmeter_CC-displays_887.ld) working perfectly like your Video. I modified MCU pins as per (2x4digit_voltmeter_CC-display.ld) file and still working perfect.
But new 7segment instruction file not showing any display.
Do have any simple file with new 7segment instruction to just display any thing very simple like 0123.
Best regards,
Rajeev
MGP Sir Thanks a lot once again (by Rajeev Rawal)
Dear MGP Sir,
Your reply was very valuable.
Actually I had only in hand was PIC16F887 so I changed MCU in LD file that is reason program was not working.
After Your reply I found PIC16F877A and now program is working perfect with it.
Can you tell me why the program not working with PIC16F887. All pins connections are same.
Thanks & Best regards,
Rajeev
(no subject) (by MGP)
Because of the config bits (20Mhz crystal), with a F887 you have to enter 20C2 and with a F877 enter 3f62.
(no subject) (by MGP)
And also, the compiler need to know for which controller he needs to compile the LD file, they have different registers and memory.
Checking the type of controller is also the first thing you have to look at if you have a program, but I know 887 or 877 is not much different...
MGP Sir Thanks a lot once again (by Rajeev Rawal)
Dear MGP Sir,
Thanks a lot again and again for your valuable reply.
God Bless You.
Best regards,
Rajeev
MGP Sir please have a look (by Rajeev Rawal)
Dear MGP Sir,
I was trying to further programming with "Piecewice linear interpolation" for "K Type thermocouple". I found good calculations. Can you see this and help me to just making perfect "Piecewice linear interpolation" in LDMICRO. Please see attached files. I need only 0 c - 400 c.
Thanks in Advance if you could find some time.
Best regards,
Rajeev
MGP Sir please have a look (by Rajeev Rawal)
MGP Sir please have a look
MGP Sir please have a look (by Rajeev Rawal)
Dear MGP Sir,
This is last file please have a look.
Best Regards,
Rajeev
(no subject) (by MGP)
You need to calculate for the 8 points in the PWL table how many degrees correspond to the AD input (0-1023).
Why not 9 points 0-50-100-150-200-250-300-350-400..
The calculations in your example can not be done by LDmicro because of the 16bit limit in LDmicro.
MGP Sir Thanks a lot (by Rajeev Rawal)
Dear MGP Sir,
Thanks a lot for your valuable reply.
Best regards,
Rajeev
MGP Sir please check this LD File (by Rajeev Rawal)
Dear MGP Sir,
Please check this LD File.
I just tried to modify your two program into one and its working good.
Please help me how I can make this program to 0-400.9 Celsius I tried and gave so much time but could not get success.
I know you are not my personal programmer but its request if you could just explain in your reply how I can do it my self. Your piece of advice always help me.
Best regards,
Rajeev
(no subject) (by MGP)
You become addicted to me, every hour you bump into another problem.
Here you have the solution to your problem.
Because I would not have too much work, I used the digit3 (thousands) for the tenths (1/10°C).
You can do 2 things, leave it like that and make digit3 the rightmost digit or adjust the program and use digit0 for the tenths.
Rung 8, 9, 10 calculate the digit (tenths) with the MOD instruction and in rung19 digit3 is replaced by that digit.
MGP Sir Thanks a lot once again (by Rajeev Rawal)
Dear MGP Sir,
I really appreciate your good heart and unconditional help.
I also want to thanks Mr. IHOR Sir for his efforts.
Best regards,
Rajeev
Book for Pic mcu (by Rajeev Rawal)
Dear MGP Sir,
Can you suggest me one of the your favorite book for Pic mcu which can help me to better understand LDMICRO in deep.
Please also suggest for CCS C Compiler, if possible.
Thanks & best regards,
Rajeev
(no subject) (by MGP)
Sorry but I have no books and I also have no favorite book.
I read a lot on the internet and a lot of datasheets and other PDF's.
LDmicro is the only programming language I use, but I understand other programming languages such as C, Basic ...
But my experience makes everything easier and you get that with age, I am already 60+
:) :)
(no subject) (by Rajeev Rawal)
Dear MGP Sir,
So I have to wait long 8 years more.. because I am just 52+
:) :) :) :)
Best regards,
Rajeev
(no subject) (by MGP)
In 8years you can be a professional :) :)
Dear MGP Sir (by Rajeev Rawal)
Dear MGP Sir,
Hope you and your family perfectly alright in time period of COVID-19.
May God give you and your family Health + Happiness + Holiness.
Best regards,
Rajeev Rawal.
(no subject) (by MGP)
Thanks I'm fine, but I hope Ihor stays healthy because without him no more updates.
The most important person for the ldmicro community.
(no subject) (by Ziggy)
So true.
(no subject) (by Rajeev Rawal)
Yes true IHOR Sir is very important Person of LDMICRO Community.
Hope he is perfectly alright.
Post a reply to this comment:
|