Friday, April 14, 2006

code_Analogue In & Serial Out

DEFINE OSC 4

DEFINE ADC_BITS 8
DEFINE ADC_CLOCK 3
DEFINE ADC_SAMPLEuS 20

‘This is to test if the values were transmitted correctly
‘It will blink once it goes out to Serial Out
RedLed var portd.1
‘This is to test if the values were received correctly
‘It will blink once something comes in from the Serial In
BluLed var portd.0

‘Variable for the measurement
measurement VAR BYTE
‘Variable to count the number of transmission
counter VAR BYTE

'this will be the pin that I transmit from
outPin var portc.6

counter = 0

TRISA = %11111111 ' Set PORTA to all input
ADCON1 = %10000010 ' Set PORTA analog and right justify


main:

adcin 0, measurement 'get adc value from channel 0 put in counter

serout2 outPin, 16468, [DEC measurement ]

high RedLed
pause 50
Low RedLed
Counter = Counter + 1

Pause 100

goto main

0 Comments:

Post a Comment

<< Home