'**************************************************************** '* Name : UNTITLED.BAS * '* Author : Min Lee * '* Notice : Copyright (c) 2006 Min Lee, ITP NYU * '* : All Rights Reserved * '* Date : 1/31/2006 * '* Version : 1.0 * '* Notes : * '* : * '**************************************************************** DEFINE OSC 4 DEFINE ADC_BITS 10 ' Set number of bits in result DEFINE ADC_CLOCK 3 ' Set clock source (3=rc) DEFINE ADC_SAMPLEUS 20 ADCvarA VAR WORD ' Create variable to store result ADCvarB VAR WORD TRISA = %11111111 ' Set PORTA to all input ADCON1 = %10000010 ' Set PORTA analog and right justify result Pause 500 ' Wait .5 second main: ADCIN 0, ADCvarA ' Read channel 0 to adval Adcin 1, ADCvarB serout2 PORTC.6, 16468, ["FSR =", DEC ADCvarA, 13, 10] ' print it to serial out, pause 500 serout2 PORTC.6, 16468, ["FLEX =", DEC ADCvarB, 13, 10] pause 500 GoTo main ' Do it forever