I need some help with assembler code
In first place excuse me for my english , but I am not an English Speaker.
The program is written in SASM language and reads the temperature value from·a DS1620 chip and send it to a Parallax Serial LCD. It works very well, but when I try to write into the screen "Temperature is: " following by the temperature value, the program only displays·the value·the first time, the second round it puts "00.0". I can't find the error. Can somebody help me? Thanks
Gustavo
The program is written in SASM language and reads the temperature value from·a DS1620 chip and send it to a Parallax Serial LCD. It works very well, but when I try to write into the screen "Temperature is: " following by the temperature value, the program only displays·the value·the first time, the second round it puts "00.0". I can't find the error. Can somebody help me? Thanks
Gustavo
SRC
![](/plugins/FileUpload/images/file.png)
19K
Comments
Have you used the debugging features of the SX-Key IDE? You can set a breakpoint and see the value of variables using the WATCH directive. You have the tools to find the problem.
As a test, I would force a value into the variable that holds the temperature from the DS1620. Right after the comment line that says:
do something like this:
This way, no matter you get the DS1620, you'll display the value "100" on your LCD. Do this to see if the problem is communication with the DS1620. You could also move your label called "again" to be above this line:
This will force your code to do all the DS1620 initializations again. This will help you figure out if the problem is that the DS1620 is not getting the right command to do a temperature conversion.
Also, there is no need to keep initializing the LCD in the main loop. Do it once at the start of your program right after you clear the SX memory. Then, just use the cursor commands to put the cursor where you need it before you write to the LCD.
Thanks,
PeterM
······· I did what you suggested me and the problem still continue. Using the debugging features I found a weird behaviour during the ShiftOut subroutine execution: it doesn't send the "Read Temperature" protocol to DS1620, but only during the second jump (jmp again); the first time it works ok.
I soved the problem using thE RETW method to create the data table instead of IREAD. I initialize the LCD rigth in the beginning as you said. Now it works as I expected. Attached is the new version.
Thank you for your help Peter, I appreciated a lot
· I noticed in your original post you don't have a zero byte after your string "Temperature is". So the faulty loop will not exit properly.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"Educate your children to self-control, to the habit of holding passion and prejudice and evil tendencies subject to an upright and reasoning will, and you have done much to abolish misery from their future and crimes from society"
Benjamin Franklin
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.hittconsulting.com
·
······ You are right, but the weird behaviour still continue. In the ShiftOut subroutine we have the line
·············· mov···· DQ,c········· ;Move carry bit to input of DS1620
Generates:
·············· sc
·············· clrb···· RA.2
·············· snc
···············setb··· RA.2
After the first jump/again, it doesn't set the bit RA.2 when it has to, I don't know why. So the DS1620 doesn't receive the "order" to read the temperature value
This is the first time I try to write a program in assembler, and·this is beyond my knowledge
Why not use the SX/B basic compiler ?
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"Educate your children to self-control, to the habit of holding passion and prejudice and evil tendencies subject to an upright and reasoning will, and you have done much to abolish misery from their future and crimes from society"
Benjamin Franklin
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.hittconsulting.com
·