Setting up the serial port
Before you can send data out of the serial port, you have to initialise it. This is done using hash command to open the serial port with the User protocol. The following code will get the serial port going:
;------ Initialisation code -----------------
# Open_Serial User(38400,8,N,1)
iiPrintText 251,"Hello World",'0D,'0A
...... continue the program
The “Hello World” is a bit of decoration, but also signals that the serial port is initialised. It ends with '0D,'0A (carriage return/ line feed) to force the terminal display to a new line. 251 is the RAM “address” that directs output to the serial port rather than to RAM. Your program would be a bit more readable if you instead used a symbolic name, and somewhere defined the symbol as EQU 251.
Once the Open_Serial hash command has executed, there will be a delay until 10 seconds after startup before the serial port can actually be used. If you attempt to use it before then, your program will block (lock up) until the time expires. You can use the ComTestStartTimer instruction to work around this and do something useful in those 10 seconds, if you feel so inclined. I sometimes use the time to display a splash screen, if I have an LCD, or blink a coded SPLatWare revision number if I have a LED or two available.