3.d.01. Command 218: Get Status

Effect: This command loads into the mega168 SPDR (SPI data register) the mega168’s status byte. Sending a second byte (either the NULL command or a junk data byte) over the SPI once the value is loaded will transfer it to the mega644’s SPDR. It is recommended you do not begin transmission of this second byte until 3 us after the transmission of the command byte has completed. This is to make sure the mega168 has time to load the SPDR. The status byte contains important information that the mega644 should know about the mega168’s status. The mega168 sets the attention line whenever it sets any bits in the status byte. Sending this command will clear the attention line and the latched bits of the mega168’s status byte. The bits of the status byte are enumerated as follows:

  • bit 0: STATUS_UART_ERROR — a UART error has occured, read the UART error byte for further details. This bit is latched and will remain set until the status byte is read.
  • bit 1: STATUS_UART_READ_READY — the read buffer is ready to be read according to the read-ready bytes setting. This bit reflects the real-time state of the read buffer and is not cleared by reading the status byte.
  • bit 2: STATUS_UART_SEND_FULL — the send buffer contains 32 bytes and does not have room for any more. This bit reflects the real-time state of the send buffer and is not cleared by reading the status byte.
  • bit 3: STATUS_BUZZER_FINISHED — the buzzer has finished playing and is now silent. This bit reflects the real-time state of the buzzer and is not cleared by reading the status byte.
  • bit 4: STATUS_M1_FAULT — a fault has occurred with motor 1. This bit is latched and will remain set until the status byte is read.
  • bit 5: STATUS_M1_CURRENT_HIGH — the average motor 1 current has met or exceeded the specified current limit. This bit will never be set if the specified current limit is zero (i.e. no current limit). This bit is latched and will remain set until the status byte is read.
  • bit 6: STATUS_M2_FAULT — a fault has occurred with motor 2. This bit is latched and will remain set until the status byte is read.
  • bit 7: STATUS_M2_CURRENT_HIGH — the average motor 2 current has met or exceeded the specified current limit. This bit will never be set if the specified current limit is zero (i.e. no current limit). This bit is latched and will remain set until the status byte is read.

Values sent: none

command byte = 218