jmie
Newbie level 4
hi guys.. i'm doing a project which use mcp9700 to measure temperature interfacing with pic18f46k20, then display on LCD and hyper terminal..here's my code PICBasic below:
INCLUDE "modedefs.bas"
define osc 20
define LCD_DREG PORTD
define LCD_DBIT 4
define LCD_RSREG PORTD
DEFINE LCD_RSBIT 2
define LCD_EREG PORTD
define LCD_EBIT 3
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2
'HIGH PORTD.1
C VAR WORD
define ADC_BITS 10
define ADC_CLOCK 3
define ADC_SAMPLEUS 50
lmtemp var word
temp var word
quanta con 1250
TRISE = %11111111
ADCON1 = 0
MAIN:
ADCIN 6, lmtemp
temp = ((lmtemp/100)/2)+8-50
;PORTA.1=1
;C=PORTE.1
'LOW PORTD.1
LCDOUT $FE,1
LCDOUT " Programmed by"
LCDOUT $FE,$C0
lcdout "Jmie TEMP="
LCDOUT #temp
LCDOUT " C"
'Serout portb.0,N9600,["The Room Temp Are Now ",#temp,"C",10,13,32]
Serout portb.0,N9600,["The Room Temp Are Now ",#temp,"C",13]
PAUSE 200
GOTO MAIN
end
is it correct for the temperature equation??
LCD is working fine but i have a problem to display at hyper terminal because when i change my pic18f46k20 to pic16f877A, it will display at hyper terminal..so..what's wrong with my pic?is it about baud rate?
i hope guys can help me...
INCLUDE "modedefs.bas"
define osc 20
define LCD_DREG PORTD
define LCD_DBIT 4
define LCD_RSREG PORTD
DEFINE LCD_RSBIT 2
define LCD_EREG PORTD
define LCD_EBIT 3
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2
'HIGH PORTD.1
C VAR WORD
define ADC_BITS 10
define ADC_CLOCK 3
define ADC_SAMPLEUS 50
lmtemp var word
temp var word
quanta con 1250
TRISE = %11111111
ADCON1 = 0
MAIN:
ADCIN 6, lmtemp
temp = ((lmtemp/100)/2)+8-50
;PORTA.1=1
;C=PORTE.1
'LOW PORTD.1
LCDOUT $FE,1
LCDOUT " Programmed by"
LCDOUT $FE,$C0
lcdout "Jmie TEMP="
LCDOUT #temp
LCDOUT " C"
'Serout portb.0,N9600,["The Room Temp Are Now ",#temp,"C",10,13,32]
Serout portb.0,N9600,["The Room Temp Are Now ",#temp,"C",13]
PAUSE 200
GOTO MAIN
end
is it correct for the temperature equation??
LCD is working fine but i have a problem to display at hyper terminal because when i change my pic18f46k20 to pic16f877A, it will display at hyper terminal..so..what's wrong with my pic?is it about baud rate?
i hope guys can help me...