'jleblanc 10.16.05: simple output to hypterm
' 10-bit A/D conversion
' Connect analog input to channel-0 (RA0)
DEFINE OSC 20
' Define ADCIN parameters
' Set number of bits in result
DEFINE ADC_BITS 10
' Set clock source (3=rc)
DEFINE ADC_CLOCK 3
' Set sampling time in microseconds
DEFINE ADC_SAMPLEUS 10
adcVar VAR WORD ' Create variable to store result
' Set PORTA to all input
TRISA = %11111111
' Set up ADCON1
ADCON1 = %10000010
PAUSE 500 ' Wait .5 second
main:
ADCIN 0, adcVar ' Read channel 0
SEROUT2 PORTC.6, 16468, [DEC adcVar, 10, 13]
PAUSE 10 ' Wait.01 second
GOTO main