This is part of the HicEst documentation

COM: COM-Port Serial Communication to Receive and Send

Set physical COM-port parameters. Send data + checksum. Input: Receive data + checksum. Controls: screen echo, timeout, different waits, error, etc.

⇒Home ⇒Contents ⇒more Input_Output


  ⇒debug   ⇒initialize   ⇒read   ⇒write

Optional keywords:

(Syntax of optional keywords)
Bauds CheckSum ChecksumBits ChecksumVal Comport DataBits DouBLe ERror Echo ExitOnInput IgnoreInput Lastchar LastcharX OnErroritem Parity Receive Send StopBits Timeout WaitBIts Waitbyte
setup options type mini sample
Comport num c=4 serial port (1-8), default is 1
Bauds num b=9600 baudrate, default is 9600
possible baudrates: 110, 300, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200
Parity txt p="odd" "None", "Odd", "Even", "Mark", "Space", default is 'E'
DataBits num db=8 5-8, default is 8
StopBits num sb=1.5 1, 1.5 or 2. Default is 2
  • COM(Com=Port, B=BAUDS, P=Parity, DB=DataBits, SB=StopBits, Echo=echo)
output options
Send txt s=text send up to LEN(text) bytes
CheckSum --- cs send current 1 byte checksum
ExitOnInput TXT eoi=intrpt stop sending if any byte is received
  • COM(Send=':', ChkBits=8, Send="Alice to Bob "// TRIM(text)//". OK?", ChkSum)
input options
Receive TXT r=text receive up to LEN(text) bytes
IgnoreInput TXT ii=last empty input buffer except last byte
Timeout num t=100 maximum time in msec to wait for next input byte
Waitbyte txt w="x" ignore all input up to "x", an error is generated on Timeout
WaitBIts num wbi=128 ignore input until the specific bit pattern is found, an error is generated on Timeout
CheckSum --- cs compare current checksum (excluding the last byte) with the last byte
  • rc = COM(Timeout=3000, Wait=':', Last='?', ChkBits=8, Receive=txt, R=c1, ChkSum)
control options
ChecksumBits num cb=7
  • start lowbits checksum (in or out), default is 8
  • cb=0: IEOR(sum, ICHAR(byte)) (LRC)
ChecksumVal NUM cv=sum set argument to current checksum
DouBLe txt dbl=DLE doubles DLE for


send or receive
Echo num e=hdle for debugging echo all COM port traffic to
  • WINDOW(WIN=handle, font="terminal") ! the terminal font has equal character spacing and shows (DOS) symbols for nonprintable characters
Lastchar txt l="x" send/receive up to and including the occurence of first "x"
LastcharX txt lx=$CR send/receive up to but excluding the first $CR character
OnErroritem num oei=3 on error continue with item 3. If this item does not exist return with returncode = itemnr (useful to debug)
ERror LBL er=99 on error jump to error label 99

Support HicEst   ⇒ Impressum
©2000-2016 Georg Petrich, HicEst Instant Prototype Computing. All rights reserved.