'jleblanc 11.4.05: simple rctime out to hypterm

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
TRISD = %11111111    

' Set up ADCON1
'ADCON1 = %10000010     

PAUSE 500               ' Wait .5 second

main:         
   'Take pin 1 high to discharge capcitor
    HIGH portd.1
    'hold 1 millisecond to make sure capacitor discharged
    PAUSE 1
    'Measure time it takes to charge again
    RCTIME portd.1, 1, adcVar
  
  'ADCIN 0, adcVar ' Read channel 0
  SEROUT2 PORTC.6, 16468, [DEC adcVar, 10, 13]
  'PAUSE 10               ' Wait.01 second
GOTO main