LCD displaying results from DS1620
Hello All,
Although I am sure this has been done before my forum search hasn't returned anything. What I am trying to do is to covert the SX/ Help file thermometer example·to displaying the tempurature on my Parallax 16X2 serial LCD. I have been able to make it work as shown in the help file using the 7 segment LEDs so I'm sure my hardware is OK. but when I modify the program to send it to the LCD the values are always 0. If anyone has already done this or similar and would like to share their code I would be greatfull. Can't see where I am going wrong with this program. Seems to me I should get something.
Thanks,
Jim W.
Although I am sure this has been done before my forum search hasn't returned anything. What I am trying to do is to covert the SX/ Help file thermometer example·to displaying the tempurature on my Parallax 16X2 serial LCD. I have been able to make it work as shown in the help file using the 7 segment LEDs so I'm sure my hardware is OK. but when I modify the program to send it to the LCD the values are always 0. If anyone has already done this or similar and would like to share their code I would be greatfull. Can't see where I am going wrong with this program. Seems to me I should get something.
Thanks,
Jim W.
SXB
![](/plugins/FileUpload/images/file.png)
11K
Comments
The internal 4MHz clock cannot be used with serial communication. It is not accurate enough.
Change the OSC4MHZ parameter on the device line and use a resonator.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.iElectronicDesigns.com
·
I have been trying to do this as well. I haven't finished (GEE...that doesn't sound like me? Move on to something else...? [noparse]:)[/noparse] ) but I can post what I have done if you think it will help.
Shawn
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Shawn Lowe
Maybe I should have waited to do that......
I'm sure it can't work anyworse than mine.
Bean,
I will try the resonator route tonight. But, If the reason you sugest it is about talking to the DS1620, the SX/B example doesn't require the resonator and it did work that way using the seven segment LEDs. As the program stands it talks to the LCD fine. I can display Variables and the little pong character chompers work. Anyway, I will be happy to give it a shot. I have yet to try the resonators. I just gotta find them.
Best,
Jim W.
··· I, too, am working my way up the SX/B learning curve.
··· I've modified one of the sample programs to use the Parallax LCD, a temperature probe, and a pot using RCTIME.
··· Some of it may be of value to you. It ain't pretty because I left in a lot stuff from the programs I borrowed from.
· Cheers,
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tom Sisk
http://www.siskconsult.com
Joe
I will have a peek after the company leaves later today.
Hi Joe,
I tried instead of using the tempurature vaiable to make a simple counter and that displayed the counting fine. I also tried making the variable equal a certain number and that number is didplayed ok. I think the problem is in how the code is reading the chip or initializing the chip. I must be missing something sutle. I was hoping it might be obvious to someone with more experience. I will also try to locate my parallax o scope and see if the chip is getting input and outputing something. Even though I quadrupled checked the wiring, at this point there might still be a hardware issue.
Thanks to all,
Jim W.
Shawn
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Shawn Lowe
Maybe I should have waited to do that......
Write
SHIFTOUT DS1620DataIO,DS1620Clock,LSBFIRST,temp2
Read
SHIFTIN DS1620DataIO,DS1620Clock,MSBFIRST,temp1
I have to call SHIFTIN twice like you are doing to get all the data. I remember a thread in this forum about the data conversion. I included some pseudo code to convey the concept. Basically, by using other information from the DS1620, it was possible to increase the resolution.
CONVERT:
theTemp = theTemp >> 1 = 29 (00111011) (00011101)
theTemp = theTemp * 100 = 2900 29 * 100
theTemp = theTemp – 25 = 2875 2900 - 25
cRem = slope - cRem = 8 16 - 8
cRem = cRem * 100 = 800 8 * 100
cRem = cRem / slope = 50 800 / 16
theTemp = theTemp + cRem = 2925 2875 + 50
theTemp = theTemp */ $01CC = 5255 Explained below
theTemp = theTemp + 3200 = 8455 5255 + 3200
theTemp = theTemp / 100 = 84 8455 / 100 = 84.55 (drop decimal)
cRem = __WREMAINDER = 55 Remainder from above
RETURN
Also, the DS1620 requires about 700 ms to make the conversion. I monitor the status byte to determine when the temperature is ready before reading it.
Joe
http://forums.parallax.com/showthread.php?p=690243
The code's a bit messy, but I'm sure you can figure it out.
Regards,
Jon
I have been working on the problem program that I posted at the begining of this thread. I found a couple problems with it and I finally got it working somewhat. One problem was that I was pulling up a pin that was actually being used. The second problem was that for some reason the rst line wasn't working when the exact same command worked fine in the helpfile example. The example has 'rst = 1' but what worked for me was saying 'high rst' or 'low rst'! I'm stumped why 'rst = x' wouldn't work but changing it worked! I'm not at the right temp yet but I can see a result when I warm up the chip. Attached is the code that is kinda working for anyone·that might want to check it out. I'll post a cleaner working one if I can get it totaly working.
If anyone knows why 'High rst' works but 'rst = 1' doesn't please let me know.
Thanks,
Jim W.
TRIS_C = %00000000 'all outputs
near the beginning of your program (after the PLP commands, say), rst=1 might work again.
The HIGH command produces seven lines of assembly because it assigns I/O direction (i.e., makes the pin an output). It could get expensive if you have a large program. By assigning your pins I/O direction at the start, you assign I/O direction once. From then on, you should be able to use rst=1 which produces a single line of assembly.
Joe
You were right TRIS command did the trick. I changed the rst line back to the original setup and it works!
Here is a working version of the program. It still needs cleaning up but it should be·a·decent starting point for anyone·wanting to show tempurature on a 16 X 2 LCD.
Thanks everyone,
Jim W.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Shawn Lowe
Maybe I should have waited to do that......