Here's another pass through the code for the no-flow version 2.1.
-- inverted mode is now handled in the pasm rather than in spin. (faster)
-- open/inverted mode now works correctly and needs a pulldown to Vss, which is the stop bit state. (This rarely used mode was messed up, never noticed before.)
-- correct stop bit state is determined by code patch rather than by run-time mode test.
-- spin methods tx() and packet() now correctly inhibit adding data to a tx buffer that has not been opened. (Otherwise adding data to a closed buffer can lock up a program execution while waiting for space in the tx buffer.)
-- Now allows opening a single port for tx or rx, only one coroutine enabled.
(This is needed due to elimination of unused coroutines. A coroutine cannot jmpret to itself, which amounts to modifying an instruction and executing it immediately without a buffer instruction in-between. Now if only a single port rx or tx is enabled, a bridging jmpret is added in the flow)
-- cleaned up comments.
Also a demo that is set up as a loopback, to send chars from a terminal through all 4 port and back to the terminal. The ports can be set up to use different modes.
Comments
-- inverted mode is now handled in the pasm rather than in spin. (faster)
-- open/inverted mode now works correctly and needs a pulldown to Vss, which is the stop bit state. (This rarely used mode was messed up, never noticed before.)
-- correct stop bit state is determined by code patch rather than by run-time mode test.
-- spin methods tx() and packet() now correctly inhibit adding data to a tx buffer that has not been opened. (Otherwise adding data to a closed buffer can lock up a program execution while waiting for space in the tx buffer.)
-- Now allows opening a single port for tx or rx, only one coroutine enabled.
(This is needed due to elimination of unused coroutines. A coroutine cannot jmpret to itself, which amounts to modifying an instruction and executing it immediately without a buffer instruction in-between. Now if only a single port rx or tx is enabled, a bridging jmpret is added in the flow)
-- cleaned up comments.
Also a demo that is set up as a loopback, to send chars from a terminal through all 4 port and back to the terminal. The ports can be set up to use different modes.