Tuesday, April 25, 2006

op-amp

Friday, April 14, 2006

code_working

'****************************************************************
'* Name : UNTITLED.BAS *
'* Author : [select VIEW...EDITOR OPTIONS] *
'* Notice : Copyright (c) 2006 [select VIEW...EDITOR OPTIONS] *
'* : All Rights Reserved *
'* Date : 4/14/2006 *
'* Version : 1.0 *
'* Notes : *
'* : *
'****************************************************************
DEFINE OSC 4

DEFINE ADC_BITS 8
DEFINE ADC_CLOCK 3
DEFINE ADC_SAMPLEuS 20

RedLed var portd.1 'to test transmitted data
bluLed var portd.0 'to test received data from pd

measurement VAR BYTE
counter VAR BYTE

outPin var portc.6 'transmitting pin

counter=0

TRISA=%11111111 'to set all portA to analogue input
ADCON1=%00000010

main:

adcin 0, measurement
serout2 outPin, 16468, [DEC measurement,13,10]

high REdLed
pause 50
Low RedLed
counter=counter+1

Pause 100

goto main

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

Tuesday, April 11, 2006

code_test serial

counter var byte
Startcounter VAR BYTE

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


main:

serout2 PORTC.6, 16468, [DEC counter ]
counter = Startcounter

goto main