User Tools

Site Tools


This is an old revision of the document!

Sending a serial break

by Richard Russell, July 2007

Occasionally you may wish to send a break condition on a serial port output line. For example this may be needed to 'wake up' a remote device such as a modem. You can easily do that using the following code:

      SYS "SetCommBreak", @hfile%(com1%)
      WAIT 50
      SYS "ClearCommBreak", @hfile%(com1%)

Here com1% is the value returned from OPENUP when the serial port was opened. In this example the break condition is maintained for about 0.5 seconds (50 centiseconds).

For completeness here is a self-contained program which opens the port, sends the break, and then closes the port:

      com1% = OPENUP("COM1:9600,n,8,1")
      IF com1% = 0 ERROR 100, "Couldn't open serial port COM1"
      SYS "SetCommBreak", @hfile%(com1%)
      WAIT 50
      SYS "ClearCommBreak", @hfile%(com1%)
      CLOSE #com1%
This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information
sending_20a_20serial_20break.1522502380.txt.gz · Last modified: 2018/03/31 13:19 by