Writing Scripts | www.ti.com |
G.3 Writing Scripts
A script is simply a text file that contains data to send to the serial control buses. The scripting language is simple, as is the parser for the language. Therefore, although the program is not forgiving about mistakes made in the source script file, the formatting of the file is simple. Consequently, mistakes are rare.
Each line in a script file is one command. Lines cannot be extended beyond one line. A line is terminated by a carriage return.
The first character of a line is the command. Commands are:
ISet interface bus to use
rRead from the serial control bus w Write to the serial control bus
# Comment b Break
d Delay
The first command, I, sets the interface to use for the commands to follow. This command must be followed by one of the following parameters:
i2cstd | Standard mode I2C bus | |
i2cfast | Fast mode I2C bus | |
spi8 | SPI bus with | |
spi16 | SPI bus with | |
gpio | Use the |
For example, if a fast mode I2C bus is to be used, the script begins with:
I i2cfast
No data follows the break command. Anything following a comment command is ignored by the parser, provided that it is on the same line. The delay command allows the user to specify a time, in milliseconds, that the script pauses before proceeding.
Note: Unlike all other numbers used in the script commands, the delay time is entered in a decimal format. Also, note that because of latency in the USB bus as well as the time it takes the processor on the
A series of byte values follows either a read or write command. Each byte value is expressed in hexadecimal, and each byte must be separated by a space. Commands are interpreted and sent to the TAS1020 by the program using the protocol described in Section G.1.
The first byte following a read or write command is the I2C slave address of the device (if I2C is used) or the first data byte to write (if SPI is
For example, to write the values 0xAA 0x55 to an I2C device with a slave address of 0x90, starting at a register address of 0x03, one would write:
#example script I i2cfast
w 90 03 AA 55 r 90 03 2
50 |
Submit Documentation Feedback