Serial communications: Port selection
In dialect 29 we introduced the ability to use more than one serial communications port. Here's how it works:
- Serial ports are addressed in the range 251 to 255. These are addresses in the RAM address space that do not actually have RAM "behind them".
- The "default" port is the controller's programming port. It sits at address 251.
- There is a whole collection of instructions for manipulating the default port at 251. A typical one of these is
ComRx_fGetNum, which retrieves a floating point number from the serial input buffer. Historically these are the original instructions. - There is a second set of instructions for accessing any other serial ports that may exist in a given controller. These all start with an 'a', for example
aComRx_fGetNum. - Most of the
ComRx...andaComRx...instructions are about receiving serial data. The ones for transmitting data are those likeiifPrintWFW.
When using Hash commands
When using hash commands that reference serial ports (including a USB port that is mapped as a serial port, as on the EC1), it becomes much simpler. Select the serial port using the Port hash function.
