Mapping UARTs to Pins (Scamp1 and Scamp2)
On a Scamp1 or Scamp2 (only) the UARTs must be mapped to a pin on the connector. This can be any pin, with the exception of pins 7 and 8 for Rx and 4, 7, and 8 for Tx. For example to map UART1's Rx to pin 4, place 4 on the stack and then call the word rx1pin:
Unfortunately there is a bug in the word to allocate Tx to a pin, so this has to be done manually. This is done by writing a function code to the appropriate register for a given pin (known as a RP pin). Tx1 has the function code 3 andTx2 has the function code 5. Use the following table for Forth commands to allocate Tx pins.
So for example, to allocate Tx1 to Scamp pin 5:
#3 $03db c!
Note that there is no requirement for both a receiver and transmitter to be allocated to pins. If you only need to receive data, you only need to allocate a receiver. Similarly, if you only need to transmit data, only a transmitter need be allocated.
On a Scamp3, the UARTs are already mapped to dedicated pins, so pin allocation is unnecessary.