Serial Wombat 4A and 4B Firmware
ProtocolBinaryCommands

Process the packet in RxBuffer. More...

Process the packet in RxBuffer.


Pin Configuration Commands

Commands from 0xC0 to 0xDF (inclusive) are Pin Configuration commands. The format of a Pin Configuration commands is:

BYTE 0 BYTE 1 BYTE 2 BYTE 3 BYTE 4 BYTE 5 BYTE 6 BYTE 7
0xC0 to 0xDF Pin Number being configured Pin Mode Varies By Configuration number and Mode Varies By Configuration number and Mode Varies By Configuration number and Mode Varies By Configuration number and Mode Varies By Configuration number and Mode

See the init Function documentation for each mode for specifics on how to configure that mode.

Pin Modes Defined for the SerialWombat 4A and 4B (Mode numbers in decimal)

PIN_MODE_DIGITAL_IO = 0 (See ProcessSetPin() )

PIN_MODE_ANALOGINPUT = 2 (See initAnalogInput() )

PIN_MODE_SERVO = 3 (See initServo() )

PIN_MODE_QUADRATURE_ENC = 5 (See initQuadEnc() )

PIN_MODE_WATCHDOG = 7 (See initWatchdog() )

PIN_MODE_PROTECTEDOUTPUT = 8 (See initProtectedOutput() )

PIN_MODE_DEBOUNCE = 10 (See initDebounce() )

PIN_MODE_PWM = 16 (See initPWM() )

PIN_MODE_PULSE_TIMER = 18 (See initPulseTimer() )

Pin Modes Defined for the SerialWombat 4B (Mode numbers in decimal)

PIN_MODE_UART_TXRX = 17 (see initUART() )


Binary Read Pin Public Data Buffer Command

Reads the public data from three consecutive pins starting with a specified pin

BYTE 0 BYTE 1 BYTE 2 BYTE 3 BYTE 4 BYTE 5 BYTE 6 BYTE 7
0x81 Pin Number 0x55* 'U'* 'U'* 'U'* 'U'* 'U'*

0x55 is recommended, but any byte is acceptable

Response:

Reads the public data from three consecutive pins starting with a specified pin

BYTE 0 BYTE 1 BYTE 2 BYTE 3 BYTE 4 BYTE 5 BYTE 6 BYTE 7
0x81 Pin Number requested Specified Pin Public Data low byte Specified Pin Public Data High byte Specified Pin + 1 Public Data low byte Specified Pin + 1 Public Data High byte Specified Pin + 2 Public Data low byte Specified Pin + 2 Public Data High byte

Examples:

0x81 0x01 0x55 0x55 0x55 0x55 0x55 0x55

Will read the 16-bit public data from pins 1, 2 and 3. Assuming pin1's public data was 0x481B, pin 2's was 0x38FC, and pin 3's was 0x0314:

Response:

0x81 0x1 0x1B 0x48 0xFC 0x38 0x14 0x03


Binary Set Pin Public Data Buffer Command

Sets the public data for 2 pins. (Pin number can be set to 255 to not set a pin).

The values returned are the values for the public data before it was changed. This can be useful when reading an input's public data value. For instance, when reading the position of a pin set to Rotary encoder mode, the value before being set could be read, then the value set back to 32768 for center.

BYTE 0 BYTE 1 BYTE 2 BYTE 3 BYTE 4 BYTE 5 BYTE 6 BYTE 7
0x82 Pin Number to set Value Low Byte Value High Byte Second Pin to set Second Value Low Byte Second Value High Byte 'U'*

0x55 is recommended, but any byte is acceptable

Response:

Reads the public data from three consecutive pins starting with a specified pin

BYTE 0 BYTE 1 BYTE 2 BYTE 3 BYTE 4 BYTE 5 BYTE 6 BYTE 7
0x81 Pin Number requested Specified Pin Public Data low byte Specified Pin Public Data High byte 2nd pin number 2nd pin low byte 2nd pin high byte Echo of sent Byte 7

Examples:

0x81 0x01 0x55 0x55 0x55 0x55 0x55 0x55

Will read the 16-bit public data from pins 1, 2 and 3. Assuming pin1's public data was 0x481B, pin 2's was 0x38FC, and pin 3's was 0x0314:

Response:

0x81 0x1 0x1B 0x48 0xFC 0x38 0x14 0x03


Configure Serial Wombat parameter

Set a configurable parameter in the Serial Wombat firmware

BYTE 0 BYTE 1 BYTE 2 BYTE 3 BYTE 4 BYTE 5 BYTE 6 BYTE 7
0x9F Least Significant byte of 16-bit parameter Most Significant byte of 16-bit parameter Parameter value low byte Parameter Value byte or 0x55* Parameter Value byte or 0x55* Parameter Value byte or 0x55* 0x55*

0x55 is recommended, but any byte is acceptable

Response:

Echoed Back

Examples:

Set Parameter 1 (one byte) to 1. (Enables I2C recovery and 30 second watchdog on successful receive packet)

0x9F 0x01 0x00 0x01 0x55 0x55 0x55 0x55


Binary Read RAM, 16 Bit address

Reads a byte from an address in Microcontroller RAM. The SW4A and SW4B use 16 bit addresses.

Note that the PIC16F15214 is a Microchip Enhanced Mid-Range chip with both a banked RAM area and a Linear RAM area at an offset address.
See the datasheet for details.

BYTE 0 BYTE 1 BYTE 2 BYTE 3 BYTE 4 BYTE 5 BYTE 6 BYTE 7
0xA0 Least Significant byte of 16-bit address Most Significant byte of 16-bit address 0x55* 0x55* 0x55* 0x55* 0x55*

0x55 is recommended, but any byte is acceptable

Response:

BYTE 0 BYTE 1 BYTE 2 BYTE 3 BYTE 4 BYTE 5 BYTE 6 BYTE 7
0xA0 Least Significant byte of 16-bit address Most Significant byte of 16-bit address Byte Read From Ram Echoed Echoed Echoed Echoed

Examples:

Read the byte at RAM address 0x0247.

0xA0 0x47 0x02 0x55 0x55 0x55 0x55 0x55

Assuming address 0x0247 held the value 0xAC , Response:

0xA0 0x47 0x02 0xAC 0x55 0x55 0x55 0x55


Binary Read Flash, 16 Bit address, 16 Bit result

Reads two bytes from an address in Microcontroller Flash. The SW4A and SW4B use 16 bit addresses.

See the Datasheet for the microchip PIC16F15214 for information on organization

BYTE 0 BYTE 1 BYTE 2 BYTE 3 BYTE 4 BYTE 5 BYTE 6 BYTE 7
0xA1 Least Significant byte of 16-bit address Most Significant byte of 16-bit address 0x00 0x00 0x55* 0x55* 0x55*

0x55 is recommended, but any byte is acceptable

Response:

BYTE 0 BYTE 1 BYTE 2 BYTE 3 BYTE 4 BYTE 5 BYTE 6 BYTE 7
0xA1 Least Significant byte of 16-bit address Most Significant byte of 16-bit address Echoed Echoed Low Byte Read From Flash High Byte Read From Flash Echoed

Examples:

Read the word at FLASH address 0x0846.

0xA1 0x46 0x08 0x55 0x55 0x55 0x55 0x55

Assuming address 0x0846 held the value 0x07EF , Response:

0xA1 0x46 0x08 0xEF 0x07 0x55 0x55 0x55


Binary Write RAM, 16 Bit address (

Reads a byte from an address in Microcontroller RAM. The SW4A and SW4B use 16 bit addresses.

Note that the PIC16F15214 is a Microchip Enhanced Mid-Range chip with both a banked RAM area and a Linear RAM area at an offset address.
See the datasheet for details.

BYTE 0 BYTE 1 BYTE 2 BYTE 3 BYTE 4 BYTE 5 BYTE 6 BYTE 7
0xA3 Least Significant byte of 16-bit address Most Significant byte of 16-bit address 0 (for 32-bit compatability) 0 (for 32-bit compatability) Byte To write 0x55* 0x55*

0x55 is recommended, but any byte is acceptable

Response:

Echoed Back.

Examples:

Write 0x32 the byte at RAM address 0x0247.

0xA3 0x47 0x02 0x00 0x00 0x32 0x55 0x55


Binary Send 7 bytes out first UART

Queues 7 bytes to be sent out of the first avaialble Hardware UART. Assumes a UART pin mode has already been set up. The host should query avaialble space before using this command.

BYTE 0 BYTE 1 BYTE 2 BYTE 3 BYTE 4 BYTE 5 BYTE 6 BYTE 7
0xB0 1st Byte to Send 2nd Byte To send 3rd Byte To send 4th Byte To send 5th Byte To send 6th Byte To send 7th Byte To send

Response:

Packet is echoed back to the host.

Examples:

Send WOMBAT! out of the UART

0xB0 0x57 0x4F 0x4D 0x42 0x41 0x54 0x21


Binary Read 7 bytes from first UART

Read 7 bytes from the queue of the first avaialble Hardware UART. Assumes a UART pin mode has already been set up. The host should query avaialble bytes to determine the nubmer of bytes avaiable before using this command. This command should only be called if at least 7 bytes are available.

BYTE 0 BYTE 1 BYTE 2 BYTE 3 BYTE 4 BYTE 5 BYTE 6 BYTE 7
0xB1 0x55* 0x55* 0x55* 0x55* 0x55* 0x55* 0x55*

0x55 is recommended, but any byte is acceptable

Response:

BYTE 0 BYTE 1 BYTE 2 BYTE 3 BYTE 4 BYTE 5 BYTE 6 BYTE 7
0xB1 1st byte read from UART queue 2nd byte read from UART queue 3rd byte read from UART queue 4th byte read from UART queue 5th byte read from UART queue 6th byte read from UART queue 7th byte read from UART queue

Examples:

Assuming GHIJKLM are the first 7 bytes in the UART RX QUEUE:

Sent:

0xB1 0x55 0x55 0x55 0x55 0x55 0x55 0x55

Received:

0xB1 0x47 0x48 0x49 0x4A 0x4B 0x4C 0x4D