Yes, I did see that, and corrected it, and now what it is reading back after the 60 readings are taken, is numbers that don't match what I saw when the readings were being taken. For example, the readings start out at about 75 and I cause the thermistor to go up to about 85 and slowly come back down, to have some variation. The readings being read back are 255, 7, 9, 13, 255...255.
I have update my code to read as follows:
Code:' Define A/D converter and LCD parameters ' DEFINE ADC_BITS 8 ' A/D number of bits DEFINE ADC_CLOCK 3 ' Use A/D internal RC clock DEFINE ADC_SAMPLEUS 50 ' Set sampling time in us Define LCD_DREG PORTC Define LCD_DBIT 4 Define LCD_RSREG PORTC Define LCD_RSBIT 3 Define LCD_EREG PORTC Define LCD_EBIT 2 ' Variables used Res Var Byte ' A/D converter result Temp1 Var Byte ' Temperature in degrees F Addr Var Byte ' Address of EEPROM CPin var PortB.0 'Pin for the SEEPROM Clock DPin var PortB.1 'Pin for the SEEPROM Data I var byte 'Variable for Collecting Data For/Next Loop RI var byte 'Variable for Results Reading For/Next Loop RAddr var byte 'Variable for Address of SEEPROM Results WB var word 'Varable for Waiting for Button Loop TempR var byte TRISB.7 = 1 'Pin used for Button ' PAUSE 500 ' Wait 0.5sec for LCD to initialize ' Clear display and display message "COLLECTING DATA…" lcdout 254,0 lcdout 254,1,"Collecting DATA>" ' Initialize the A/D converter TRISA = 111111 ADCON1 = 000010 'ADCON1 = 7 '==========================Colect Data====================================== CollectData: FOR I = 0 TO 60 ADCIN 0, Res ' Read Channel 0 data Temp1 = Res - 40 ' Calc Adjustment to degrees F Addr = I I2CWrite DPin,CPin,$A0,Addr,[Temp1] lcdout 254,192,dec3 Addr, " : ", dec3 Temp1 PAUSE 10 ' Wait 1 msecond gosub WaitForButton NEXT I ' Repeat lcdout 254,0 lcdout 254,1, "Results" goto DoneCollecting '===========================Wait For Button================================= WaitForButton: For WB = 1 to 600 if PortB.7 = 1 then Results pause 10 Next WB Return '=============================Done Collecting================================ DoneCollecting: if PortB.7 = 1 then Results pause 10 goto DoneCollecting '===============================Results====================================== Results: lcdout 254,0 lcdout 254,1, "Results" FOR RI = 0 TO 60 RAddr = RI I2CRead DPin,CPin,$A0,RAddr,[TempR] lcdout 254,192,dec3 RAddr, " : ", dec3 TempR pause 1000 'Wait one second NEXT RI END ' End of program




Bookmarks