[Home]Simplex, Duplex, And Serial

HomePage | RecentChanges | Preferences

Showing revision 11

Simplex Duplex Serial and a backward bit

I had an flawed idea. If RS-232 serial had an extra bit, it could be used to handshake. - This still needs A.TX and another input A.input.

The PIC microcontrollers have a UART with a TX and RX.

You can connect TX on one chip to RX on another chip.

I was reading about SIMPLEX and DUPLEX.

https://www.geeksforgeeks.org/computer-networks/difference-between-simplex-half-duplex-and-full-duplex-transmission-modes/

You can connect TX on one chip to RX on another chip.

This is SIMPLEX.

The TX transmits and RX receives.

If you had Chip A and Chip B you could wire:-

 A.TX to B.RX 
 B.TX to A.RX

This is DUPLEX

The simple microcontrollers have a UART with a TX and RX. They support 5,7,8 and sometimes 9 bits.

 5 bits for BAUDOT
 7 bits + Parity
 8 bits
 9 bits , where the 9 bit indicates ADDRESS

If you are sending 8 bit characters with the UART set to 8 bits, there is no spare bit for a second channel.

The UART from 40 years ago did not support the 9 bit. They did support Parity Error, Frame Error, Break interrupts, which could be used.

 Parity Error - unexpected value of the parity bit
 Frame  Error - unexpected value of the stop bit. 
 Break        - input held in START for more bits than expected , more than n bits plus stop bit.

 Over run Error - the RX has failed to read the received data in time and it has been lost. 

See: http://archive.pcjs.org/pubs/pc/datasheets/8250A-UART.pdf

I had an idea. If RS-232 serial had an extra bit it could be used to handshake. - This still needs A.TX and another input A.input.

You need at least a 2 layer protocol, with the lower layer managing the layer above.

HDLC used in ITU MTP Level 2 has the FIB and BIB bits.

 FLAG - 01111110 - escaped, if seen in the data. At each the end of the packet.

 FIB - Forward Indicator Bit
 BIB - Backward  Indicator Bit

 FSN - forward sequence number
 BSN - backward sequence number

 CRC - sent just before FLAG - used to error check packet.

The FIB is toggled and the BIB is toggled to respond. This allows a ACK or NACK.

The toggle protocol is important. If you have a SET / RESET protocol then A needs to let B write access. B needs to assert a reset. If you toggle, the other end can delay responding

RS-232 has the extra wires

  DSR and  DTR to act as signals to say powered up   
  RTS, and CTS to say Request to Send and Clear to Send.

ASCII has control characters and XON and XOFF

Unfortunately UARTS do not have spare bits to carry a backward bit.

It would be possible to add extra bits to the Serial frame to carry the RTS and CTS signals.

The SL-I telephone exchange had a protocol where the Peripheral Interface card polled the cards, and the cards responded with a short reply if they had nothing to report.

ITU Q.703 MTP Level 2 HDLC has the FIB and BIB bits

I suppose you could use an escape

I suppose you could use 7 bits and re-purpose the Parity Bit

You could use 6 bits.

Using the Frame error and BREAK could be used.

When I was exprimenting with PIC16F628 I used a HALF-DUPLEX circuit.

I could detect if the Serial lead was plugged in.

I could test if PA0 was pulled to the STOP level.

This PIC code uses HALF DUPLEX

http://www.dougrice.plus.com/hp/freq/freq.htm

 ; SERIAL PORT CONTROL:
 ;
 ;	PORT A0 is Serial input
 ;	PORT A0 is serial output
 ;
 ;	usb gmus-03 USB Serial Adapter
 ;
 ;	TX  D9 Pin 3 -[4k7]-+-PA0
 ;	RX  D9 Pin 2 - - - -/ 
 ;	GND D9 Pin 5 - - - -  0V

Resetting the protocol

A SIMPLEX protocol that can be used is the timed reset protocol where inactivity on the TX signifies a reset.

Another example SIMPLEX protocol is the BREAK that forces a Over run error, as the expected stop bit is not seen.

Another SIMPLEX protocol that can reset is the one used on LCD displays where the interface is four bits but the commands are 8 bit. However the interface has an additional wire to signal data or command.

If the microcontroller has been reset, and the LCD display has not, the microcontroller has to flush out half sent commands.

Hitachi HD44780:-

 ;     wlcdCmd($33);     { force to 8 bit mode }
 ;     wlcdCmd($32);     { force to 4 bit mode }
 ;     wlcdCmd($28);	 { 4 bit, 2 line, 5x7 display }
 ;     wlcdCmd($01);     { Clear Display }
 ;     wlcdCmd($0F);     { $0F - Display On,CursorOn,Blink }
 ;     wlcdCmd($C9);     { set dd address }

ASCII Control dates back to 1963

https://www.ascii-code.com/characters/control-characters

Here is a page with more detail and usage.

https://www.jkorpela.fi/chars/c0.html

https://theasciicode.com.ar/ascii-printable-characters/question-mark-ascii-code-63.html

ASCII control characters

 00 NULL(Null character)

 01 SOH(Start of Header)

 02 STX(Start of Text)
 03 ETX(End of Text)

 04 EOT(End of Trans.) 
 05 ENQ(Enquiry)
 06 ACK(Acknowledgement)
 07 BEL(Bell)08BS(Backspace)

 09 HT(Horizontal Tab)
 10 LF(Line feed)
 11 VT(Vertical Tab)
 12 FF(Form feed)
 13 CR(Carriage return)

 14 SO(Shift Out)
 15 SI(Shift In)

 16 DLE(Data link escape)

 17 DC1(Device control 1)
 18 DC2(Device control 2)
 19 DC3(Device control 3)
 20 DC4(Device control 4)

 21 NAK(Negative acknowl.)
 22 SYN(Synchronous idle)
 23 ETB(End of trans. block)
 24 CAN(Cancel)
 25 EM(End of medium)
 26 SUB(Substitute)
 27 ESC(Escape)

 28 FS(File separator)
 29 GS(Group separator)
 30 RS(Record separator)
 31 US(Unit separator)

 127DEL(Delete)


HomePage | RecentChanges | Preferences
This page is read-only | View other revisions | View current revision
Edited July 27, 2025 7:40 am by dougrice.plus.com
Search:
home page