PDA

View Full Version : Ds1820



puru
- 23rd July 2005, 11:59
Beacause of low brain activity I am unable to split the reading from a ds1820 temperature sensor into separate bytes in order to send by radio each byte together with its row and location bytes to serial lcd.
***********
OWIn DQ, 0, [temperature.LOWBYTE, temperature.HIGHBYTE, Skip 4, count_remain, count_per_c]

' Calculate temperature in degrees C to 2 decimal places (not valid for negative temperature)
temperature = (((temperature >> 1) * 100) - 25) + (((count_per_c - count_remain) * 100) / count_per_c)
LCDOut $fe, 1, DEC (temperature / 100), ".", DEC1 temperature
***********
Thank you very much for any help.

Acetronics2
- 23rd July 2005, 12:40
Why are you angry ??? DS 1820 is not responsible for any thing here ...

You use a serial LCD and parallel devices command ... of course it can't work properly.

Have a little look to serial commands like SEROUT ...

Alain

puru
- 23rd July 2005, 14:15
Thanks for you reply but now I realize my post is not clear. The last line of the program I posted is not for the remote display. I do use serout but I'm not able to send temperature, that is a word, divided in multiple one byte. Before each one of these bytes I have also to send the row and location byte.

puru
- 23rd July 2005, 14:35
For example if the temperature is 15.78 I have to send: row, location, 1 after that row, location, 5 and so on.

NavMicroSystems
- 23rd July 2005, 16:43
Assuming temperature is a word size variable and holds a value of 1578 (for 15.78 deg C)

Use SEROUT2 with the DEC modifier. (See Manual Section 5.71)
(SEROUT doesn't support modifiers)

Also have a look at Manual Section 4.17.7
DIG will solve your problem



SEROUT2,Pin,Mode,[DEC1 temperature DIG 3,DEC1 temperature DIG 2,".",DEC1 temperature DIG 1,DEC1 temperature DIG 0," °C"]


You will have to add the control-codes for your LCD to the code-example

puru
- 26th July 2005, 11:00
Thank you very much Ralph for your solution. Despite all manuals, just now I can see a way to access the innard of temperature variable.
Bert