beautypg.com

An118 – Cirrus Logic AN118 User Manual

Page 7

background image

AN118

AN118REV2

7

tines, the user must place the DIP switches back
into the ‘000’ position and reset the evaluation
board. Each of the seven test modes is now de-
scribed.

Mode 1, Loop Back Test - This test is used to check
the 80C51’s on-chip UART. To perform this test,
the user must place HDR7 in loop back position as
indicated on the evaluation board, and set the DIP
switches to ‘001’. When this mode is entered, a
byte (0xAA) is sent out to the UART and then a
byte is received from the UART. A delay is insert-
ed to allow time for the information to be transmit-
ted and received, and then the received byte is
compared to the transmitted information. If the re-
ceived byte is equal to 0xAA(HEX), then the test
was successful, and the code calls the
toggle_all_leds routine, which continuously blinks
all four LEDs. If the information does not match
up, the test failed, and the code branches to the
toggle_two_leds routine, which continuously
blinks only the first two LEDs (RESET and
COMM).

Mode 2, Read/Write to ADC - This mode tests the
microcontroller’s ability to read and write the inter-
nal registers of the ADC. To perform this test, the
user sets the DIPs to ‘010’ and resets the board.
Upon entering this test mode, the code writes
0xAA0000(HEX) to both the offset and gain regis-
ters of Physical Channel 1 (PC1). The information
is then read from these two registers, and the high
byte of each is compared to the value 0xAA(HEX).
If they are both the same, then the test passed, and
toggle_all_leds is called. If either of the registers
were not written properly, the test failed, and
toggle_two_leds is called.

Mode 3, Continuously Acquire Single Conversion
- In this mode, conversions are continuously ob-
tained from the ADC. This test mode is initiated by
setting the DIPs to ‘011’. The first two LEDs are
lighted, and the code loops and continuously gath-
ers conversions until the evaluation board is reset.

By probing HDR6 on the evaluation board and us-
ing CS as a triggering pin, an oscilloscope or logic
analyzer will display how the microcontroller reads
conversion data in real-time.

Mode 4, Continuously Write Gain Register - In
mode 4, the gain register of PC1 is written to con-
tinuously. The test mode is entered by setting the
DIPs to ‘100’. The third LED (GAIN_CAL) is lit,
and the code loops and keeps writing to the gain
register of PC1 until the evaluation board is re-
set.By probing HDR6 on the evaluation board and
using CS as a triggering pin, an oscilloscope or log-
ic analyzer will display how the microcontroller
writes information to the ADC’s internal registers
in real-time.

Mode 5, Continuously Read Gain Register - This
mode continuously reads the gain register on PC1.
Setting the DIPs to ‘101’ selects this test mode. The
odd LEDs (RESET and GAIN_CAL) are lit, and
the code loops through to read from the gain regis-
ter of PC1 until the evaluation board is reset. By
probing HDR6 on the evaluation board and using
CS as a triggering pin, an oscilloscope or logic an-
alyzer will display how the microcontroller reads
data from the ADC’s internal registers in real-time.

Mode 6, PC to Microcontroller RS-232 Communi-
cation Link Test - This test is performed in con-
junction with the PC to verify that the RS-232 link
is fully operational on both ends. Setting the DIPs
to ‘110’ selects for this test mode. When HDR7 is
in the Normal position, the controller receives three
bytes of information from the PC, and then echoes
them back in the same order that they were re-
ceived and calls toggle_all_leds. When HDR7 is in
the Loopback position, the three bytes are automat-
ically looped back to the PC through the RS-232
circuitry. The PC software indicates whether this
test passes or fails, based upon the bytes it receives
back from the board.

Mode 7, Toggle LEDs - This mode is used to test
the functionality of the LEDs on the evaluation