- Name:
-
serrxd
- Syntax:
-
SERRXD (qualifier,qualifier...)
SERRXD (qualifier,qualifier...),{#}variable,{#}variable...
SERRXD {#}variable,{#}variable...
Additional optional timeout syntax options for M2, X1 and X2 parts
SERRXD [timeout], (qualifier...)
SERRXD [timeout], (qualifier...),{#}variable,{#}variable
SERRXD [timeout], {#}variable,{#}variable
SERRXD [timeout,address], (qualifier...)
SERRXD [timeout,address], (qualifier...),{#}variable,{#}variable
SERRXD [timeout,address], {#}variable,{#}variable
Qualifiers - are optional variables/constants (0-255) which must be received in exact order before subsequent bytes can be received and stored in variables.
Variable(s) - receive the result(s) (0-255). Optional #'s are for inputting ASCII decimal numbers into variables, rather than raw characters.
Timeout - is an optional variables/constants which sets the timeout period in milliseconds (not available on M parts).
Address - is a label which specifies where to go if a timeout occurs.
- Description:
-
Serial input via the serial input programming pin (at fixed baud rate 4800 (9600 on X2 parts), 8 data, no parity, 1 stop).
The serrxd command is similar to the serin command, but acts via the serial input pin rather than a general input pin. This allows data to be received from the computer via the programming cable. The PICAXE chip normally constantly scans the serial download pin to see if a computer is trying to initialise a new program download. However when it is desired to use serrxd it is necessary to disable this scanning. This is automatic, and is effectively the same as issuing a disconnect command.
After disconnect is used it will not be possible to download a new program until:
1) the reconnect command is issued
2) a reset command is issued
3) a hardware reset is carried out.
Remember that is always possible to carry out a new download by carrying out the hard-reset procedure.
Reading number values
When the #variable format is used received data will be taken and converted to a number.
All characters received are ignored until the first ASCII digit character is received. A number is then determined until a non-digit character is received. The value stored in the variable will be number represented by the digit characters received. Note that the #variable will not complete until the number has been terminated by a non-digit character being received.
Effect of Increased Clock Speed
Increasing the clock speed increases the serial baud rate as shown below (non X2 parts).
| 4MHz |
4800 |
| 8MHz |
9600 |
| 16MHz |
19200 |
| 32MHz |
38400 |
| 64MHz |
76800 |