Hi Eugeniu,
as I have already explained in my first post:
use the DIG modifier to separate the single digits of your calculated temperature.
Then simply add 48 to each digit and you will get the ASCII code.
If temperature is 2555 for 25.55°C
n0 = (temperature dig 0) + 48
n0 is 48+5 = 53 = ASCII "5"
...
Regards,
Ingo
Dear Ingo ,
I work by many days to do this and in my mind is a black hole. Please if you wish to help me , write a example ,
i2cwrite I2CDAT, I2CCLK, $A0, adr,[TELL ME WHAT i MUST TO WRITE HERE ]
I think that you now formula for temperature measurement with Onewire sensor ( one from others ) :
" temperature = (((temperature >> 1) * 100) - 25) + (((count_per_c - count_remain) * 100) / count_per_c) "
If I will write :
LCDOUT $FE, $C0, DEC TEMPERATURE
I'll be reading 2555
For LCDOUT and to see a comma , I use this formula :
lcdout "temp= " , dec temperature/2 ,"," , dec2 100- (100/16)*(count_remain)," gr.C"
, but ....If I write in EEPROM :
i2cwrite I2CDAT, I2CCLK, $A0, adr,[temperature]
When I will read it with my FORMULA :
i2cread I2CDAT , I2CCLK , $A0,J,[caracter]
in " caracter "will can be read , time to time , a single sign / not a cipher
Last edited by Eugeniu; - 16th October 2008 at 20:46.
Hi Eugeniu,
your program is a little bit hard to read without knowing Romanian (right?).
If you want to store the temperature value in single ASCII characters, something like this might work:
i2cwrite I2CDAT, I2CCLK, $A0, adr,[(temperature dig 0= + 48, (temperature dig 1) + 48, (temperature dig 2) + 48, (temperature dig 3) +48]
Add the comma where you please or add it after reading back the value.
Correct me if I am talking bull****...
Regards,
Ingo
If that's the only thing you are getting out of the temp sensor, then I'm thinking it probably meaning that your connection or your sensor probably isn't working because it's returning a value that's always max'd out for a byte variable...
Put the sensor in some ice water and see if the reading changes...
Get the core working first, then start adding things. You're not even sure if the sensor part is working in the first place!
Each one of these statements might only be WRITE'ing (or READ'ing) a BYTE, not a WORD. Not sure what the rest of your code says..., but ....If I write in EEPROM :
i2cwrite I2CDAT, I2CCLK, $A0, adr,[temperature]
When I will read it with my FORMULA :
i2cread I2CDAT , I2CCLK , $A0,J,[caracter]
in " caracter "will can be read , time to time , a single sign / not a cipher
You wrote:
"LCDOUT $FE, $C0, DEC TEMPERATURE
I'll be reading 2555 "
Now:
ByteInteger = TEMPERATURE/100
ByteDecimal = TEMPERATURE-(ByteInteger*100)
LCDOUT $FE, $C0, DEC ByteInteger,",",ByteDecimal
You will see on your display 25,55.
You don't need to store the comma (separator) but you will store only ByteInteger and ByteDecimal in a location that can be recalled to read back the values. Than after the reading you will add the separator as above.
Al.
Sorry I have forgotten a Dec. Please read......
LCDOUT $FE, $C0, DEC ByteInteger,",",DEC ByteDecimal
Dear MEN !
I do not use a LCD display . I have make only a comparision .
I use in front of my program this line to write text "
I2Cwrite I2CDAT, I2CCLK, $A0, adr,[" Temperature is _________________ "]
late in program , in free space I wish to write DATA of temperature
adr = 15( where is free space )
I2Cread I2CDAT, I2CCLK, $A0, adr,[ temperature DATA ]
In finish, I wish to can read all - text and temperature DATA as ASCI CODE such as
Temperatura is 25,55(for example) .
from this formula :
i2cread I2CDAT , I2CCLK , $A0,J,[caracter]
program read for every adrress (j) a sign (caracter ) in ASCI Code , and this CODE i'll translate in leds on .But where I write temperature DATA , program read other signs not ASCI CODE for 25,55 ( for example )
Now understand me ?
I 'll try to write only text with quote and temperature DATA except quote
Last edited by Eugeniu; - 17th October 2008 at 08:40.
Bookmarks