psion_software/rs232/README.md

3.5 KiB

Overview RS232 allows data to be transferred between two linked computers, this can be either in the form of a file or data in a string. Usage add the line : Include "RS232.oph" before the first PROC in your application. Load the opm using the opm loader code (available from the web site)

RS232_Version: Returns the version number of the opm.

Using RS232 is simple, there are 2 techniques: Sending data.

  1. open the connection. RS232_Connect%:(Direction%) Direction% determines which machine will act as the host. After connecting to another EPOC32 device you can both send and receive information. There is no need to close the link (Ctrl+L) from the system screen, RS232 does this automatically. Values KSend% KReceive%

Returned values KTrue% if the serial port could be opened. KFalse if the serial port is in use.

  1. set up the communication parameters

  2. send the required data. RS232_send:(data$) Waits to send the data to the recepient EPOC32 device.

  3. receive the required data text$=RS232_Receive$: Receives data sent from the other EPOC32 device.

  4. disconnect from the other EPOC32 device RS232_Disconnect%:(Direction%) Direction% should be the same as used for connection. Values KSend% KReceive% Sending files. To send a file simply follow these instructions. Sending a file. RS232_sendfile:(file$,baud%,parity%,data%,stop%,hand%,cache&)

Sends the file file$, automatically connecting and setting up the communication parameters. You must also specify a transfer cache which RS232 uses to speed up transfer of files. This is in bytes up to a maximum of 16386 (16K). Obviously the larger the cache the more memory will be used. See the constants listing for available communications settings.

Receiving a file. RS232_receivefile:(file$,baud%,parity%,data%,stop%,hand%)

Receives the offered file, automatically connecting and setting up the communication parameters. If file$ is left blank, RS232 will use the file name of the sent file. Specifying a different file name will save the received file as this name. See the constants listing for available communications settings.

Unload the opm using the opm loader code (available from the web site)

listing of RS232.oph rem baud rate constants CONST KBaud50%=1 CONST KBaud75%=2 CONST KBaud110%=3 CONST KBaud134%=4 CONST KBaud150%=5 CONST KBaud300%=6 CONST KBaud600%=7 CONST KBaud1200%=8 CONST KBaud1800%=9 CONST KBaud2000%=10 CONST KBaud2400%=11 CONST KBaud3600%=12 CONST KBaud4800%=13 CONST KBaud7200%=14 CONST KBaud9600%=15 CONST KBaud19200%=16

rem Data Bits CONST KData5%=5 CONST KData6%=6 CONST KData7%=7 CONST KData8%=8

rem Stop Bits CONST KStop1%=1 CONST KStop2%=2

rem Handshaking CONST KHandAll%=11 CONST KHandNone%=4 CONST KHandXON%=7 CONST KHandRTS%=0 CONST KHandXONRTS%=3 CONST KHandDSR%=12 CONST KHandXONDSR%=15 CONST KHandRTSDSR%=18 Distribution You may distribute this opm as part of your installation package as long as it is in the original .sis file. This is to prevent older versions from corrupting newer versions. The UID of this opm is 0x101F50CE This opm is freeware, no payment is required under any circumstances, we will not therefore be held responsible for its suitability or usage. This opm is not revtran protected, if you wish to reverse translate it, either to rectify problems or just to see how it works, feel free. We would request that if you improve it, that you email us a copy so as to pass on the benefits to any other users. We are always happy to reply to any queries or problems you enounter whilst using this opm in your code, please email support@epotech.co.uk for assistance.