beautypg.com

Programming considerations, Syntax – Echelon I/O Model Reference for Smart Transceivers and Neuron Chips User Manual

Page 89

background image

I/O Model Reference

79

Programming Considerations

For bitshift input/output, the data type of the return value for io_in( ), and the

data type of the output value for io_out( ), is an unsigned long.

When using multiple serial I/O devices that have differing bit rates, you must use

the following compiler directive: #pragma enable_multiple_baud. This pragma

must appear prior to the use of any I/O function (such as

io_in( ) or io_out( )).

Figure 28. Bitshift Output

Syntax

pin

input bitshift [numbits (

const-expr

)] [clockedge (+|-)]

[kbaud (

const-expr

)]

io-object-name

;

pin

output bitshift [numbits (

const-expr

)] [clockedge (+|-)]

[kbaud (

const-expr

)]

io-object-name

[=

initial-output-level

];

pin

An I/O pin. Bitshift input/output requires adjacent pins. The Clock pin is the

pin specified, and the Data pin is the adjacent pin. The pin specification
denotes the lower-numbered pin of the pair and can be IO_0 through IO_6,

IO_8, or IO_9.

numbits (

const-expr

)

Specifies the number of bits to be shifted in or out. The

const-expr

expression

can evaluate to any number from 1 to 31. The default is 16.
Data is shifted in and out with the most significant bit of data first. For the
io_in( ) function, only the last 16 bits shifted in are returned. For the io_out(

) function, after 16 bits, zeros are shifted out.
You can also specify the number of bits to be shifted in the io_in( ) or io_out( )
call. This number temporarily overrides the number specified in the device

declaration, for that one call only.

clockedge (+|-)

For inputs, this option specifies whether the data is read on the positive-

going or negative-going edge of the clock. For outputs, it specifies whether
the data is stable on the positive-going or negative-going edge of the clock.

The default value is [+].