SCI Command String Structure

Analog Input Commands

Serial Port Command: 0 thru 7
SIC Response: Reading in Counts for requested channel.
Example: To request the reading on SIC analog input channel 3, send 3 over the serial port. The SIC replies with 467. This is the A/D converter value in counts. Since the 10-bit A/D converter is referenced to the +5 Vdc supply, the input voltage on channel 3 is (467 * 5)/1024 = 2.278 Vdc.

Digital Output Commands

Serial Port Command: A, a, B, b, C, c or D, d
SIC Response: 1, 2, 3, 4, 5, 6, 7, 8
Example: To turn on Bit 0 of the SIC digital output port (brings pin 26 of ATMega32L low), send A over the serial port. The SIC confirms by reply with 1. To bring the same bit high (turn it off), send a over the serial port and the SIC replies with 2. Other digital bits are similar with upper and lower case letters to bring bits low and high.

The reason that turning a bit "On" means to bring it low is because the ATMega32L can sink 20 mA of current on a digital I/O pin, but can't source as much. So you can turn an LED on by simply connecting it between the +5 V supply (through a 330 Ohm resistor) to the ATMega32L digital bit and sinking the resulting current flow when the bit goes low.

Digital Input Commands

Serial Port Command: W, X, Y, Z
SIC Response 0 or 1
Example: To get the state of digital input 0 (pin 22 of ATMega32L), send a W over the serial port. The SIC replies with 0 or 1: 0 if bit is low, 1 if bit is high. This will correspond to the state of a switch as wired through a pull-up resistor to the +5 V supply.

Ping Command

Serial Port Command: P
SIC Response: SI430 65535
Example: Sometimes you just want to know that the SIC is working and functioning OK. Sending a P over the serial port should generate a reply of SI430 65535 . This is useful for debugging and verifying that the serial port is configured correctly.

Illegal Commands

If the SIC receives a command other than one of the above, it will respond with the number 65535.