User manual

TMCM-1141 TMCL Firmware V1.19 Manual (Rev. 1.01 / 2012-JUL-27) 38
www.trinamic.com
3.6.15 GIO (get input /output)
With this command the status of the two available general purpose inputs of the module can be read out.
The function reads a digital or analogue input port. Digital lines will read 0 and 1, while the ADC channels
deliver their 12 bit result in the range of 0… 4095.
GIO IN STANDALONE MODE
In standalone mode the requested value is copied to the accumulator (accu) for further processing
purposes such as conditioned jumps.
GIO IN DIRECT MODE
In direct mode the value is only output in the value field of the reply, without affecting the accumulator.
The actual status of a digital output line can also be read.
Internal function: the specified line is read.
Related commands: SIO, WAIT
Mnemonic: GIO <port number>, <bank number>
Binary representation:
INSTRUCTION NO.
TYPE
MOT/BANK
VALUE
15
<port number>
<bank number>
don’t care
Reply in direct mode:
STATUS
VALUE
100 OK
<status of the port>
Example:
Get the analogue value of ADC channel 0
Mnemonic: GIO 0, 1
Binary:
Byte Index
0
1
2
3
4
5
6
7
Function
Target-
address
Instruction
Number
Type
Motor/
Bank
Operand
Byte3
Operand
Byte2
Operand
Byte1
Operand
Byte0
Value (hex)
$01
$0f
$00
$01
$00
$00
$00
$00
Reply:
Byte Index
0
1
2
3
4
5
6
7
Function
Host-
address
Target-
address
Status
Instructio
n
Operand
Byte3
Operand
Byte2
Operand
Byte1
Operand
Byte0
Value (hex)
$02
$01
$64
$0f
$00
$00
$01
$2e
Status = no error, value = 46