User manual

TMCM-1180 and PD86-1180 TMCL Firmware V4.42 Manual (Rev. 1.08 / 2012-NOV-20) 57
www.trinamic.com
5.7.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 10 bit result in the range of 0… 1023. In standalone mode the requested value is copied to the
accumulator (accu) for further processing purposes such as conditioned jumps. 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
8
Function
Target-
address
Instruction
Number
Type
Motor/
Bank
Operand
Byte3
Operand
Byte2
Operand
Byte1
Operand
Byte0
Checksum
Value (hex)
$01
$0f
$00
$01
$00
$00
$00
$00
$14
Reply:
Byte Index
0
1
2
3
4
5
6
7
8
Function
Host-
address
Target-
address
Status
Instruction
Operand
Byte3
Operand
Byte2
Operand
Byte1
Operand
Byte0
Checksum
Value (hex)
$02
$01
$64
$0f
$00
$00
$01
$fa
$72
value: 506
5.7.15.1 I/O bank 0 digital inputs:
The ADIN lines can be read as digital or analogue inputs at the same time. The analogue values can be
accessed in bank 1.
Reading all digital inputs with one GIO command:
Set the type parameter to 255 and the bank parameter to 0.
In this case the status of all digital input lines will be read to the lower eight bits of the accumulator.
Use following program to represent the states of the input lines on the output lines:
1
6
Pin
I/O port
Command
Range
1
IN_0
GIO 0, 0
0/1
2
IN_1
GIO 1, 0
0/1