
RPBASIC-52 PROGRAMMING GUIDE
A-1
APPENDIX A - Network example program
File: NET3XX.BAS
rem RPC-3xx networking
rem Uses COM1 as network port
rem To use com port 0 and get going faster, REM out the following lines:
rem 130, 150, 1510, 1530
rem Line 1510 must still exist, so rem AFTER the line number
rem Change the following lines
rem 160 for COM 0 instead of 1
rem 1000 change COM$(1) to COM$(0)
rem If your card does not have analog output, comment out line 2560
rem command D assumes a display. Adjust the CONFIG DISPLAY command
rem at line 140
rem Demo program is limited to 5 commands. If adding more, change
rem limit check in line 1210
rem Data packet to the card is:
rem <CR>>ncd...ds
rem Where
rem <CR> = carriage return character 0DH
rem > = command signature
rem n = card number. May be number 0-9 or letter
rem c = command. May be number, letter, or combination
rem d...d = data as required for command
rem s = optional checksum of string
rem a ?? means ignore checksum
rem Command types for this demo are:
rem A = set line 8. Data following A is 0 or 1
rem Example: >00A0??
rem B = set analog output channel, data
rem Example: >00B043??
rem ||- 1 to 4 digits of data
rem | - channel no 0 or 1
rem Shows how to convert a string number into one usable by
rem BASIC
rem C = return position from counter 0 or 1
rem Example: >00C0??
rem ||-counter #
rem | - command
rem Shows how to take a "real" number and convert it to a
rem string.
rem D = Send message to display port
rem Example: >00DCheck station 5??
rem E = Power up acknowledge. Used to inform host of reset condition
rem Example: >00E??
rem F = Is everything OK or is there a problem
rem Example: >00F??
rem Command F returns an An. If n = 0, everything OK
rem Error codes in STATUS are set somewhere else
rem Routine clears STATUS when polled
100 STRING 2000,40 :REM allocate memory
120 $(0) = ">00" :REM assign card ID. It is modified at line 150
125 $(3) = ">99" :REM All units go into safety mode
REM set up RS485 port on board for 19200
rem NOTE: this is board dependent. Check your cards manual to make sure
Komentáře k této Příručce