SERIAL INPUT$
function: get a string from the Serial Port
string=Serial Input$(Channel number)
This function is used to read an entire string of characters from the Serial Port. If no data is available an empty string will be returned, otherwise the string will contain all the bytes that have been transmitted via the serial line up to the present moment.
Care should be taken when using this function with high speed transfers, such as those from MIDI devices. If the waiting time between each receive is too long, the system may overload and generate errors such as "string too long" or "serial device buffer overrun".
Transmitting a very large string can take a long time, especially at low Baud rates. With AMOS Professional multi-tasking, a program will only continue after a SERIAL SEND instruction. To avoid corrupting data, the following system should be employed:
Other Serial commands
SERIAL BUF
instruction: set the size of the serial buffer
Serial Buffer Channel number,length
This allocates the length of the buffer space for the required channel, specified in the number of bytes to be allocated. The minimum allocation is 64 bytes, and the default setting is 512 bytes. You are recommended to increase the buffersize for high speed transfers of data.
SERIAL FAST
instruction: engage fast mode for data transfer
Serial Fast Channel number
Use this command to set a special "fast" flag in the current serial device, which disables much of the internal checking process that can slow down the communication process. This is recommended for high speed transfers. Please note that when SERIAL FAST is called, the protocol is changed to: even parity, no XON/XOFF and 8 bits.
SERIAL SLOW
instruction: re-set slow mode for data transfer
Serial Slow Channel number
This instruction slows the serial device transmission back to normal speed, and all of the internal error checks are enabled once more.