JAL manual - libraries - serial

previous up next

This library does not yet support the Scenix SX18 and SX28 targets.

This library provides busy-waiting serial asynchronous send and receive routines.

The library first includes serialp which contains the IO pin assignment, baudrate setting and polarity. A local copy of this file can be adapted to accomodate a different IO pin assignment and communication settings.

The provided routines are:

   asynch_send( byte in x )
   var byte volatile asynch
   asynch_receive( byte out x )
   asynch_poll( byte out x ) return bit

A call to asynch_send sends the byte x on the serial line.

Assigning to asynch has the same effect as an asynch_send call.

A call to asynch_receive returns with a received byte in x. The call waits untill a byte is received.

A call to asynch_poll returns with a received byte in x. The call returns quickly when no byte can be received. The function result indicates whether a byte was received.

example:
   include 16f84_10
   include jlib
   include serial

   asynch = "H"
   asynch = "e"
   asynch = "l"
   asynch = "l"
   asynch = "o"
   asynch = " "
   asynch = "W"
   asynch = "o"
   asynch = "r"
   asynch = "l"
   asynch = "d"
   asynch = ASCII_CR
   asynch = ASCII_LF
previous up next