#device PIC16F873 ADC=10 #include <16f873.H> /* make sure power-up timer and brown out timer are off * for low voltage parts when programming */ #org 0x0F00, 0x0FFF void loader16F873(void) {} //protect bootloader code for the 4k 16F873/4 #fuses HS,NOWDT,NOPROTECT,PUT #use delay(clock=4000000) #use rs232(baud=19200,xmit=PIN_C6,rcv=PIN_C7) main() { long count; long value_x, value_y, value_z; count = 0; setup_port_a(ALL_ANALOG); setup_adc(ADC_CLOCK_INTERNAL); while(1) { set_adc_channel(0); delay_ms(1); value_x = Read_ADC(); set_adc_channel(1); delay_ms(1); value_y = Read_ADC(); set_adc_channel(4); delay_ms(1); value_z = Read_ADC(); printf("%2x%2x%1x%2x%1x%2x%1x%2x\n", count >> 8, count & 0xff, value_x >> 8, value_x & 0xff, value_y >> 8, value_y & 0xff, value_z >> 8, value_z & 0xff); /* delay_ms(10); */ count++; } }