vasili35
Newbie level 4
Friends DS18S20 with my application would be a question?
I share this code, the internal oscillator frequency of 1 MHz at 4 MHz, but I want to work out hard as a highly value = 32.765. I can not make that calculation formula. I've tried so hard to fix but could not find any solution .. Could you explain this to me if you have an idea? Thank you.
I share this code, the internal oscillator frequency of 1 MHz at 4 MHz, but I want to work out hard as a highly value = 32.765. I can not make that calculation formula. I've tried so hard to fix but could not find any solution .. Could you explain this to me if you have an idea? Thank you.
Code:
Device = 18F452
WATCHDOG = OFF
ALL_DIGITAL TRUE
LCD_DTPIN = PORTD.4
LCD_RSPIN = PORTD.2
LCD_ENPIN = PORTD.3
LCD_INTERFACE = 4
LCD_LINES = 2
LCD_TYPE = 0
Symbol DQ = PORTA.3
Dim Temp As Word
Dim D As Byte
Dim C As Byte
Dim CPerD As Byte
Print $FE,$40,$06,$09,$09,$06,$00,$00,$00,$00
Cls
start:
OWrite DQ, 1, [$CC, $44]
Repeat
DelayMS 25
ORead DQ, 4, [C]
Until C <> 0
OWrite DQ, 1, [$CC, $BE] 'scratchpad
ORead DQ, 2,[Temp.LowByte,Temp.HighByte,C, C, C, C, C, CPerD]
Print At 1, 2, Dec (Temp>>1), ".", Dec (Temp.0 * 5),0,"C"
GoTo start