Data Sheet

UM7 DATASHEET
Rev. 1.6 Released 1/10/2016
39
tx_data[1] = ‘n’;
tx_data[2] = ‘p’;
tx_data[3] = 0x00; // Packet Type byte
tx_data[4] = 0xAA; // Address of GET_FW_REVISION register
tx_data[5] = 0x01; // Checksum high byte
tx_data[6] = 0xFB; // Checksum low byte
USART_transmit( tx_data, 7 );
The preceding code assumes that a function called USART_transmit( uint8_t* data, uint8_t
length) exists that transmits ‘length’ characters from the provided buffer over the UART.
Once the UM7 receives the above packet, it will respond with a packet containing the firmware
revision. Example code for receiving the firmware revision packet is given below. Note that
this code assumes that the serial data is being received and transferred to a buffer before the
example code is executed.
UM7_packet new_packet;
char FW_revision[5];
// Call the parse_serial_data function to handle the incoming serial data. The serial data should
// be placed in ’rx_data’ and the length in ‘rx_data_length’ before this function is called.
if( !parse_serial_data( rx_data, rx_data_length, &new_packet )
{
// We got a good packet! Check to see if it is the firmware revision
if( packet.Address == 0xAA )
{
// Extract the firmware revision
FW_revision[0] = packet.data[0];
FW_revision[1] = packet.data[1];
FW_revision[2] = packet.data[2];
FW_revision[3] = packet.data[3];
FW_revision[4] = ‘\0’; // Null-terminate the FW revision so we can use it like a string
// Print the firmware revision to the terminal (or do whatever else you want…)
printf(“Got the firmware revision: %s\r\n”, FW_revision);
}
// TODO: Check to see if any of the other packets that we care about have been found.