An118 – Cirrus Logic AN118 User Manual
Page 25

AN118
AN118REV2
25
else
toggle_two_leds();
/* Test Failed */
break;
/* Test Mode 3: This test lights the first two LED and then
repeatively iniates a conversion and reads it from the serial port. */
case 0x03:
RESET = 0x00;
COMM = 0x00;
while(1)
read_conversion(0x80);
break;
/* Test Mode 4: This test lights the third LED’s. Then it
continuously write to the Gain Registers of PC1. */
case 0x04:
GAIN_CAL = 0x00;
while(1)
write_to_register(0x02,0xAA,0xAA,0xAA);
break;
/* Test Mode 5: This test lights the odd LED’s. Then it
continuously reads the gain register of PC1. */
case 0x05:
RESET = 0x00;
GAIN_CAL = 0x00;
while(1)
read_register(0x0A); /* Read Gain Register of PC1 */
break;
/* Test Mode 6: This test mode tests the RS232 link.
it receives three bytes from the PC and echoes them
back. This PC determines if the test passed. The last
three LED’s are lit to indicate this test mode. */
case 0x06:
COMM = 0x00;
GAIN_CAL = 0x00;
low_byte = RXSER(); /* Receive low byte from PC */
mid_byte = RXSER();
high_byte = RXSER();
TXSER(low_byte); /* Transfer bytes back to PC */
TXSER(mid_byte);
TXSER(high_byte);
toggle_all_leds();
break;