Lab 7: USAR - Handyboard Serial Control


On the Handyboard

  1. Load the handyboard serial libraries which can be found here

  2. In your program, call disable_pcode_serial. The handyboard will no longer be listening for Interactive C commands, it will instead listen for a direct serial connection.

  3. Communicate with the host computer via serial_getchar and serial_putchar. Both of these calls are blocking.

  4. Before your program finishes, be sure to call enable_pcode_serial, so that the handyboard will again be listening to IC.

An example program that listens for the keys w,a,s,d and allows moving forward, backward, or turning in place, can be found here. To get the handyboard to listen to IC again after running the program, you must hold down the stop button and at the same time press a key on the connected computer.

On the host computer

  1. After loading your program onto the handyboard, close IC. If IC is open, no other program will be able to communicate with the handyboard

  2. Start up a serial connection program such as hyperterminal. Hyperterminal is on all lab computers and will be available for the final demo.

  3. Open a serial connection on the same com port as IC uses. The connection settings should be 9600 baud, no parity bit, 8 data bits and 1 stop bit (N81) and either hardware or no flow control (you may have to experiment with these settings) . Hyperterminal will prompt for these settings when trying to open a new connection.

  4. Once the connection is open, send/receive commands to the handyboard. In hyperterminal, pressing a key will send that key's value to the handyboard, which can then decide what to do based on which key was pressed.

More complicated control is also possible. There is a more advanced serial library here. You can also use whatever program you want to communicate with your handyboard, or write one yourself.