Author | Stef Mientki, Copyright (c) 2002..2006, all rights reserved. |
Adapted-by | Sebastien Lelong, Albert Faber, Joep Suijs (on behalf of Tijs van Roon) |
Compiler | >=2.4l |
software RS232 library Library supports software RS232 send and receive procedure on any IO-pin. Both the inverted and non-inverted routines are available, so it should fit any hardware. Baudrate can be set between 110 and 230_400 (for 20 Mhz Xtal), for lower Xtal frequencies the maximum baudrate will be equally lower. Baudrates are optimized, so even the high baudrates shouldn't be a problem (my [Stef] standard = 115_200 Baud, which has never given me any problems). Interrupts are disabled during transmissions. Transmission parameters are 8 databits, 2 stopbits, no parity, no handshake. const serial_sw_stopbits = 1 ; setup for one stopbit.
No dependency found
const serial_sw_bit_time = (1_000_000/serial_sw_baudrate) - ((13 * serial_sw_instruction_time) / 100)
const serial_sw_instruction_time = 400_000_000 / target_clock
serial_sw_data'put(byte in data)
serial_sw_write(byte in data)
serial_sw_init()
serial_sw_read_wait(byte out data)
const serial_sw_bit_time = (1_000_000/serial_sw_baudrate) - ((13 * serial_sw_instruction_time) / 100)
No documentation found
const serial_sw_instruction_time = 400_000_000 / target_clock
calculate instruction execution time in 10ns units
serial_sw_data'put(byte in data)
Here the serial_sw_write procedure is declared as a pseudo variable so you can use it in the following way: {{{ serial_sw_write = 0x33 }}}
serial_sw_write(byte in data)
Waits untill a character is received. Interrupts will be disabled during this routine, but restored afterwards. Also here the code is doubled (inverting and non-inverting) and selection is done by a compiler-directive.
serial_sw_init()
No documentation found
serial_sw_read_wait(byte out data)
Waits untill a character is received. Interrupts will be disabled during this routine, but restored afterwards. Also here the code is doubled (inverting and non-inverting) and selection is done by a compiler-directive.
serial_sw_data'get() return byte
Here the serial_sw_read_wait procedure is declared as a pseudo variable so you can use it in the following way {{{ Data = serial_sw_write }}}
serial_sw_read(byte out data) return bit
Waits untill a character is received or time out is reached. Interrupts will be disabled during this routine, but restored afterwards. Also here the code is doubled (inverting and non-inverting) and selection is done by a compiler-directive.
16f88 | 16f88_serial_sw_echo.jal |