Code: Select all
program ADC
dim adcRes as word
txt as string[6]
txt1 as string[6]
main:
TRISB.1 = 1 ' set pin as input - needed for ADC to work
Uart1_Init(9600)
while true
adcRes = Adc_Read(1)
if (adcRes>600) then
WordToStr(adcRes, txt)
Uart1_Write_Text(txt)
Delay_ms(50)
else
adcRes=600
WordToStr(adcRes, txt1)
Uart1_Write_Text(txt1)
end if
wend
end.