jojokatada
Full Member level 5
ds1820 picbasic
hi
is it possible to use 4 ds1820 a pic16f84a which will be display four different temperature on the 4 lines of the lcd?
so far it work with 1 ds1820 because i am using a 4x20 lcd.
sample code
DEFINE LCD_DREG PORTA 'LCD data port
DEFINE LCD_DBIT 0 'LCD data starting bit 0 or 4
DEFINE LCD_RSREG PORTA 'LCD register select port
DEFINE LCD_RSBIT 4 'LCD register select bit
DEFINE LCD_EREG PORTB 'LCD enable port
DEFINE LCD_EBIT 3 'LCD enable bit
DEFINE LCD_BITS 4 'LCD bus size 4 or 8
DEFINE LCD_LINES 4 'Number lines on LCD
DEFINE LCD_COMMANDUS 2000 'Command delay time in us
DEFINE LCD_DATAUS 50 'Data delay time in us
symbol DQ1 = PORTB.4 'DQ connect to RB4
symbol DQ2 = PORTB.0
SYMBOL DQ3 = PORTB.1
SYMBOL DQ4 = PORTB.2
temperature var word
count_remain var byte
count_per_c var byte
temperature1 var word
count_remain1 var byte
count_per_c1 var byte
temperature2 var word
count_remain2 var byte
count_per_c2 var byte
temperature3 var word
count_remain3 var byte
count_per_c3 var byte
pause 100
Main: ' TEMP 1
owout DQ1, 1,[$CC, $44]
OWin DQ1, 4,[count_remain]
if count_remain = 0 then
owout DQ1, 1, [$CC, $BE]
owin DQ1, 0, [temperature.LOwBYTE, temperature.Highbyte, Skip 4, count_remain, count_per_c]
endif
temperature = ((( temperature >> 1) *100)- 25) + (((count_per_c - count_remain) * 100) / count_per_c)
lcdout $FE,1
LCDOUT " Environment Temp1", dec (temperature / 100) , ".", dec2 temperature, " C"
pause 1000
'TEMP 2
owout DQ2, 1,[$CC, $44]
OWin DQ2, 4,[count_remain1]
if count_remain1 = 0 then
owout DQ2, 1, [$CC, $BE]
owin DQ2, 0, [temperature1.LOwBYTE, temperature1.Highbyte, Skip 4, count_remain1, count_per_c1]
endif
temperature1 = ((( temperature1 >> 1) *100)- 25) + (((count_per_c1 - count_remain1) * 100) / count_per_c)
lcdout $FE,$C0
LCDOUT " Environment Temp2", dec (temperature1 / 100) , ".", dec2 temperature1, " C"
pause 1000
'TEMP 3
owout DQ3, 1,[$CC, $44]
OWin DQ3, 4,[count_remain2]
if count_remain2 = 0 then
owout DQ3, 1, [$CC, $BE]
owin DQ3, 0, [temperature2.LOwBYTE, temperature2.Highbyte, Skip 4, count_remain2, count_per_c2]
endif
temperature2= ((( temperature2 >> 1) *100)- 25) + (((count_per_c2 - count_remain2) * 100) / count_per_c2)
lcdout $FE,$94
LCDOUT" Environment Temp2",dec (temperature2 / 100) , ".", dec2 temperature2, "C"
pause 1000
'TEMP 4
owout DQ4, 1,[$CC, $44]
OWin DQ4, 4,[count_remain2]
if count_remain2 = 0 then
owout DQ4, 1, [$CC, $BE]
owin DQ4, 0, [temperature2.LOwBYTE, temperature2.Highbyte, Skip 4, count_remain2, count_per_c2]
endif
temperature2 = ((( temperature2 >> 1) *100)- 25) + (((count_per_c2 - count_remain2) * 100) / count_per_c2)
lcdout $FE,$D4
LCDOUT " Environment Temp4",dec (temperature2 / 100) , ".", dec2 temperature2, "C"
pause 1000
goto Main
end
so far compile fail
the error message
[218] address limit 3ffth exceeded
If anyone has any ideas on what may be wrong or any tips, it would be greatly appreciated[/list]
hi
is it possible to use 4 ds1820 a pic16f84a which will be display four different temperature on the 4 lines of the lcd?
so far it work with 1 ds1820 because i am using a 4x20 lcd.
sample code
DEFINE LCD_DREG PORTA 'LCD data port
DEFINE LCD_DBIT 0 'LCD data starting bit 0 or 4
DEFINE LCD_RSREG PORTA 'LCD register select port
DEFINE LCD_RSBIT 4 'LCD register select bit
DEFINE LCD_EREG PORTB 'LCD enable port
DEFINE LCD_EBIT 3 'LCD enable bit
DEFINE LCD_BITS 4 'LCD bus size 4 or 8
DEFINE LCD_LINES 4 'Number lines on LCD
DEFINE LCD_COMMANDUS 2000 'Command delay time in us
DEFINE LCD_DATAUS 50 'Data delay time in us
symbol DQ1 = PORTB.4 'DQ connect to RB4
symbol DQ2 = PORTB.0
SYMBOL DQ3 = PORTB.1
SYMBOL DQ4 = PORTB.2
temperature var word
count_remain var byte
count_per_c var byte
temperature1 var word
count_remain1 var byte
count_per_c1 var byte
temperature2 var word
count_remain2 var byte
count_per_c2 var byte
temperature3 var word
count_remain3 var byte
count_per_c3 var byte
pause 100
Main: ' TEMP 1
owout DQ1, 1,[$CC, $44]
OWin DQ1, 4,[count_remain]
if count_remain = 0 then
owout DQ1, 1, [$CC, $BE]
owin DQ1, 0, [temperature.LOwBYTE, temperature.Highbyte, Skip 4, count_remain, count_per_c]
endif
temperature = ((( temperature >> 1) *100)- 25) + (((count_per_c - count_remain) * 100) / count_per_c)
lcdout $FE,1
LCDOUT " Environment Temp1", dec (temperature / 100) , ".", dec2 temperature, " C"
pause 1000
'TEMP 2
owout DQ2, 1,[$CC, $44]
OWin DQ2, 4,[count_remain1]
if count_remain1 = 0 then
owout DQ2, 1, [$CC, $BE]
owin DQ2, 0, [temperature1.LOwBYTE, temperature1.Highbyte, Skip 4, count_remain1, count_per_c1]
endif
temperature1 = ((( temperature1 >> 1) *100)- 25) + (((count_per_c1 - count_remain1) * 100) / count_per_c)
lcdout $FE,$C0
LCDOUT " Environment Temp2", dec (temperature1 / 100) , ".", dec2 temperature1, " C"
pause 1000
'TEMP 3
owout DQ3, 1,[$CC, $44]
OWin DQ3, 4,[count_remain2]
if count_remain2 = 0 then
owout DQ3, 1, [$CC, $BE]
owin DQ3, 0, [temperature2.LOwBYTE, temperature2.Highbyte, Skip 4, count_remain2, count_per_c2]
endif
temperature2= ((( temperature2 >> 1) *100)- 25) + (((count_per_c2 - count_remain2) * 100) / count_per_c2)
lcdout $FE,$94
LCDOUT" Environment Temp2",dec (temperature2 / 100) , ".", dec2 temperature2, "C"
pause 1000
'TEMP 4
owout DQ4, 1,[$CC, $44]
OWin DQ4, 4,[count_remain2]
if count_remain2 = 0 then
owout DQ4, 1, [$CC, $BE]
owin DQ4, 0, [temperature2.LOwBYTE, temperature2.Highbyte, Skip 4, count_remain2, count_per_c2]
endif
temperature2 = ((( temperature2 >> 1) *100)- 25) + (((count_per_c2 - count_remain2) * 100) / count_per_c2)
lcdout $FE,$D4
LCDOUT " Environment Temp4",dec (temperature2 / 100) , ".", dec2 temperature2, "C"
pause 1000
goto Main
end
so far compile fail
the error message
[218] address limit 3ffth exceeded
If anyone has any ideas on what may be wrong or any tips, it would be greatly appreciated[/list]