You are on page 1of 7

s1820 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 DEFINE DEFINE DEFINE DEFINE DEFINE DEFINE DEFINE DEFINE DEFINE symbol symbol SYMBOL SYMBOL LCD_DREG PORTA 'LCD data port LCD_DBIT 0 'LCD data starting bit 0 or 4 LCD_RSREG PORTA 'LCD register select port LCD_RSBIT 4 'LCD register select bit LCD_EREG PORTB 'LCD enable port LCD_EBIT 3 'LCD enable bit LCD_BITS 4 'LCD bus size 4 or 8 LCD_LINES 4 'Number lines on LCD LCD_COMMANDUS 2000 'Command delay time in us LCD_DATAUS 50 'Data delay time in us DQ1 DQ2 DQ3 DQ4 = = = = PORTB.4 'DQ connect to RB4 PORTB.0 PORTB.1 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, c ount_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_remai n1) * 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_remain 2) * 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_remai n2) * 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 ap

preciated[/list] Reply With Quote

13-02-05, 09:05 #2 jojokatada Full Member level 5 Achievements: Join Date Jan 2005 Posts 255 Helped 19 / 19 Points 2,921 Level 12 ds1820 pic16f84 hi it seem to me there are many viewers on my post did anybody try to compile my source ? what are the result please post so we could share appreciate Reply With Quote 13-02-05, 10:33 #3 rkodaira Full Member level 6 Achievements: Join Date Jun 2004 Location Sao Paulo - Brasil Posts 331 Helped 63 / 63 Points 13,647 Level 28 ds18b20 picbasic Your program is too large for the PIC 16F84A (only 1024 words of program memory) . The compiler said that this. Maybe you have to change the PIC to another model with more memory (16F628A or larger, good options are 16F819, 16F88 and 18F1320 ). Other option is to try to optimize your code, or simplify it, to decrease the me mory to be used.

Reply With Quote

13-02-05, 17:42 #4 jojokatada Full Member level 5 Achievements: Join Date Jan 2005 Posts 255 Helped 19 / 19 Points 2,921 Level 12 ds1820 pic basic yes i did i try the pic16f876a it compile correct but i can't displa yi the 4 di fferents temperature in 4 lines of the lcd i got some strange character, sort of dump memory i guess. or perhaps the 18s20 can't connect in all the same as mast er i need to check maxim datasheet again. appreciate the advice. Reply With Quote 13-02-05, 19:40 #5 yo5oqa Junior Member level 2 Achievements: Join Date Oct 2004 Location Romania Posts 20 Helped 8 / 8 Points 1,607 Level 9 picbasic ds1820 --------------Main: ' TEMP 1 owout DQ1, 1,[$CC, $44] pause 1000 ; -- need this -OWin DQ1, 4,[count_remain] etc

--------------You must move "pause 1000" after the "convert T" command ($44); ds18s20 needs ab out 800 ms to do the conversion, after that you can read it. ...and you must check if there are 4.7 k resistors from DQ to Vdd. ...and if you have 20 sensors, you write 20 routines for this? You can do only o ne and call it with "DQx" parameter 1 members found this post helpful. Reply With Quote

13-02-05, 20:46 #6 Nick C. Full Member level 5 Achievements: Join Date Dec 2002 Posts 281 Helped 30 / 30 Points 3,642 Level 14 pic16f84a lcd I see that you are pausing for 100ms at the beginning of the program. I'm assuming this is to let the LCD settle after powering up. That _should_ be long enough for most LCD's, but I've had some otherwise standard 44780-based displays need 500ms or more to settle or else I'd have trouble communicating with them. This may or may not be your problem (I don't have any experience with using multiple 1-wire devices), but it should be fast enough to recompile your code and give it a try. Can't hurt. Nick 1 members found this post helpful. Reply With Quote 14-02-05, 15:55 #7 yo5oqa Junior Member level 2 Achievements: Join Date Oct 2004 Location

Romania Posts 20 Helped 8 / 8 Points 1,607 Level 9 temperature pic16f84a This code should work and it's 1/2 size (569 words on 16f84) --------------symbol DQ1 = PORTB.4 'DQ connect to RB4 symbol DQ2 = PORTB.0 symbol DQ3 = PORTB.1 symbol DQ4 = PORTB.2 dq var byte adr var byte index var byte temperature var word count_remain var byte count_per_c var byte pause 1000 Main: dq=dq1 : adr=$1 : index=1 gosub temp dq=dq2 : adr=$c0 : index=2 gosub temp dq=dq3 : adr=$94 : index=3 gosub temp dq=dq4 : adr=$d4 : index=4 gosub temp goto Main temp: owout DQ, 1,[$CC, $44] pause 1000 owin DQ, 4,[count_remain] if count_remain = 0 then owout DQ, 1, [$CC, $BE] owin DQ, 0, [temperature.LOwBYTE, temperature.Highbyte, Skip 4, count_remain, co unt_per_c] endif temperature = (((temperature >> 1)*100)-25)+(((count_per_c-count_remain) * 100)/ count_per_c) lcdout $FE,adr lcdout " Environment Temp", dec index, dec (temperature / 100) , ".", dec2 tempe rature, " C" return end -----------------------3 members found this post helpful. Reply With Quote + Post New Thread

INHX32 with Waccess(ALL-11)? | PIC & 8051 Interface[Strange isnt it ? ] Similar Threads PC Thermometer DS18S20 (5) MeLabs PICBasic Pro & Crownhill PicBasic PLUS Comparison (0) 7-Segment Display & PICBasic Pro (4) DS18s20 display on 20X4 LCD for temperature (1) Running Message Display Using PIC16F84A (1) Contact Us Forum for Electronics Privacy Statement Terms of Service Top All times are GMT +1. The time now is 17:20. Powered by vBulletin Copyright 2010 vBulletin Solutions, Inc. All rights reserved. SEO by vBSEO 2011, Crawlability, Inc.

You might also like