Arduino VT100
- VT100 Library Arduino version 1.01 Download library, zip file.
The VT100 devices are the most simple to use. Any serial library will do but there is a buffered library that is also used for other BV devices and so for this section that will be used. The most important part to get right is to send byte value 13 to establish the baud rate before sending anything else. This can be done with putch(13). For a practical example of using a VT100 device and this Library see BV4308.
This library has a couple of input functions that simply getting bytes out of a VT100 device when using ACK.
This is the same program that will display the firmware version to the display but uses a built in library function. The initialisation is slightly different in that the ACK charater is specified along with the Baud rate, the constructor functions has the following options:
xyz.begin(<Baud rate>,<delay>,<ack byte value>)
In this sketch the delay has been set to 0. If ACK was not available then a larger delay could be used and the alternative constructor could be used:
xyz.begin(<Baud rate>,<delay>)
This display has the ACK switched on by default but some devices are off by default. If this is the case and ACK s used then remember to issue the command that turns on ACK before receiving any bytes. Now instead of the while delay loop as above the xyz.cmds() class is used. The description for this is as follows:
xyz.cmds(<command>,<buffer>,<max>)
This class will send the specified command to the display in the above example that is "e[9c". It will then wait and fill the buffer 'b' with the text that is returned from the device. Max is used to protect the supplied buffer should more characters be received than expected. It should be set to 1 less then the buffer size that is supplied.
There is also a cmd() class:
cmd(<command>)
This class will return an integer and is intended for results that are numerical. It could not be used in the above because the firmware version is not a number but a string.