My Documents/icctest/ASIO_BETA/asio.h File Reference


Defines

#define ASIO_TX_PIN_MAP   (1 << 30)
#define ASIO_RX_PIN_MAP   (1 << 31)
#define ASIO_STOP_BITS   8
#define ASIO_BAUDX_RX_9600   56
#define ASIO_BAUDX_RX_19200   23
#define ASIO_BAUDX_RX_38400   6
#define ASIO_BAUDX_RX_57600   1
#define ASIO_BAUDX_TX_9600   60
#define ASIO_BAUDX_TX_19200   28
#define ASIO_BAUDX_TX_38400   11
#define ASIO_BAUDX_TX_57600   5
#define ASIO_BAUDX_RX   ASIO_BAUDX_RX_57600
#define ASIO_BASE_PERIOD   120
#define ASIO_RT_INVERTED   0
#define ASIO_TX_INVERTED   ASIO_RT_INVERTED
#define ASIO_RX_INVERTED   ASIO_RT_INVERTED

Functions

int show_val (int val, int mask, int pinmap, int syncmap)
void asio_init (void)
void asio_tx (char c)
void asio_txString (char *str)
int asio_rx (void)
int asio_rxString (char *str, int len)

Detailed Description


Define Documentation

#define ASIO_BASE_PERIOD   120

Base period is used with ASIO_BAUDX_dX for bit period calculations.

#define ASIO_BAUDX_RX   ASIO_BAUDX_RX_57600

Use these defines for software + waitcount RX/TX delays. The use of waitcnt instruction asm("waitcnt %time, %period") dominates timing at lower baudrates; software delays are a factor in higher baudrates, but are mostly mitigated.

#define ASIO_BAUDX_RX_19200   23

Define for RX baud rate using software + waitcount delays.

#define ASIO_BAUDX_RX_38400   6

Define for RX baud rate using software + waitcount delays.

#define ASIO_BAUDX_RX_57600   1

Define for RX baud rate using software + waitcount delays.

#define ASIO_BAUDX_RX_9600   56

Define for RX baud rate using software + waitcount delays.

#define ASIO_BAUDX_TX_19200   28

Define for TX baud rate using software + waitcount delays.

#define ASIO_BAUDX_TX_38400   11

Define for TX baud rate using software + waitcount delays.

#define ASIO_BAUDX_TX_57600   5

Define for TX baud rate using software + waitcount delays.

#define ASIO_BAUDX_TX_9600   60

Define for TX baud rate using software + waitcount delays.

#define ASIO_RT_INVERTED   0

Use this define to invert the interface sense (or not)

#define ASIO_RX_INVERTED   ASIO_RT_INVERTED

Use this define to invert the RX interface sense (or not)

#define ASIO_RX_PIN_MAP   (1 << 31)

Define RX pin map. Using bit 31 for rx works fine.

#define ASIO_STOP_BITS   8

Use large number (100+) of TX stop bits for slow interfaces adjust at your liesure Flow control not implemented - use 3 wire interface (rx,tx,gnd).

#define ASIO_TX_INVERTED   ASIO_RT_INVERTED

Use this define to invert the TX interface sense (or not)

#define ASIO_TX_PIN_MAP   (1 << 30)

Define TX pin map. This code works with ICC April Alpha update. Early ICC March 29 Alpha release has issues with asm(...) parameters. Hard-coding the setbit asm call will make this work. i.e. asm("or OUTA, $40000000");


Function Documentation

void asio_init ( void   ) 

Init direction bits. Would init baud here, but using const vs var has different timing.

int asio_rx ( void   ) 

Get a byte from the serial interface. param are set by # define constants in asio.h

Returns:
int representing byte received.

int asio_rxString ( char *  str,
int  len 
)

Prefer using a buffer head/tail strategy provided by starting a COG. For now use asio_rx byte by byte blocking calls. Use calls to asio_rx until a terminator like "\r" is found. All strings returned are null terminated.

Parameters:
str is a predefined input buffer of len.
len is maximum number of chars to receive in buffer.
Returns:
number of bytes received.

void asio_tx ( char  val  ) 

Transmit a char on interface.

Parameters:
val is byte to send

void asio_txString ( char *  str  ) 

Transmit a string on interface.

Parameters:
str is string to send.

int show_val ( int  val,
int  mask,
int  pinmap,
int  syncmap 
)

Show bits on oscilloscope. This is for debug only ... bits come out LSB first

Parameters:
val is value to show
mask is the byte/word/long mask
pinmap is the pin bit map for bit stream output
syncmap is the bit map for bit stream oscope sync
Returns:
non-zero for looping;


Generated on Mon Apr 14 14:31:18 2008 for ASIO by  doxygen 1.5.4