Author | Stef Mientki, Copyright © 2002..2020, all rights reserved. |
Adapted-by | Sebastien Lelong, Rob Hamerling, Rob Jansen |
Compiler | 2.5r4 |
USART hardware control. Routines for sending and receiving through the PIC-usart, both asynchronous and synchronous are supported. Baudrate can simply be set through a human constant, because the baudrate depending registers are calculated by this unit. Baudrate is calculated, starting at the high baudrate flag, which will ensure the highest possible accuracy. This library supports old and new USART types.
- Pin selection is automatic: pin_TX and pin_RX. - For PICs using the newer USART types, make sure to remap the USART pins to their default in the main program to enable the USART pins. - Pin direction setting is taken care of by this library. - When the physical locations of pin_TX and pin_RX are configurable for a specific PIC, the device file will probably contain names like pin_TX_RB2 and pin_RX_RB1 and another pair with other pin suffixes. Depending for which pair of pins the USART is configured aliases without suffixes have to be specified, like: alias pin_TX is pin_TX_RB2 alias pin_RX is pin_RX_RB1 alias pin_TX_direction is pin_TX_RB2_direction alias pin_RX_direction is pin_RX_RB1_direction
serial_hw_data'put(byte in data)
serial_hw_init()
serial_hw_write_word(word in data)
serial_hw_write(byte in data)
serial_hw_data_raw'put(byte in data)
serial_hw_enable()
serial_hw_disable()
serial_hw_data_ready() return bit
serial_hw_read(byte out data) return bit
serial_hw_data_available() return bit
serial_hw_data'get() return byte
serial_hw_data_raw'get() return byte
serial_hw_data'put(byte in data)
Title: Transmit byte Arguments: Data (byte) to be transmitted Returns: (nothing) Notes: This pseudo variable allows a language construct like serial_hw_data =to transmit a byte to the seial port
serial_hw_init()
Title: Initialize the (first or only) serial port Arguments: (none) Returns: (nothing)
serial_hw_write_word(word in data)
Title: Transmit word Arguments: Data (word) to transmit Returns: (nothing) Notes: Send word as 2 bytes, Most Significant Byte first. See also serial_hw_write()
serial_hw_write(byte in data)
Title: Transmit byte Arguments: Data (byte) to transmit Returns: (nothing) Notes: Hardware transmit buffer must be empty, wait if not
serial_hw_data_raw'put(byte in data)
These are real raw procedures, declared as pseudo variables the user is totally responsible for testing the transmit/receive flag before using these functions
serial_hw_enable()
Title: Enable USART Arguments: (none) Returns: (nothing) Notes: Re-enable USART after use of serial_hw_disable()
serial_hw_disable()
Title: Disable USART Arguments: (none) Returns: (nothing) Notes: Allows pins to be used (temporary) for other purposes. USART can be enabled again by calling serial_hw_enable()
serial_hw_data_ready() return bit
generic (pic-independent) variable to check if transmit buffer is empty
serial_hw_read(byte out data) return bit
Title: Receive byte Arguments: (none) Returns: bit: TRUE data available FALSE no data available
serial_hw_data_available() return bit
generic (pic-independent) variable to check if a byte is received
serial_hw_data'get() return byte
Title: Receive byte Arguments: (none) Returns: Data (byte) received Notes: This pseudo variable allows a language construct like databyte = serial_hw_data to receive a byte from the serial port into variable 'databyte'
serial_hw_data_raw'get() return byte
No documentation found
_serial_hw_read(byte out data) return bit
Title: Receive byte Arguments: (none) Returns: bit: TRUE data available FALSE no data available Notes: Using this inline function for serial_hw_data'get saves a stack level With overrun error the USART is reset (error(?)byte is returned!)