Navigation bar
  Start Previous page
 76 of 283 
Next page End 71 72 73 74 75 76 77 78 79 80 81  

67
If the “Ignore Parity” flag is asserted, in 7-bit mode the most significant bit of each character received will
be zero and in 8-bit mode only one byte will be stored in the queue for each character received.  If the
“Ignore Parity” bit is not asserted, in 7-bit mode the MSB will contain the received parity bit and in 8-bit
mode a second byte containing the parity bit will be stored in the queue for each character received.  The
ParityCheck() function is useful for checking the parity of a received character.
If the optional stopBits parameter is not specified, one stop bit is transmitted for each character sent. 
Otherwise, the specified number of stop bits is transmitted.  The allowable range for stopBits is 1 to
240.  If a value outside this range is specified, the default of 1 stop bit will be used.  The ability to specify
two or more stop bits is useful for slowing down the transmission of data in cases where the receiver
needs additional time to process received data.
Note that a pullup resistor (Non-inverted mode) or a pulldown resistor (Inverted mode) is recommended
on the transmit line to force the transmit line to the idle state prior to the time your program initializes the
COM port.  If you don’t do this, the receiving device may see false transmissions prior to the first
character actually transmitted.  Depending on what other circuitry is connected to the receive line, you
may need to do the same to prevent the ZX from receiving false transmissions.
This subroutine may be used to specify the data width, parity mode and stop bits for a hardware UART
channel (e.g. Com1) provided that it is called when the channel is closed.  When used this way, the
txPin and rxPin parameters are ignored and values of 2 or more for the stopBits parameter will
select 2 stop bits.  Also, the flag for inverted data mode is likewise ignored.
Example
Call ComChannels(2, 9600)
Call DefineCom(4, 0, 12, &H08)
This call prepares channel 4 for transmit-only using pin 12, eight data bits, no parity and Non-inverted
Logic.
Compatibility
This function is not available in BasicX compatibility mode; you must use DefineCom3().  Additionally,
BasicX does not support 8-bit plus parity modes nor does it support the “Strip Parity” mode.  Furthermore,
in BasicX characters received in 7-bit/no parity mode are aligned toward the MSB while in this
implementation they are properly aligned toward the LSB.  
The ability to define the characteristics of Com1 is not available on mega32-based devices such as the
ZX-24.
See Also
Previous page Top Next page