beautypg.com

Spi input/output, Hardware considerations, Usage – Echelon I/O Model Reference for Smart Transceivers and Neuron Chips User Manual

Page 117: Serial input example, Serial output example

background image

I/O Model Reference

107

io-object-name

A user-specified name for the I/O object, in the ANSI C format for variable
identifiers.

Usage

unsigned int

count

,

input

-

buffer

[

buffer

-

size

],

output

-

buffer

[

buffer

-

size

];

count

= io_in(

io

-

object

-

name

,

input

-

buffer

,

count

);

io_out(

io

-

object

-

name

,

output

-

buffer

,

count

);

Serial Input Example

IO_8 input serial ioKeyboard;
char buffer[20];
unsigned int chars;

when (...) {
chars = io_in(ioKeyboard, buffer, 20);
}

Serial Output Example

IO_10 output serial ioDisplay;

when (...) {
io_out(ioDisplay, “Hello world.\r\n”, 14);
}

SPI Input/Output

You can use the hardware Synchronous Peripheral Interface (SPI) I/O model in

applications that you develop for Smart Transceivers or Neuron Chips with

integrated SPI hardware such as the PL 3120 Smart Transceiver, PL 3150 Smart
Transceiver, PL 3170 Smart Transceiver, or a Series 5000 device. SPI is a full-

duplex synchronous serial communication interface initially advanced by

Motorola, but now available on a wide variety of devices. The spi I/O model uses
the SPI hardware and the I/O interrupt capability in designated Neuron Chips

and Smart Transceivers. You cannot use both hardware SCI and hardware SPI
I/O in the same application.
The hardware SPI I/O model does not include any form of hardware flow control

such as CTS/RTS or TREQ/R/W flow control. If your application requires flow
control, you must implement some form of handshaking in your application.
This model applies to 3120 Power Line Smart Transceivers, 3150 Power Line

Smart Transceivers, 3170 Power Line Smart Transceivers, Series 5000 Neuron
Processors and Smart Transceivers.

Hardware Considerations

Pins IO8, IO9 and IO10 can be configured as a SPI port. The directions of the

pins vary with the configuration: