int main(void) { unsigned int wait = 0; int readcount = 0; Serial_init(); INTEnableSystemMultiVectoredInt(); mJTAGPortEnable(0); printf("\r\nUno A/D Test Harness\r\nThis will initialize all A/D pins and read them %d times", TIMES_TO_READ); printf("Value of pcfg before test: %X",AD1PCFG); AD_init(AD_PORTV3 | AD_PORTV4 | AD_PORTV5 | AD_PORTV6 | AD_PORTV7 | AD_PORTV8 | AD_PORTW3 | AD_PORTW4 | AD_PORTW5 | AD_PORTW6 | AD_PORTW7 | AD_PORTW8 | BAT_VOLTAGE); char numtoread = 13; unsigned char cur = 0; while (readcount <= TIMES_TO_READ) { for (wait = 0; wait <= 100000; wait++) asm("nop"); printf("\r\n"); for (cur = 0; cur < numtoread; cur++) { printf("%d\t", AD_readPin(1 << cur)); } printf("\r\n"); readcount++; } printf("Done Reading Them\r\n"); AD_end(); printf("Value of pcfg after test: %X",AD1PCFG); return 0; }
/*************************************************************************** * this function checks if the current consumption has exceeded a threshold * for more than 200 ms using a filtered verion of the current reading. ***************************************************************************/ void init_currents( void ) { AD_init (); AD_enableIntTriggerA (); AD_enableIntTriggerB (); }