RPBASIC-52 PROGRAMMING GUIDE COPYRIGHT PRODUCT SUPPORT Cop yright 1 996 - R emo te Proc essing Corp oration . All rights reserved. If you have a question about RPBASIC-52 and cannot find the answer in this manual, call us at the number listed below during norm al business hours. The software described in this manual is furnished under license.
RPBASIC-52 PROGRAMMING GUIDE CLEAR COM . . . . . . . . . . . . . . . . . . . . . . . CLEAR DISPLAY . . . . . . . . . . . . . . . . . . . CLEAR TICK . . . . . . . . . . . . . . . . . . . . . . CLEAR KEYPAD . . . . . . . . . . . . . . . . . . . COM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . COM$ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . CONT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . COS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . CR . . . . . .
RPBASIC-52 PROGRAMMING GUIDE ON LINE . . . . . . . . . . . . . . . . . . . . . . . . . . ONTICK . . . . . . . . . . . . . . . . . . . . . . . . . . PEEKB . . . . . . . . . . . . . . . . . . . . . . . . . . . . PEEKF . . . . . . . . . . . . . . . . . . . . . . . . . . . . PEEKW . . . . . . . . . . . . . . . . . . . . . . . . . . . PEEK$ . . . . . . . . . . . . . . . . . . . . . . . . . . . . PI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . POKEB . . . . . . . . . . . . . . . . . . . . . . .
RPBASIC-52 PROGRAMMING GUIDE PREFACE MANUAL CONVENTIONS This programming guide is for Remote Processing controllers using RPBASIC-52 language. It was derived from Intel MCS-51 BASIC, V1.1. Several command extensions and features have been added to effectively speed up command execution. Information appearing on your screen is shown in a different type. M M M Example: RPBASIC-52 V1.0 Copyright Remote Processing (1995) Bytes free: 27434 Buffered serial p orts.
RPBASIC-52 PROGRAMMING GUIDE Tasking statements define a condition and execution location wh en a condition is m et. Statemen ts include ON COM $, ON LINE, ON COUN T, and ONITR . Programs executed as a result of these statemen ts are treated as subro utines. The only difference between a tasking routine and one called by a GOSUB is the tasking can be called at any time. Basic Interpreters Ther e are se veral ty pes an d leve ls of inte rpreter s.
RPBASIC-52 PROGRAMMING GUIDE gone. Dow nloading tim e is increased w hen the old progra m is st ill prese nt. else (la ptop o r main fram e) is sen ding it c harac ters. The upload and download file does not contain any special codes; they are simply AS CII characters. If you like to write programs in separate modules, you can dow nload them separately. M odules are assigned blocks of line numbers. Start up code might be from 1 to 999.
RPBASIC-52 PROGRAMMING GUIDE SIZE(5), Variables and Con stants ABC_ Invalid variables, which may include embedded commands include: More than 25,000 unique variable or constant names may be defined. Names may be up to eight characters in length and must begin with a letter betw een A -Z (no num bers or s pecia l chara cters). The rest of the na me m ay contain nu mbers or letters and include the underline chara cter. 4C, C$0, GOTOE, FORM, #XYZ, _ABC Constants are literal values.
RPBASIC-52 PROGRAMMING GUIDE subroutines is limited to the amount of internal stack space. Usually this is about 35 subroutines, but can go down if F OR-N EXT loops are active. T his is sufficient to handle all multi-tasking (ON LINE, ON COUN T, ON KEY PAD, etc.) and several levels of subroutines. Arrays are single dimension and start with element 0. They are dim ensioned using the DIM statement. Each varia ble may h ave up to 255 e lements (0 to 254).
RPBASIC-52 PROGRAMMING GUIDE which halts o utput to the conso le serial port only; (X-ON ) restarts it. You can use this feature to prevent screens of output data from scrolling by too quickly to read. After you type a , B asic halts program execution if it is encountered during a PR INT com mand un til it receives a . You can also reduce the serial port baud rate or use the NULL com mand to slow down the output of console data. Be careful of the NUL L com mand.
RPBASIC-52 PROGRAMMING GUIDE "typical" tim e in RPB ASIC is less th an 1 ms. However, it can be as short as several micro-seconds to several sec onds. Th e reason it ca n take so long is due to the Basic subroutine. Suppose an ONTICK interrupt is in progress and it is written so it takes several seconds to com plete. Since it is the highest priority, all other interrupts are locked out. The best way to correct this situation is to make all interrupt routines as short as possible.
RPBASIC-52 PROGRAMMING GUIDE subroutine . When th e specified n umber o f pulses is reached, the counter resets and a count interrupt flag is set. Should a higher priority interrupt be executing, the count sub routine is dela yed until the highe r one is finished. The COU NT func tion is not usually use d in conjunction with this version. MULTITASKING CONSTRUCTS COUNT M ultitasking RPBASIC-52 on the RPC-3XX series of cards can count pulses while a program is running.
RPBASIC-52 PROGRAMMING GUIDE the RPC-3xx series cards. Refer to this program for the following description. The program starting at line 1000 is the network comma nd handle r. Line 100 0 gets the da ta packet. Line 1010 determines if it is meant for this card. Commands are sorted, or parsed out beginning at line 1020. F or this examp le, comma nds are assu med to begin with the letter 'A'. By subtracting the ASCII value of A, we set up the O N GO TO struc ture to quickly hand le each com mand type .
RPBASIC-52 PROGRAMMING GUIDE COM1 is set as the receive port. The modem connects to the RPC card serial port using a VTC-9F serial cable. Most external modems have a DB-25F (female) connector for the serial port, therefore a DB9F to DB -25M adapter is ne cessary. Also , since both the RPC card and modem are designed to plug into a PC, a null modem adapter must be inserted between the DB-9 connector on the VTC -9F and adapter.
RPBASIC-52 PROGRAMMING GUIDE 0 1 2 3 4 5 Wait for "RING" message. Modem auto answers. Look for "CONNE CT". Get password. If invalid, prompt for password again. Send succe ssful log in me ssage . Prompt for comm and and process t he m . Take modem off line and reset Delay for a few seconds and send sign on message. 7. The number of possible applications is much too complex to even begin showing code. Some a pplications use a person at a term inal to remotely query the card.
RPBASIC-52 PROGRAMMING GUIDE watc hdog t imer may be nec essary to resta rt the ca rd. Make sure call waiting is disabled. all ON C OUN T and O N LIN E statem ents are enabled. ON LINE Multitasking Assembly Language Interface ON LINE is used to detect changes in a line. An interrupt is generated every time a line goes high or low. Use this c omm and to detect ch anges in safety interlocks, level switches, or process command switches.
RPBASIC-52 PROGRAMMING GUIDE commands and are no longer available: OPERATORS Operator categories Arithme tic Relational Logical Value CLEAR I CLOCK0 CLOCK1 FPROG through FPROG6 IP PORT1 PROG through PROG6 RAM RCAP2 ROM RROM TIMER1 TIMER2 T2CON XFER XTAL include: =, +, *, /, **, SQR =, <>, <, >, <=, >= .AND., .OR., .XOR., .NOT. ABS, INT, PI, RND, SGN Operator Precedence The prece dence of ope rators determin es the order in which m athema tical operations are e xecuted.
RPBASIC-52 PROGRAMMING GUIDE Some com mands have bee n added to or otherwise enhanced: COMMAND GROUPS The Comm and Reference is a detailed description of each RPBA SIC-52 command, function, and instruction. Note tha t not all cards imp lement all comm ands. Also, this list is accura te as of the date of printing. New er cards ma y not mak e it into this programming guide. IDLE INPUT PWM The fo llowin g com man ds are n ew to BA SIC-5 2. Note that not a ll comm ands/functions a re available on all cards.
RPBASIC-52 PROGRAMMING GUIDE Logical operators perform bitwise operations on expressions w hich evaluate to valid positive intege rs between OH and OF FFFFH (65535). All nonintege r value s are tru ncate d to inte gers. Hexadecimal values with a leading alpha character must be pre ceded by a le ading zero or B asic will interpret your constant as a variable name. If you supply fewer than 16 bits to NOT it will return a 16bit value based on the assumption the unsupplied bits were zeros.
RPBASIC-52 PROGRAMMING GUIDE String operation ASC CHR STR STRING Strings in RPBASIC-52 are one-dimensional arrays of characters. Strings are stored as a sequence of ASC II values termina ted with a 0D H (the AS CII value of a carriage return). Memory for strings is allocated by the STRING opera tor. Strin g varia bles ar e $(0) th rough $(254) . Strings may be any length, lim ited only by ava ilable mem ory.
RPBASIC-52 PROGRAMMING GUIDE ABS Syntax: Function: Mode: Use: Cards: ABS(expr) Where: expr = any number in Basic's range Returns the absolute value of an expression Comm and, run PRINT ABS(C) All DESCRIPTION The absolute value of a number is always positive or zero.
RPBASIC-52 PROGRAMMING GUIDE AIN Syntax: Function: Mode: Use: Cards: AIN(channel) Where: channel = 0 to 7, is channe l to convert. Converts analog input to digital number and returns a number from 0 to 4095 (0 to 1023 for the RPC52) Comm and, Run B = AIN(N) RPC -52, RPC -320, RPC -330. RPC -52 range is 0 to 102 3 (10 bit). DESCRIPTION AIN returns a number corresponding to the input voltage. A number from 0 to 4095 (0 to 1023 for RPC-52) is returned. The result is returned in under 2 ms.
RPBASIC-52 PROGRAMMING GUIDE ASC Syntax: Function: Mode: Use: Cards: ASC(ASCII character) ASC(string,position expr) Where: ASCII character = number from 0 to 255 string = any valid string v ariable position expr = 1 to length of string Returns or sets the integer value of an ASCII character or the character in string at position expr. Comm and, run PRINT ASC (C) ASC($(3),1)=48H C = ASC($(0),P) All DESCRIPTION The ASC operator either sets or returns the value of an ASCII character.
RPBASIC-52 PROGRAMMING GUIDE ATN Syntax: Function: Mode: Use: Cards: ATN(expr) Where: expr = value betw een 0 and P I/2 Returns a trigon ometric arc-ta ngent of expr. Returned result is between -PI/2 and PI/2 radians. Comm and, run PRINT 4*AT N(1) All DESCRIPTION SIN, COS, and TAN operators use a Taylor series to calculate the function. These operators first reduce the argument to a value that is between 0 and PI/2. The algorithm used to reduce the value will reduce accuracy when expr is large.
RPBASIC-52 PROGRAMMING GUIDE BLOAD Syntax: Function: Mode: Use: Cards: BLOAD to RAM segmen t, RAM address, fro m EP ROM segmen t, EPRO M add ress, length Where: to RAM segment = 0 to 7, is the 64K block in RA M to write to RAM a ddress = 0 to 65,535, is the ad dress to write to from EPROM segment = 0 to 7, is the 64K block in EPROM to read from EPRO M address = 0 to 65,535, is the address in EPROM to read from length = 0 to 65,535, is the number of bytes to move from EPROM to RAM T r an sf er s a b lo c k
RPBASIC-52 PROGRAMMING GUIDE BSAVE Syntax: Function: Mode: Use: Cards: BSAVE to ROM segmen t,ROM address,fro m RA M segm ent, RAM address, len gth Where: ROM segment = 0 to 7, the 64K byte block to w rite to ROM address = 0 to 65535, ad dress to write to RAM segment = 0 to 7, a 64K byte block to read from RAM a ddress = 0 to 65535, address to read from length = 0 to 65535, nu mber of byte s to write W r it es ra w bi na ry d at a t o f la sh E PR O M fr om R A M .
RPBASIC-52 PROGRAMMING GUIDE many se ctors, the last written sec tor is filled in with mo re data from R AM. N ote that BL OAD allows data retrieval of any length and is not affected by sector size. The easiest way to determine an even sector address is to "AND" the EPROM address with either FFC0H, FF80H, or FE00H for 32K, 128K or 512K EPR OMs respectively. Data can be saved "ab ove" program s. The following is a way to dete rmine the ne xt free sector for writing to flash. 1) Save the program.
RPBASIC-52 PROGRAMMING GUIDE CALL Syntax: Function: Mode: Use: Cards: CALL address Where: address = address of assembly language program from 0 to 65535 Calls an asse mbly lang uage program in external Progra m M emory Comm and, Run CALL 16 All DESCRIPTION CALL instruction invokes an assembly language program. To return to Basic, you must execute a RET instruction in the assembly language program. Original BASIC-52 code to multiply address by two and add 4100H was re mov ed.
RPBASIC-52 PROGRAMMING GUIDE CARD$ Syntax: Function: Mode: Use: Cards: CARD $(expr) Where : expr = 0 to 3, is the card reader to scan. Checks c ard reader for data. If presen t, returns the site code an d card num ber. If no data is present, an error code de scribed below is returned. All data is return ed in a string form at. Run $(0) = CARD$(N) RPC-52, RPC-320, RPC -330 DESCRIPTION CAR D$ returns eithe r the site code and card num ber or an error code .
RPBASIC-52 PROGRAMMING GUIDE NOTE: This command takes approximately 27 ms to process. This is because the reader sends a bit of information ev ery 1 ms. Serial a nd timing interrup ts are processed a t the hardware level. How ever, commands such as ONTICK and ONITR are delayed until CARD$ is finished processing the data. RELATED CONFIG LINE ERROR BAD ARGUMENT When expr > 3 or negative EXAMPLE The follow ing exam ple reads the ca rd. CON FIG LIN E is performe d only once.
RPBASIC-52 PROGRAMMING GUIDE CBY Syntax: CBY(expr) Where: expr = address from 0 to 65535 Reads internal program code Comm and, run PRINT CBY(1000H) All Function: Mode: Use: Cards: DESCRIPTION The C BY instruc tion rea ds data from p rogram mem ory spa ce in th e 8052 . expr must evalu ate to a valid integer address of 00H through 0FFFFH (65535). Code memory is read-only. RELATED DBY, XBY, PEEK, POKE ERROR BAD ARGUMENT expr must be a v alid integer (0 through 65535).
RPBASIC-52 PROGRAMMING GUIDE CHR Syntax: CHR(expr) CHR(string,position) Where: expr = number from 0 to 255 string = string variable position = 1 to length of string Converts expr to ASCII character or prints string at position Comm and, run PRINT CHR (65) PRINT CH R($(0),1) All Function: Mode: Use: Cards: DESCRIPTION CHR is a dual use ope rator, similar to AS C. One ve rsion converts a nu meric exp ression to an A SCII character, allowing a variety of string manipulation operations.
RPBASIC-52 PROGRAMMING GUIDE CLEAR CLEAR S Syntax: Function: Mode: Use: Cards: CLEAR CLEAR S Sets variables to zero, clears stacks Comm and, run CLEAR CLEAR S All DESCRIPTION The CLEA R instruction sets all variables to 0 and resets all Basic stacks. ONER R is cleared. Error trapping must be redeclared after a CLEAR. CLEAR is generally used to clear all variables. CLEAR does not dealloca te me mory alloca ted to st rings by the ST RIN G inst ruction . It does c lear the conte nts of th e string s.
RPBASIC-52 PROGRAMMING GUIDE The a bove e xam ple sho ws tha t ON TIC K con tinues to run a fter a C LEA R sta teme nt but v ariable s are cl eared . If a program error were generated after the clear, the program would stop because ONERR w as cleared. The next e xample d emonstrate s how C LEA R S can b e used in a FO R-NE XT loop . A C-ST ACK error is returned if the CLEAR S is not in line 20.
RPBASIC-52 PROGRAMMING GUIDE CLEAR COM Syntax: Function: Mode: Use: Cards: C L E A R C O M (port) Where: port = 0 or 1 , the seri al com mun icatio n port. port may be la rger. Check yo ur cards ma nual. Clears receiv ed characters in specified serial port bu ffer. Run CLEAR COM (0) All DESCRIPTION Received characters in the specified serial port are cleared. Characters in the transmit buffer are not affected.
RPBASIC-52 PROGRAMMING GUIDE CLEAR DISPLAY Syntax: CLEAR CLEAR CLEAR CLEAR CLEAR CLEAR Function: Mode: Use: Cards: DISPLAY DISPLAY DISPLAY DISPLAY DISPLAY DISPLAY Clears character and, if available, graphics displays.
RPBASIC-52 PROGRAMMING GUIDE CLEAR TICK CLEAR KEYPAD Syntax: CLEAR TICK(timer) Where: timer = 0 to 3 CLEAR KEYPAD Function: Resets spe cified tick timer or c lears keypad b uffer. Mode: Comm and, Run Use: CLEAR TICK(1) DIFFERENCES FRO M BASIC-52 The TICK function replaced TIME as a process clock. See TICK function for more information. KEYPAD has no equivalent function in BASIC-52. DESCRIPTION There are fou r independen t tick timers that ca n be cleared ind ependently o f each other.
RPBASIC-52 PROGRAMMING GUIDE COM Syntax: Function: Mode: Use: Cards: C O M (port) Where: port = 0 or 1 , the seri al com mun icatio n port. port may be la rger. Check yo ur hardware manua l. Returns the n umber of ch aracters receive d in the specified se rial port buffer. Run A = COM (0) All DESCRIPTION Use this function in conjunction with GET and COM $ to determine the number of characters to extract from the serial buffer.
RPBASIC-52 PROGRAMMING GUIDE COM$ Syntax: Function: Mode: Use: Cards: $(n) = COM$( port) Where: port = 0 or 1 , the seri al com mun icatio n port. port may be la rger. Check yo ur hardware manua l. Return either a ll characters or up to a in specified se rial port. Run $(0) = COM$(0) All DESCRIPTION Characte rs in the specified com municatio ns port buffer are put into the string (on the left side of the = ) until one of three con ditions occur: 1) Th ere are no m ore characters to e xtract.
RPBASIC-52 PROGRAMMING GUIDE CONT Syntax: Function: Mode: Use: Cards: CONT Continue p rogram ex ecution after a ST OP or C omm and-C Comm and CONT All DESCRIPTION CON T resum es program execution follow ing a or STO P instruction. You can display or m odify variables while the program is stopped, but you cannot continue a program that is modified. RELATED STOP, GOTO, RUN ERROR CAN'T CONTINUE When program was m odified.
RPBASIC-52 PROGRAMMING GUIDE COS Syntax: Function: Mode: Use: Cards: COS(expr) Where: expr = numeric value up to ±200,000 Returns the trigo nometric co sine of expr which is in radians. Comm and, run PRINT COS (PI) All DESCRIPTION SIN, COS, and TAN operators use a Taylor series to calculate the function. These operators first reduce the argument to a value that is between 0 and PI/2. the algorithm used to reduce the value will reduce accuracy when value is large.
RPBASIC-52 PROGRAMMING GUIDE CR Syntax: Function: Mode: Use: Cards: PRINT CR, Used with P RIN T. Sen ds a ca rriage r eturn w ithout a line fee d. Comm and, run PRINT CR, All DESCRIPTION Used to update a line on a serial console device. A comma is necessary to prevent the usual line feed from terminating the PRINT instruction. RELATED PRINT EXAMPLE 100 110 PRINT TICK(0),CR, GOTO 10 >run 3.242 The number is continuously printed at the same position.
RPBASIC-52 PROGRAMMING GUIDE COUNT (statement) COUNT counter ,data Where: counter = 0 or 1 data = 0 to 16777215 Writes data to spec ified up /dow n coun ter. Comm and, Run CO UN T 0,A RPC-320, RPC-330 Syntax: Function: Mode: Use: Cards: DESCRIPTION Use this command to write 3 data bytes to the preset register (PR) in the LSI 7166 counter. This command does not transfer PR to the counter (CNTR). To do this, execute: LINEB 6,X,8 Where: X = 1 for counter 0, 3 for counter 1.
RPBASIC-52 PROGRAMMING GUIDE COUNT (function) Syntax: Function: Mode: Use: Cards: A = COUNT(counter) Where: counter = 0 - 1, or 4 - 11 Reads a multimode hardware or software counter Comm and, Run A = COU NT(0) RPC-320, RPC-330 DESCRIPTION RPBASIC-52 recognizes a hardware and software counter. The hardware counter is 24 bits wide from a LSI 7166 chip. (Your board may use a different kind. Please check your hardware manual.) The RPC-320 has one of these and the RPC -330 has two.
RPBASIC-52 PROGRAMMING GUIDE DATA Syntax: Function: Mode: Use: Cards: DATA expr [,expr,...] Where: expr = numeric data. It is an expression list used by READ. Run DATA 23.4,17,3.2,PI*3 All DESCRIPTION Elements of a DATA statement are sequentially retrieved by the READ instruction. Multiple DATA expressions on a single program line must be separated by commas. There must be no spaces between expr and the comm as. See RES TORE for more information and exam ples.
RPBASIC-52 PROGRAMMING GUIDE DATE (function) Syntax: Function: Mode: Use: Cards: A = DATE(n) Where: n = 0 to 3 0 = year (last two digits) 1 = mon th 2 = day 3 = day of week Returns the month, day, day of week, or year from the optional real time clock Comm and, Run A=D ATE (2) Returns day of month All. Note exceptions for RPC-52. DESCRIPTION A DS1216DM must be in the RAM socket. Consult your hardware manual for location. A numerical value of the month, day, or year is returned.
RPBASIC-52 PROGRAMMING GUIDE DATE (statement) Syntax: Function: Mode: Use: Cards: DATE year,month,day[,day of week] Where: year = 0 to 99 month = 1 to 12 day = 1 to 31 day of week = 1 to 7 Sets the date to the real time clock Comm and, Run DATE 96,11,17 Sets date to November 17, 1996 All DESCRIPTION Leap yea r is automatica lly set. Tests for day check limits of 1 to 31. It does not check for a valid day in a month. You could set 2-31-96 as a valid date.
RPBASIC-52 PROGRAMMING GUIDE DBY Syntax: A=DBY(expr) DBY(expr)=variable Where: expr = 0 to 255 variable = 0 to 255 Read/write internal data memory. Comm and, run DBY(0F0H ) = 45H A=DB Y(100) All Function: Mode: Use: Cards: DESCRIPTION The D BY instruc tion ret rieves or assig ns a va lue to th e 8052 interna l data m emo ry. expr and variable must both must be between 0 and 255 since there are only 256 internal memory locations and one byte can only be between 0 and 255.
RPBASIC-52 PROGRAMMING GUIDE DIM Syntax: Function: Mode: Use: Cards: D I M name(size)[,name(size)...] Where: name = A n y v a li d v a ri a bl e n a m e size = 1 to 255 elem ents Reserves storage for single-dimension array. Comm and, run DIM FLOW(200) : REM dimensions a 200 element array called FLOW All DESCRIPTION The maxim um num ber of array elements is 255, accessed as name(0) through name(254). CLEAR, NEW , or RU N com man ds de-a llocat e all arr ay stor age.
RPBASIC-52 PROGRAMMING GUIDE DISPLAY Syntax: DISPLAY option[,option][,option] Where: option is one or more of the following "string" Prints to display $(n) Prints to display (row,col[,cursor]) Positions cursor an d turns it on or off data Puts data values to display CR Prints a carriage return to the display LINE Puts a line to a graphics display P Puts a point to a graphics display ON [G,C] Enables character, graphic, or both displays OFF [G,C] Turns off character, graphic, or both displays Function: Mod
RPBASIC-52 PROGRAMMING GUIDE (row,col,[,cursor]) positions the cursor and, optionally, turns it ON or OFF. This option affects the character cursor position only. T he row and collum alw ays start at 0,0, which is the upper left corner o f the screen. If row or col exceed the d isplays limits, a B AD A RGU MEN T error is returned. Th e optional cursor is turned on or off using ON or OFF. DISPLAY (1,5) DISPLAY (2,0,OFF) data is byte information written to the display.
RPBASIC-52 PROGRAMMING GUIDE DISPLAY OFF DISPLAY OFF G DISPLAY OFF C Turns off both character and graphics displays. Turns off graphic display only. Turns off character display only. Turning off the character display does not turn off graphics. Using D ISPLA Y ON /OFF [option ] allows you to sw itch betwee n character an d graphics display s. It is possible to upda te both graphics a nd character sc reens even if they are off.
RPBASIC-52 PROGRAMMING GUIDE DO-UNTIL Syntax: Function: Mode: Use: Cards: DO {program statements} UNTIL relational expr Where: relational expr is any logical evaluation such as =, <, >, etc. Executes a number of program statements a relational expression is true. Run 100 A=0 : DO : A=A+1 : PRINT A : UNT IL A=4 : PRINT "Done" All DESCRIPTION This statement always executes at least once. DO-UNTIL loops may be nested.
RPBASIC-52 PROGRAMMING GUIDE DO-WHILE Syntax: Function: Mode: Use: Cards: DO {program stateme nts} WH ILE {relation al expr} Executes { program state ments} w hile {relational expr} is true . Run 100 CLEAR TICK(0) : DO : PRINT TICK(0) : WHILE TICK(0)<10 All DESCRIPTION The {prog ram statem ents} betw een DO and W HILE a re executed o nce, regardless of the {relational expr} result. At WH ILE the {re lational expr} is evaluated.
RPBASIC-52 PROGRAMMING GUIDE END Syntax: Function: Mode: Use: Cards: END Terminates program execution and returns to command mode. Run 65000 END All DESCRIPTION The EN D instruction term inates Basic program ex ecution. If no EN D instruction is use d at the end of a program, the last instruction automatically terminates the program. Use END after the body of your program and prior to any subroutines.
RPBASIC-52 PROGRAMMING GUIDE EXECUTE Syntax: Function: Mode: Use: Cards: EXECUTE [segme nt] Where: segment = program to execute Loads and runs program specified by segment. COMMAND, RUN EXECUTE n RPC-320, RPC-330 DESCRIPTION Com man d gets a progra m from the flas h EPR OM and ex ecute s it. segment specie s the pro gram to exe cute. The program saved by the S AVE n comm and is execute d. The range o f segment depends upon the flash EPROM size. See the SAVE comm and for more information.
RPBASIC-52 PROGRAMMING GUIDE EXP Syntax: Function: Mode: Use: Cards: EXP(expr) Raises "e" (2.71828) to the pow er of expr Comm and, run PRINT EXP(C OS(1)) All DESCRIPTION This function retu rns the result of the num ber Q (2.718282) raised to the power given by expr. This function is very com putation time intensive. Sm all values of expr take about 5 milli-seconds to calculate while larger ones (near 250) require nearly 0.2 seconds.
RPBASIC-52 PROGRAMMING GUIDE FOR-TO-STEP-NEXT Syntax: Function: Mode: Use: Cards: FOR variable =initial index expr TO index limit expr [STEP step expr ] progra m statem ents NEXT [variable ] Where: variable = any valid variable symbol initial index expr = starting value assigned to variable index limit expr = ending va lue of variable step expr = optional increment or decrement to variable when repeating a loop Looping structure useful for executing a sequence of instructions a numb er of times.
RPBASIC-52 PROGRAMMING GUIDE EXAMPLE The following example gets characters from the receive buffer and generates a checksum. A string of 10 characters is entered at com port 0. 10 20 30 40 50 60 70 80 90 STRING 200,20 PRINT "Type in 10 characters. Characters are not echoed" IF COM(0) < 10 THEN 30 $(0) = com$(0) CKSUM = 0 FOR N = 1 to STR(0,$(0)) CKSUM = CKSUM + ASC($(0),N) NEXT PRINT "Checksum of incoming string:",CKSUM >run Type in 10 characters.
RPBASIC-52 PROGRAMMING GUIDE FREE Syntax: Function: Mode: Use: Cards: FREE Returns the bytes of available in program RAM Comm and, run PRINT FREE All DESCRIPTION FREE returns how m any bytes of R AM a re available to the p rogram an d Basic va riables. It does not return the amount of expanded RAM in 128K or 512K RAM systems. The amount of free memory is determined by the following formula: FREE = MT OP - LE N - system mem ory "system memory" on cards with two serial ports is 1791.
RPBASIC-52 PROGRAMMING GUIDE FREQ (Function) Syntax: Function: Mode: Use: Cards: FREQ(channel) Where : channel = 0 or 1, depending upon card. Returns a counter value Comm and, run PRINT FR EQ(0) RPC-210, RPC-320, RPC-330 (RPC-210 and -320 are channel 0 only) DESCRIPTION This command returns a frequency, or number of pulses over a period of time. FREQ returns the latest value from the hardware counter. FREQ does not actually read from the counter.
RPBASIC-52 PROGRAMMING GUIDE BAD DATA When channel is out of range for a card. EXAMPLE The follow ing exam ple sets up frequen cy multitaskin g and prints the co unts received in a time interval. 10 LINEB 6,1,32 20 LINEB 6,1,72 : REM Reset counter and enable inputs 30 CONFIG FREQ 0,200 : REM Get count every second (5 ms * 200) 40 C = 5/56000 : REM Constant using Greyhill module.
RPBASIC-52 PROGRAMMING GUIDE GET Syntax: Function: Mode: Use: Cards: A = GET Gets chara cter from buffer. Run A = GET All DESCRIPTION GET is similar to INKEY$ in other Basic languages. GET returns the ASCII value of the character rather than the string. This feature makes it useful when receiving binary information. To rec eive a contro l-C va lue (3), s et bit 1, a ddress 26H. DB Y(38 ) = DB Y(38 ) .OR . 1 This disables program breaks when a is received.
RPBASIC-52 PROGRAMMING GUIDE GOSUB GOSUB line number ... line number program state ments RETURN Transfers program control to the specified line number. The RETURN causes execution to resume at the program statement after GOSUB. Run 100 FOR A=1 to 20 : GOSUB 200 : NEXT A : END 200 PRINT A, SQR(A) : RETURN All Syntax: Function: Mode: Use: Cards: DESCRIPTION GOSUB provides subroutine capability within RPBASIC-52 programs. A subroutine may be called from within another subroutine.
RPBASIC-52 PROGRAMMING GUIDE GOTO Syntax: Function: Mode: Use: Cards: GOTO line number Routes program execution to line number Comm and, run GOTO 100 All DESCRIPTION When line number is the line num ber of an execu table statem ent, that stateme nt and those follow ing are executed. G OTO can be used in the comm and mod e to re-enter a program at a desired point. RELATED GOSUB, ON-GOTO, ON-GOSUB, RUN ERROR INVALID LINE NUMBER Specified line nu mber doe s not exist.
RPBASIC-52 PROGRAMMING GUIDE IDLE Syntax: Function: Mode: Use: Cards: IDLE [option] Where: option specifies a card dependent mode. Suspends p rogram ex ecution and w aits for an interrupt. RUN IDLE All. Variations a re card depen dent. DESCRIPTION Different cards have a variety of parameters. Refer to your hardware manual for more information. Use this command to suspend program execution and wait for an interrupt.
RPBASIC-52 PROGRAMMING GUIDE IF THEN ELSE Syntax: Function: Mode: Use: Cards: IF expr [ THEN ] statement(s) [ ELSE statement(s)] Where: expr = any logica l evaluation or varia ble statement(s) = any num ber of Basic sta tements When expr is TRUE (not zero), the instruction following THEN is executed, otherwise the instruction following ELSE is executed. Run 10 IF A<>B THEN PRINT "A=B" ELSE PRINT "A<>B" All DESCRIPTION THE N is implied by IF. You m ay omit T HEN . ELSE is o ptional.
RPBASIC-52 PROGRAMMING GUIDE INPUT Syntax: Function: Mode: Use: Cards: INPUT ["prompt text"] [,] [,variable ...] Where: prompt text = optional text variable = list of variables to assign Program p auses to receive data entered from the console inpu t. Run 100 INPUT "Enter batch number",$(0) All DESCRIPTION INPUT brings in numeric and string data from the console serial port during execution. Variables are string, numeric, or bo th. Variables are se parated by a c omm a.
RPBASIC-52 PROGRAMMING GUIDE INT Syntax: Function: Mode: Use: Cards: INT(expr) Returns an in teger portion of expr Comm and, run PRINT INT(PI) All DESCRIPTION The integer p ortion is stored as a floating point numb er. RELATED none ERRORS none EXAMPLE print int(45.67) 45 print int(-16.9999) -16 To produce true rounding to the closest whole number, use the following formula: A = INT(B+0.
RPBASIC-52 PROGRAMMING GUIDE KEYPAD Syntax: Function: Mode: Use: Cards: A = KEYPAD(function) Where: function = 0 or 1 0 = return keypad position pressed from buffer 1 = returns number of keys in buffer Returns key pad pressed po sition or numb er of keys in keyp ad buffer. Comm and, Run A = KEY PAD(0) Returns a keypad position All DESCRIPTION The keypad is automatically scanned, debounced, and placed in an 8 position buffer in the background.
RPBASIC-52 PROGRAMMING GUIDE LD@ Syntax: Function: Mode: Use: Cards: L D @ expr Where: expr = valid integer address of 00H through 0FFFFH (65535) Retrieves a floating-point number previously saved with ST@ Comm and, run LD@ 3000 All DESCRIPTION LD@ is used in conjunction with PUSH, POP, and ST@ . Use these commands to save and retrieve floating p o in t n u mb e rs to p ro g ra m R A M . NOTE: LD@ and ST@ cannot use ex tended RA M. Only se gment 0 R AM (u sed for running B asic programs) is used.
RPBASIC-52 PROGRAMMING GUIDE LEN Syntax: Function: Mode: Use: Cards: LEN Returns length of the current program in RAM Comm and PRINT LEN All DESCRIPTION The LE N function tells yo u the length of the p rogram in R AM. L EN returns a value of 1 wh en no program is in RAM mem ory (1 is the length of the e nd-of-program marker).
RPBASIC-52 PROGRAMMING GUIDE LINE (Function) Syntax: Function: Mode: Use: Cards: A = LINE(line) Where: line = 0-9 o r 100 to 123 (L ine ran ges m ay var y. Che ck you r hardw are m anua l.) Returns status o f a line at on-card lines L 0-7 or interrupt port. Comm and,Run A = LINE(2) Reads line 2. Basic functio n available on a ll cards. Range s vary from ca rd to card. See hard ware m anual. DESCRIPTION LINE returns a 0 or a 1. A '0' corresponds to a low while a '1' is a high.
RPBASIC-52 PROGRAMMING GUIDE LINE# (Function) Syntax: Function: Mode: Use: Card: A = LINE#( line) Where: line = connecto r number from 101 to 125 (Lin e ranges m ay vary. Che ck your hardw are man ual.) Returns status o f a line at the digital I/O c onnector. Comm and,Run A = LINE#(103) Reads level from digital I/O port connector number 3. Function ava ilable on all cards. R anges will va ry from card to c ard. See hardw are manu al.
RPBASIC-52 PROGRAMMING GUIDE LINEB (Function) Syntax: Function: Mode: Use: Cards: A = LINEB(i/o bank,add ress) Where: i/o bank = 0 to 7. Specific fun ctions are card de pendent. Re fer to your hardw are manu al. address = device dependent. Usually it is 0 to 3. Reads a byte from an I/O device. Comm and, Run A = LINEB (3,0) Reads po rt A of 8255 at digita l port. All. i/o bank is unique to each card. DESCRIPTION This function is equivalent to INP in other BASICs.
RPBASIC-52 PROGRAMMING GUIDE LINE (Statemen t) LINE line,data Where: line = 0 to 8 or 100 t o 123 (L ine ran ges m ay var y. Che ck you r hardw are m anua l.) data = 0, 1, ON, or OFF. See text below. Turns a extern al opto mod ule or lines L0-L 8 on or off. Comm and, Run LIN E 0,1 Basi c state men t availa ble for a ll cards . line ranges are card dependen t. See hardwa re manua l.
RPBASIC-52 PROGRAMMING GUIDE LINE# (Statemen t) LINE# line,data Where: line = 101 to 125, is the digital I/O line connector number. (Line ranges may vary. Check your ha rdwa re ma nual.) data = ON, OFF, 0, or 1. See text below. Sets a specified line at the digital I/O connector high or low. Comm and, Run LIN E #10 2,0 Basi c com man d avai lable fo r all car ds. line ranges are card dependen t. Refer to hardw are manu al.
RPBASIC-52 PROGRAMMING GUIDE LINEB (Statemen t) Syntax: Function: Mode: Use: Card: LINEB i/o bank,a ddress,da ta Where: i/o bank = 0 to 7. Specific fun ctions are card de pendent. Re fer to your hardw are manu al. address = device dependent. Usually it is 0 to 3. data = 0 to 255, data to o utput. Writes a byte to an I/O device. Comm and, Run LIN EB3 ,0,A Writes valu e in A to port A of 8255 at digital port. Basic command available for all cards. Device/Function changes slightly for each card.
RPBASIC-52 PROGRAMMING GUIDE LIST Syntax: Function: Mode: Use: Card: LIST LIST line number LIST line number - line number Where: line number is a program line number Prints all or some of a program to the console. Comm and LIST 10-100 All DESCRIPTION The LIST comm and prints the program in RAM to the console device. LIST inserts spaces after the line number and before and after instructions. Program listings are terminated with a .
RPBASIC-52 PROGRAMMING GUIDE LIST# Syntax: Function: Mode: Use: Cards: LIST# port LIST# port,line number LIST# port,line number-line number Where: port = 0 or 1 or number of serial ports on your card. line number = program line number Outputs the c urrently selected p rogram to the serial printer port. Comm and LIST#0 All. port limit is card dependent DESCRIPTION The L IST# com man d outp uts all o r som e of the curren tly prog ram in RA M to t he spe cified s erial po rt. port 0 is the console po rt.
RPBASIC-52 PROGRAMMING GUIDE LOAD Syntax: Function: Mode: Use: Card: LOAD [segme nt] Where: segment = 0 to 7, see table below. Loads a program from EPROM Comm and LOAD 1 Loads prog ram from mem ory segme nt 1 A l l. M ax im u m segment is card depend ent. Refer to your c ards hardwa re manua l. DESCRIPTION Up to 8 different programs can be saved and loaded from flash EPROM. The m aximum number depends upon the EPROM size. When no segment is specified, 0 is assumed.
RPBASIC-52 PROGRAMMING GUIDE LOG Syntax: Function: Mode: Use: Cards: LOG (expr) Returns the n atural logarithm (base "e") of expr which must evaluate to greater than zero. Calculated to seven significant digits. Comm and, run PRINT LOG (COS(0 )) All ERRORS ARITH. UNDERFLOW expr or result is less than RPBASIC-52's smallest floating-point value of ± 1E-127 ARITH. OVERFLOW expr or result is greater than R PBA SIC-52's largest floatin g point value of ± .
RPBASIC-52 PROGRAMMING GUIDE MTOP Syntax: Function: Mode: Use: Cards: MTOP MTOP = last valid RAM address Reads or assigns the top of external data memory which will be used by Basic for variable, string, and RAM program storage Comm and, run MTOP =30000 PRINT MTOP A l l. C om m a nd is li m it in g on c ar ds w it h 1 2 8K o r m o re o f R A M .
RPBASIC-52 PROGRAMMING GUIDE NEW Syntax: Function Mode: Use: Cards: NEW Erases current program in RAM. All variables and strings are cleared. Comm and NEW All DESCRIPTION The NE W com mand de letes the program currently in RA M, sets all variab les equal to zero, an d clears all strings and m ulti-tas king in terrupt s. NE W d oes no t effect the rea l-time clock or string alloca tion.
RPBASIC-52 PROGRAMMING GUIDE NULL Syntax: Function: Mode: Use: Cards: NULL integer Where: integer = 0 -255 Sets num ber of NU LL cha racters output to use r after a carriage return Comm and NULL 100 All DESCRIPTION The N ULL com man d cont rols how man y NU LL c harac ters (00 H) are outpu t follow ing a c arriage return. After a reset, N ULL = 0. B ecau se this is a com man d mo de com man d, it can not be used a s part of a progr am. The NULL count is stored at external data memory location 15H.
RPBASIC-52 PROGRAMMING GUIDE ON COM$ Syntax: Function: Mode: Use: Cards: O N C O M $port,length,terminator,program line O N C O M $port Where: port = the com port numbe r 0 or 1 length = numb er of received ch aracters for an interrupt terminator = character to cause an interrupt program line = executes subroutine when length or terminator is met. Branches to a subroutine when length or terminator criteria is met.
RPBASIC-52 PROGRAMMING GUIDE ON COUNT Syntax: Function: Mode: Use: Cards: ON COUNT number, line number, count, program line ON COUNT number, line number ON COUNT number Where: number is 4 to 11. It represents a cou nter numbe r. line number is 0-7 or 100-123 an d is the digital I/O line nu mber. count is 1 to 65535. It is the num ber of pulses nee ded for an interrupt. program line is the subroutine to execute when count is reached. Enables count multi-tasking at a specific I/O line.
RPBASIC-52 PROGRAMMING GUIDE 10 ON COUNT 10,3 20 ONTICK 1,1000 30 GOTO 30 . . .
RPBASIC-52 PROGRAMMING GUIDE ONERR Syntax: Function: Mode: Use: Cards: ONERR line number Goes to line number on arith meti c error, b ad arg ume nt, and hardw are erro rs. Run ONER R 1000 All DESCRIPTION The ONER R instruction traps arithmetic errors and hardware problems, transferring control to line number. ONERR can be used to handle errors generated due to bad user input from and INPUT instruction. ONERR is a GOTO, not a GOSU B. Consequently, there is no easy way to resume program execution.
RPBASIC-52 PROGRAMMING GUIDE ON GOSUB ON expr GOSUB line0[,line1[,line2...]] Where: expr = 0 to number of subroutines after GOSUB linen = subroutine line number to e xecute Calls subroutine based on valu e of expr. Run ON A G OSUB 100, 200, 500 All Syntax: Function: Mode: Use: Cards: DESCRIPTION The ON-GO SUB instruction conditionally branches to one of several possible subroutines depending on the value of expr. expr must evalu ate to greater than o r equal to zero.
RPBASIC-52 PROGRAMMING GUIDE ON GOTO Syntax: ON expr GOTO line0[,line1[line2...]] Function: Branches to a program line based on expr value. valuate to greate r than or equal to ze ro; if expr evaluates to ze ro, execution bran ches to {0th line# }; if expr evaluates to one, execution branches to {1st line#}, etc. Commas shown are required. Mode: Run Use: ON A/5 GO TO 100, 200, 500 Cards: All DESCRIPTION The ON-GO TO instruction conditionally branches to linen where 'n' is the value of expr.
RPBASIC-52 PROGRAMMING GUIDE ONITR Syntax: Function: Mode: Use: Cards: ONITR number,line number ONITR number ONITR line number ONITR Where: number = interrupt line. This is ca rd dependen t. Refer to your hardw are manu al. line number = Subroutine line number to go. Branche s to a service subrou tine on an extern al or counter interrupt. Run ONITR 0,5000 Executes a subroutine at line 5000 on hardware interrupt 0. Basi c com man d avai lable fo r all car ds. number may or m ay not be used .
RPBASIC-52 PROGRAMMING GUIDE EXAMPLE The following example responds to an external interrupt on the RPC-330. 10 ONITR 1,1000 Declare interrupt . . Other program initialization . 200 IDLE Wait for interrupt 210 IF F = 0 THEN 200 If not done . . Program continues .
RPBASIC-52 PROGRAMMING GUIDE ON KEYPAD Syntax: Function: Mode: Use: Cards: ON KEYPAD subroutine line ON KEYPAD Where: subroutine line = program to execute Branches to a subroutine when a keypad switch is pressed. RUN ON KE YPAD 1000 RPC-320, RPC-330 DESCRIPTION Program branches when any key is pressed on the keypad. Use the routine below to build a string. Review HARDWAR E AND SOFTWARE INTERRU PTS in the first part of this manual for interrupt handling and multitasking information.
RPBASIC-52 PROGRAMMING GUIDE ON LINE Syntax: Function: Mode: Use: Cards: ON LINE number,I/O line,subroutine line ON LINE number ON LINE ON/OFF [,CLEAR] Where: number = 0 to 7, is the interrupt reference number I/O line = 0 to 7 or 100 to 12 3. Line num ber range is card d ependent. subroutine line = program subroutine to execute on line change ON/OFF = enable / suspend ON LINE checking CLEAR = clears all line change flags Branches to a service subroutine when an I/O line changes state.
RPBASIC-52 PROGRAMMING GUIDE The overall speed of RPBASIC-52 slows down by about 3% w hen all ON LINE tasks are enabled. Review HARDWAR E AND SOFTWARE INTERRU PTS in the first part of this manual for interrupt handling and multitasking information. RELATED none ERRORS BAD A RGUM ENT when number > 7 or I/O line is not between 0-7 or 100-123. EXAMPLE The following exam ple sets up several interrupts. 10 20 30 ON LINE 0,1,1000 ON LINE 5,2,2000 ON LINE 3,3,3000 . . .
RPBASIC-52 PROGRAMMING GUIDE ONTICK Syntax: Function: Mode: Use: Cards: ONTICK time,line number Where: time = time interval from 0.01 to 327 line number = line to branch Calls subroutine at line number every time interval. Run ONTICK 1.25,500 All DESCRIPTION ONTICK calls a subroutine every time interva l. time ranges from 0.010 seconds to 327.7 seconds (appro xima tely 5.5 minu tes). time can be specified in increments as small as 0.005 seconds. ONTICK interrupts are turned off when time = 0.
RPBASIC-52 PROGRAMMING GUIDE PEEKB PEEKB(segment,ad dress) Where: segment = 0 to 7, specifies a 64K segment address = 0 to 65535, byte address in a segment Reads a byte from RAM Comm and, Run A = PEEKB(1,AD) All Syntax: Function: Mode: Use: Cards: DESCRIPTION This function is used in conjunction with POKEB. Data is retrieved from any memory location. PEEKB inputs 1 byte of data. This function operates in much the sam e way as XB Y does except PE EKB c an access 5 1 2K o f R A M .
RPBASIC-52 PROGRAMMING GUIDE PEEKF PEEKF(segment,ad dress) Where: segment = 0 to 7, specifies a 64K segment address = 0 to 65535, byte address in a segment Reads a floa ting point num ber from R AM. Flo ating point range is + /- 1E-127 to +/0.99999999E+127 Comm and, Run A = PEEK F(1,AD) All Syntax: Function: Mode: Use: Cards: DESCRIPTION This function is used in conjunction with POKE F. Data is retrieved from any memory location. PEEK F retrieves a floating point number saved by POKE F.
RPBASIC-52 PROGRAMMING GUIDE PEEKW Syntax: Function: Mode: Use: Cards: P E EK W (segment,ad dress) Where: segment = 0 to 7, specifies a 64 K segm ent. address = 0 to 65535, w ord address in a se gment. Reads an unsigned 16 bit number from RAM Comm and, Run A = PEEKW(0,AD) All DESCRIPTION Use this function in conjunction w ith POK EW . Data is retrieved from any mem ory location as a sin gle 16 bit (2 byte) num ber. Num bers in the range o f 0 to 65535 are retriev ed.
RPBASIC-52 PROGRAMMING GUIDE PEEK$ Syntax: Function: Mode: Use: Cards: $(n) = PEEK$(segment,ad dress) Where: segment = 0 to 7, specifies a 64K segment address = 0 to 65535, starting string address in a segment R e tr ie v es a s tr in g fr om R A M . Comm and, Run $(0) = PEEK$(1,210) All DESCRIPTION Use th is com man d to retri eve str ings sto red in R AM mem ory usin g the P OK E$ co mm and. segment specifies the 64K segment to save to. 0 is the base segment where RPBA SIC-52 runs its programs.
RPBASIC-52 PROGRAMMING GUIDE PI Syntax: Function: Mode: Use: Cards: PI Stored constant 3.1415926 Comm and, run PRINT PI All DESCRIPTION PI is closer to 3.14159 2653, so proper roun ding should be 3 .1415927. Ho wever, trig errors were greate r when 7 w as used than 6 fo r the last digit.
RPBASIC-52 PROGRAMMING GUIDE POKEB Syntax: Function: Mode: Use: Cards: POKEB segmen t,address,d ata Where: segment = 0 to 7, specifies a 64K segment address = 0 to 65535, specifies address in a segment data = 0 to 255, number to save to RAM W r it es on e da ta b yt e t o R A M . Comm and, Run POK E B1 ,2100,D All DESCRIPTION Use POKE B to write to any one of 512K memory locations. The maximum number of locations is limited by the amount of RAM installed.
RPBASIC-52 PROGRAMMING GUIDE POKEF Syntax: Function: Mode: Use: Cards: POKEF segmen t,address,d ata Where: segment = 0 to 7, specifies the 64K segment address = 0 to 65535, location in segment to save to data = +/- 1E-127 to +/- 0.99999999E+127, number to save to RAM W r it es a f lo a ti ng p oi nt nu m be r t o R A M . Comm and, Run POKE F1,AD,DA All DESCRIPTION Use PO KEF to w rite floating point num bers into RA M. Program "constants" suc h as calibration tab les are saved to batte ry bac ked R AM .
RPBASIC-52 PROGRAMMING GUIDE POKEW Syntax: Function: Mode: Use: Cards: P O KE W segmen t,address,d ata Where: segment = 0 to 7, specifies the 64K segment address = 0 to 65535, location in segment to save to data = 0 to 65535, number to save to RAM W r it es an u ns ig n ed 1 6 b it nu m be r t o R A M . Comm and, Run POKE W1,AD,DA All DESCRIPTION Use POKE W to write 16 bit numbers into RAM. The results of an A-D conversion, for example, can be saved. WARNING: RPBAS IC-52 does not check the address.
RPBASIC-52 PROGRAMMING GUIDE POKE$ Syntax: Function: Mode: Use: Cards: POKE$ segment,address,string Where: segment = 0 to 7, specifies the 64K segment address = 0 to 65535, location in segment to save to string = string variable to save Save string variable to RAM memory. Comm and,Run POKE$ 1,30000,$(1) All DESCRIPTION POK E$ is u sed to s ave lite ral string s in RA M m emo ry. Strin gs of an y leng th can be sav ed.
RPBASIC-52 PROGRAMMING GUIDE POP Syntax: Function: Mode: Use: Cards: POP variable [ ,variable,...] Take s a valu e PU SHe d to a sta ck and assign s it to the variab le. Comm and, run POP X,Y,Z All DESCRIPTION Multiple variables can be POPped off the stack by separating the variables with commas. The first value POPped is the last value PUSHed. POP and PUSH are useful for transferring data values between subroutines. They allow you to write a subroutine with arbitrary variable names.
RPBASIC-52 PROGRAMMING GUIDE PH0. PH1. Syntax: Function: Mode: Use: Cards: PH0 . expr PH1 . expr Where: expr = any mathematical expression Print in hexadecimal format following the number with an "H". Comm and, run PH0. PEEKB (1,3000) All DESCRIPTION The PH0. and PH1. instructions work like PRINT instruction except that it print values in HEX. The value printed is alway s a truncated integ er and is followe d with an "H " to indicate hex adecim al format.
RPBASIC-52 PROGRAMMING GUIDE PRINT PRINT #, P. ? Syntax: Function: Mode: Use: Cards: PRINT expr P. expr ? expr PRINT#port,expr P.#port,expr ?#port,expr Where: expr = any string, mathematical number, or calculation port = serial output port 0 or 1. Your card may have m ore ports. Prints value of expr to a serial port Comm and, run PRINT "String",$(0),AIN(0)*.00214 PRINT#, P.#, and ?# only on RPC-320, RPC-330. DESCRIPTION PRINT is used to send serial data to any port. Default is COM 0.
RPBASIC-52 PROGRAMMING GUIDE PUSH Syntax: Function: Mode: Use: Cards: PUSH expr1 [,expr2,...] Where: expr is a numeric value Puts the value o f expr to the argument stack. The first value PUSHed and is the last POPped. Comm and, run PUS H X ,Y All DESCRIPTION PUSH and POP instructions pass valu es to Basic su broutines. The las t value pushed is the last expression in the PUSH instruction, and is also the first popped off the stack.
RPBASIC-52 PROGRAMMING GUIDE PWM Syntax: Function: Mode: Use: Cards: P W M line, ltime,htime[,cycles] Where: line = 0 to 8 or 100 to 12 3. This is card depe ndent. Refer to yo ur hardware m anual. ltime = 0 to 255, number of 5 ms periods line is low htime = 0 to 255, number of 5 ms periods line is high cycles = 0 to 65535, optional number of pulse cycles Produces pu lse width m odulated outpu t.
RPBASIC-52 PROGRAMMING GUIDE READ Syntax: Function: Mode: Use: Cards: READ variable [,variable , ...] Sequentially a ssigns the values of data provided in the DAT A statem ent to the variables in a list. Run REA D X ,Y,Z All DESCRIPTION Multiple variables following one READ instruction must be separated by commas. READ must always be followed by at least one variable. See RESTO RE for examples and more information.
RPBASIC-52 PROGRAMMING GUIDE REM Syntax: Function: Mode: Use: Cards: R E M any ASCII text Allows remarks in a program or on command line Comm and, run 100 RE M Yo u can put any thing you wa nt here REM T his remark has no line number so will be discarded by RPBASIC -52 All DESCRIPTION The REM instruction lets you add comments to your program. Any text after a REM is ignored. REM instructions cannot be terminated with a colon, but they can follow colons.
RPBASIC-52 PROGRAMMING GUIDE RESTORE Syntax: Function: Mode: Use: Cards: RESTORE Resets the R EAD instruction pointer to the b eginning of the D ATA list. Run RESTORE All DESCRIPTION After a RE STOR E statem ent is executed , the next RE AD state ment acc esses the first item in th e first data s ta t em e n t i n t he p ro g ra m . ERROR NO DA TA - no DATA list provided.
RPBASIC-52 PROGRAMMING GUIDE RETI Syntax: Function: Mode: Use: Cards: RETI Return from ONITR or ON TICK interrupt. RETI must be the last instruction of the interrupt subroutine. Run RETI All DESCRIPTION The R ETI in structio n caus es you to exit fr om O NTI CK , ONT IME (RPC -52 ca rd only ) and O NIT R inte rrupts. RETI functions like RETURN , but it clears software interrupt flags so that RPBAS IC-52 can acknowledge subsequent inte rrupts.
RPBASIC-52 PROGRAMMING GUIDE RETURN Syntax: Function: Mode: Use: Cards: RETURN Returns program to next instruction following a GOSUB command or software interrupt (ON LINE, ON KEY PAD , etc.) Run RETURN All DESCRIPTION RETUR N is used as a return from a GOS UB. Program execution continues at the statement following the GOSUB.
RPBASIC-52 PROGRAMMING GUIDE RND Syntax: Function: Mode: Use: Cards: RND Returns a pseudo-random fractional number between zero and one inclusive. Comm and, run A=RND All DESCRIPTION The RND operator uses a 16-bit binary seed and repeats after 65535 pseudo-random numbers. The initial seed is the value of MTOP. The seed can be changed by writing to address 10CH and 10DH using the XBY command.
RPBASIC-52 PROGRAMMING GUIDE SAVE Syntax: Function: Mode: Use: Cards: SAVE [segme nt] Where: segment = 0 up to 7 S a ve p ro g ra m to fl as h E P R OM . Comm and SAVE 1 All DESCRIPTION Use SAVE to store programs in flash EPROM. The current program in RAM is saved to the segment specified. If no segment is specified, 0 is assumed. Up to 8 programs (totaling over 500K bytes) can be saved, depending upon the flash EPROM type.
RPBASIC-52 PROGRAMMING GUIDE SGN Syntax: Function: Mode: Use: Cards: SGN(expr) Returns +1 if expr is greater than zero, zero if the expr equals zero, and -1 if expr is less than zero. Comm and, run PRINT SGN(S IN(X))) All DESCRIPTION Use SG N in level con trol applications. If a level is high or low, it can direct co ntrol to the appropriate p ro g ra m .
RPBASIC-52 PROGRAMMING GUIDE SIN Syntax: Function: Mode: Use: Cards: SIN(expr) Returns the trigo nometric S INE of expr which is assum ed to be in radians . The value of expr must be in the range of +/- 200,000. Comm and, run PRINT SIN(PI/2) All DESCRIPTION SIN, COS, and TAN operators use a Taylor series to calculate the function. These operators first reduce the argument to a value that is between 0 and PI/2. the algorithm used to reduce the value will reduce accuracy when value is large.
RPBASIC-52 PROGRAMMING GUIDE SPC Syntax: Function: Mode: Use: Cards: PRINT SPC(expr) Where: expr = number of spaces to print Sends expr number o f space charac ters (20H) from the serial port. Comm and, run PRINT SPC(A *4), All DESCRIPTION SPC m ust be used in co njunction with a print stateme nt.
RPBASIC-52 PROGRAMMING GUIDE STOP Syntax: Function: Mode: Use: Cards: STOP Breaks program execution; resume with the CONT comm and. Run STOP All DESCRIPTION The STOP instruction lets you break program execution at specific locations in a program. You can display and modify variables after STOPping a program. STOP is useful for program debugging. The CONT command lets you resume program execution.
RPBASIC-52 PROGRAMMING GUIDE STR Syntax: Function: Mode: Use: Cards: A = STR(function,$(n)[,$(n)])) Where: function = 0 to 14, specifies string function to perform as described below. Performs string m anipulation, describ ed below, pe r function num ber. Comm and,Run A = ST R(0,$(0)) RPC-320, RPC-330 DESCRIPTION There are 11 string manipulation functions using STR. Each function is described below. NOTE: Most of these functions require a string variable (such as $(0)) rather than a quoted string.
RPBASIC-52 PROGRAMMING GUIDE Syntax: A = ST R(3,$(n)) Description: Retu rns num bers in a string as a rea l num ber. Sim ilar to V AL i n othe r Basi cs. Le ading space s are ig nored . First non-num ber terminate s conversion at las t valid numb er. No valid num bers return 0. Num ber length is limited to the first 12 valid numbers and decimal in a string. This means a number no greater than 99999 99999 999 is c onver ted to a num ber. Example: 10 STRING 100,20 20 $(2) = "-23.
RPBASIC-52 PROGRAMMING GUIDE Syntax: A = STR(7,$(put),$(get),position,len gth) Description: Extracts a portion of a string from $(get) and transfers it over to $(put). The actual num ber of characters mov ed is re turned . position starts at 1. When position is 0, no characters are placed into $(put) regardless of length . When length is 0, all characters are copied from $(get) to $(put) starting at position. Example: 10 STRING 200,20 20 $(0) = "123456.
RPBASIC-52 PROGRAMMING GUIDE Syntax: A = ST R(10,$(n),format,va riable) Description: Converts and formats variable into a st ring an d puts it into $(n ). Varia ble A returns irrelev ant da ta. Formatting is controlled by the format variable. Strings are formatted into one of 3 basic patterns, described below. format = 0. Default free form at. When n umber is be tween ± 99999999 a nd ±0.1, RP BAS IC will save integers and fractions.
RPBASIC-52 PROGRAMMING GUIDE STRING Syntax: Function: Mode: Use: Cards: STRING total bytes,string leng th Where: total bytes = total num ber of bytes in m emory to allo cate string leng th = maximum number of bytes in a string Allocate memory for strings Comm and, run STRING 56,10 : REM Allocate memory for 5 10-byte strings All DESCRIPTION Prior to using strings, you m ust use STR ING to alloc ate mem ory for them.
RPBASIC-52 PROGRAMMING GUIDE SQR Syntax: Function: Mode: Use: Cards: SQR(expr) Where: expr is any valid mathematical expression, number, or variable greater than 0 Retu rns a po sitive s quare root. Comm and, run PRINT SQR(A) All DESCRIPTION expr must be positive. Any calculation is accurate to ±5 least significant digits. ERRORS ARITH. UNDERFLOW expr or result is less than RPBASIC-52's smallest floating point value of ± 1E-127 ARITH.
RPBASIC-52 PROGRAMMING GUIDE ST@ Syntax: Function: Mode: Use: Cards: S T @ expr Where: expr = 0 to 65535 Takes a floating-point number from the a rgument stack and stores it to data mem ory at the address. Comm and, run PUSH B : ST@7E00 All DESCRIPTION ST@ is used in conjunction with PUSH, POP, and LD@ . Use these commands to save and retrieve floating p o in t n u mb e rs to p ro g ra m R A M . NOTE: LD@ and ST@ cannot use ex tended RA M. Only se gment 0 R AM (u sed for running B asic programs) is used.
RPBASIC-52 PROGRAMMING GUIDE TAB Syntax: PRINT TAB(position) Where: position = 1 to 255 Specifies a column number at to begin printing. Comm and, run PRINT TAB(5), "Pressure", TAB (20),"Temperature" All Function: Mode: Use: Cards: DESCRIPTION TAB is used with PRINT . It is used to print data in table form. If the cursor is past the requested column, the instruction is ignored. ERROR BAD ARGUMENT When position is negative or out of range.
RPBASIC-52 PROGRAMMING GUIDE TAN Syntax: Function: Mode: Use: Cards: TAN(expr) Returns the trigo nometric tan gent (sin/cos) of expr whic h is assu med to be in radian s. expr must be in the range of +/- 200,000. Comm and, run PRINT TA N(PI/4) All DESCRIPTION SIN, COS, and TAN operators use a Taylor series to calculate the function. These operators first reduce the argument to a value that is between 0 and PI/2. the algorithm used to reduce the value will reduce accuracy when value is large.
RPBASIC-52 PROGRAMMING GUIDE TICK Syntax: TICK(timer) Where: timer = 0 to 3. It specifies the tim er numbe r. Returns a time from one of 4 process clocks in 5 ms increme nts. Comm and,Run A = TICK(2) All Function: Mode: Use: Cards: DESCRIPTION There are four tick timers updated 200 times per second. Each timer is independent of each other in that they may be read and cleared separately (see CLEAR TICK). All timers are updated at the same time.
RPBASIC-52 PROGRAMMING GUIDE TIME (function) Syntax: Function: Mode: Use: Cards: A = TIME(n) Where: n = 0 to 4 0 = hours 1 = minutes 2 = seconds 3 = hundredths of a second 4 = seconds since midnight Returns the hour, minute, second, or hundredths of a second from the real time clock Comm and, Run A=TIM E(1) Returns minutes All DESCRIPTION A DS1216DM must be installed in the data RAM socket, usually U5. Refer to your hardware manual for exac t locati on.
RPBASIC-52 PROGRAMMING GUIDE TIME (command) Syntax: Function: Mode: Use: Cards: TIME hours,minutes,seconds Where: hours = 0 to 23 minutes = 0 to 59 seconds = 0 to 59 Sets the time to the real time clock Comm and, Run TIME 18,17,00 Sets time to 6:17:00 PM All. Note consideration for RPC-320, RPC-330 DESCRIPTION Time uses a 24 hour format. Hundredths of a second are set to 0 when TIME is executed. The RPC-320 and RP C-330 use an optional DS1216DM clock module.
RPBASIC-52 PROGRAMMING GUIDE UI0 UI1 Syntax: Function: Mode: Use: Cards: UIn Where: n = 0 or 1, is the serial port number Directs serial input to COM 0 or COM 1 when using GE T and INPU T statements. Comm and, run UI1 All DESCRIPTION UI0 and UI1 can be placed anywhere in a program, allowing RPBASIC-52 to accept input from either COM0 or COM1. The original BASIC-52 required an assembly language routine to use another serial port. RPBASIC-52 has done this already.
RPBASIC-52 PROGRAMMING GUIDE UO0 UO1 Syntax: Function: Mode: Use: Cards: UOn Where: n = 0 or 1, is the serial port number Directs PR INT outpu t to COM 0 or COM 1 serial port. Comm and, run UO1 All DESCRIPTION UO0 and UO1 can be placed anywhere in a program, allowing RPBASIC-52 to accept print to either COM0 or COM1. The original BASIC-52 required an assembly language routine to use another serial port. RPBASIC-52 has done this already.
RPBASIC-52 PROGRAMMING GUIDE USING U. Syntax: PRINT USING (format) PRIN T U.( format) Where: format USING(Fn) n is the numb er of significant digits. A m inimum of 3 significant digits are always printed. Maximum value of n is 8. USING(#.#) The number of # symbols determines how many significant figures of the output value will be displayed before and after the decimal point. The maxim um total num ber of "#" sym bols is 8.
RPBASIC-52 PROGRAMMING GUIDE WDOG Syntax: Function: Mode: Use: Cards: WDOG [time] Where: time = 0, 1, or 2 no parameter = toggle watchdog timer 0 = turn off watch dog timer 1 = set timeout interval to 0.38 seconds 2 = set timeout interval to 2.8 seconds Resets or sets w atchdog tim er. Run WDOG All. Cards use this command in different ways. Refer to your hardware manual to verify operation.
RPBASIC-52 PROGRAMMING GUIDE XBY Syntax: Function: Mode: Use: Cards: XBY(addr) XBY(addr)=expr Where: addr = 0 to 65535 (0FFFFH ) is a memory address expr = 0 to 255 is data to save Read/write external data memory, segment 0 only. Comm and, run XBY(99)=35 All DESCRIPTION XBY retrieves or assigns a value to external data memory. This command is equivalent to PEEKB and POKEB. RELATED CBY, DBY, PEEKB, POKEB ERROR BAD ARGUMENT Invalid addr or attempt to assign an out of range value to a XBY(expr).
RPBASIC-52 PROGRAMMING GUIDE CONFIG COMMANDS CO NFIG com man ds con figure v arious I/O to u ser def ined p aram eters. All CONFIG com mands are unique to RPBASIC-52. There is no equivalent in the original version. Some comm ands are not available for all cards. CON FIG AIN Syntax: Function: Mode: Use: Cards: CONFIG AIN channel, mode, range Where: channel = 0 to 7, analog input channel mode = 0 or 1, differential or single - ended range = 0 or 1, ±2.
RPBASIC-52 PROGRAMMING GUIDE CONFIG BAUD Syntax: CONFIG BAUD 0,baud CONFIG BAUD 1,baud,rs-485 Where: baud = Baud rate number. See tables below. rs-485 = Parameters for RS-485 port. See table below. Specify 0 or 1 for seria l port. Set baud rates for COM0 and COM 1. Comm and, Run CONFIG BAUD 1,3,OFF All. baud code will vary from card to card. Function: Mode: Use: Cards: DESCRIPTION Power up baud rate is 9600 for both ports. Serial param eters change im mediately after this comm and is exec uted.
RPBASIC-52 PROGRAMMING GUIDE CONFIG DISPLAY Syntax: CONFIG DISPLAY type Where: type = 0 to 3, defines the display type 0 = LCD 4 x 40 character 1 = LCD 4 x 20 character 2 = Vacuum florescent 4 x 20 character 3 = LCD - 5003 graphics display 4 = Vacuum florescent 4 x 20, IEEE Centry series Function: Defines the display type used with D ISPLAY and related comm ands. Mode: Command, RUN Use: CONFIG DISPLAY 1 Configures display port and operation for LCD 4 x 20.
RPBASIC-52 PROGRAMMING GUIDE CONFIG FREQ Syntax: CONFIG FREQ channel,interval Where: channel = counter num ber, 0 or 1 interval = number of 5 milli-second periods between readings. Range is 1 to 255. An interval of 0 turns off this multitasking routine. Function: Sets up multitasking to read a counter every interval. The counter is read using the FREQ com mand.
RPBASIC-52 PROGRAMMING GUIDE CONFIG LINE Syntax: CONFIG LINE 0,configu ration 0,p ort C CONFIG LINE 100,configu ration 1,p ort A,por t B,port C Where: configuration n = port configuration per tables below. port A = Digital I/O p ort A output data port B = Digital I/O p ort B output da ta port C = Digital I/O p ort C output da ta Function: Configures digital I/O ports for inputs and outputs. Mode: Comm and, Run Use: CONFIG LINE 0,1,128 CONFIG LINE 100,3,255,0,240 Cards: All. Check line ranges for your card.
RPBASIC-52 PROGRAMMING GUIDE configuration 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Port A Port B Upper C Lower C Output Output Output Output Output Output Output Output Input Input Input Input Input Input Input Input Output Output Input Input Output Output Input Input Output Output Input Input Output Output Input Input Output Output Output Output Input Input Input Input Output Output Output Output Input Input Input Input Output Input Output Input Output Input Output Input Output Input Output Input O
RPBASIC-52 PROGRAMMING GUIDE APPENDIX A - Network example program File: NET3XX.BAS rem rem rem rem rem RPC-3xx networking Uses COM1 as network port To use com port 0 and get going faster, REM out the following lines: 130, 150, 1510, 1530 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.
RPBASIC-52 PROGRAMMING GUIDE rem 130 CONFIG BAUD 1,1,2 rem set the display type for command D 140 config display 1 rem Read lines 0-3 to determine card address. rem Card number starts from ASCII '0' and goes up from there. rem 150 ASC($(0),3) = (lineb(5,2) .AND.
RPBASIC-52 PROGRAMMING GUIDE rem if last two digits don't sum to message, then return a negative rem acknowledge error and bail out 1170 if oc <> ocksum then $(2) = "N2" : goto 1510 rem Checksum is good REM If status command, go process it 1200 IF oa = 4 THEN 4000 1210 if oa > 5 then 1500 :REM if not in command, is error REM Check for valid power up acknowledge REM if not acknowledged, then state so 1220 if oflag = 0 then $(2) = "N3" : goto 1510 rem process command rem GOSUB's could also be used here.
RPBASIC-52 PROGRAMMING GUIDE 1700 $(2) = "A" 1710 GOTO 1510 rem Bad data 1750 $(2) = "N4" 1760 goto 1510 REM set a line according to data rem For this example, line 8 is assumed to be controlled rem Get desired status.
RPBASIC-52 PROGRAMMING GUIDE 3030 oc = str(10,$(2),0,oc) rem Force letter A to first spot.
RPBASIC-52 PROGRAMMING GUIDE APPENDIX B - Modem example program File: MODEM.BAS rem Modem communication program rem Based around BASIC-52 software for RPC-320, 330 rem rem rem rem rem General operation. This program is designed as a receiver. Dialing out from a modem is simply a matter of sending a ATDT command and responding appropriately to whatever is dialing.
RPBASIC-52 PROGRAMMING GUIDE rem password. Enter 'password'. rem set at line 2300. rem rem rem rem rem rem Use lower case. The password is You are then prompted for a command. Commands for this demo are prefixed with '>03'. The command is a number following the '3'. To return the current analog reading on channel 0, type '>030' You will probably get 0 if there is no voltage on channel 0. To return the status at line 0, type '>031'. You will probably get a 1. A '>032' will disconnect from the line.
RPBASIC-52 PROGRAMMING GUIDE 20 string 1000,50:rem 20 strings, 50 bytes 30 dim flag(15) :rem flags for main task dispatcher 40 okflg = 0 :rem OK received flag 50 ontick 1,1000 :rem communication watchdog and system timer 60 on com$ 1,49,13,2000 :rem interrupt on 49 chars or 70 ctim = 10 :rem communication timeout if on line.
RPBASIC-52 PROGRAMMING GUIDE rem rem rem rem rem rem 1000 2 = looking for password. If ok send log on. If not, tell user 1500 3 = looking for command. If ok, set MCYCLE. If not, tell user 1500 4 = Send esc, look for OK, send hang up, look for OK, send reset look for OK 1600 5 = Send out sign on message after a few seconds delay cycle = 0 1 2 3 4 5 on cycle gosub 1400,1500,1500,1500,1600,1900 6 7 rem other ONTICK stuff 1390 reti rem cycle 0 waiting for ringing rem This is idle.
RPBASIC-52 PROGRAMMING GUIDE 1685 print : print "Sent +++" 1690 return rem rem rem rem rem 1700 1710 1720 1730 look for OK If have it, send hang up If not, set flag (nokfl) and continue as modem could have been hung up on and lost carrier Send out hang up command any way uo 1 print "ATH0" uo 0 nokfl = not(okflg).and.1 : okflg = 0 rem DEBUG 1735 print : print "Sent ATHO." 1740 return rem Look for OK (must have it).
RPBASIC-52 PROGRAMMING GUIDE rem ON COM$ processing rem get current input 2000 $(0) = com$(1) 2010 atim = 0 : rem if anything came in, reset actual com time rem ignore any .
RPBASIC-52 PROGRAMMING GUIDE 2240 cycle =4 rem DEBUG 2255 print "No CONNECT received. Input string=",$(0) 2260 return rem hold off any xmission for 3 seconds before sending sign on 2270 cycle =5 2280 passw = 0 2290 return rem cycle 2 rem Looking for password. rem If tried 3 times, hang up 2300 2310 2320 2330 2335 2340 2345 $(1) = "password" cia = str(8,$(0),$(1)) if cia > 0 then 2350 passw = passw + 1 uo 1 : print "Invalid password.
RPBASIC-52 PROGRAMMING GUIDE rem cycle 4 rem Look for OK rem If have OK, then reset cycle to 0 rem If message is not OK, simply leave 2500 $(1) = "OK" 2510 if str(8,$(0),$(1)) <> 1 then return rem got OK rem Signal system and let tick timer do next 2520 okflg = 1 2590 return rem cycle 5 rem send out sign on message after 1 second delay rem Clear out COM if got here 2600 clear com(1) 2610 return rem mcycl 0 processing from main loop rem send back analog channel 0 to modem 10000 10010 10020 10030 10090 u
RPBASIC-52 PROGRAMMING GUIDE APPENDIX C- ERROR MESSAGES The RPB ASIC-52 error processor helps identify errors. When running a program , error messages are expressed as: ERROR: XXX - IN LINE NNN NNN Instruction _______X where XXX is the type of error and NNN is the program line number where the error occurred. The "______X" identifies the very approximate location of the error.
RPBASIC-52 PROGRAMMING GUIDE This exam ple produces a n expected e rror: ?le-100/le28 ERROR: ARITH. UNDERFLOW READY This exam ple produces a n incorrect expo nent: >?le-100/.9e28 1.1111111 E -0 ARITH. OVERFLOW The result of an arithmetic operation exceeds the upper limit of RPBASIC-52 floating-point numbers. RPBASIC52's largest floating-point number is ± .99999999E+127. An operation such as 1E100*1E28 causes an ARITH. OVE RFLO W error.
RPBASIC-52 PROGRAMMING GUIDE I-STACK There is not enough internal stack space to evaluate an expression. Usually this is caused by an excessive number of parentheses. MEMORY ALLOCATION A c ce ss in g a s tr in g th a t i s o u ts id e th e de fi ne d st ri ng li m it s o r a ss ig n MT O P a v a lu e th a t d o es no t c o nt ai n a n y R A M . NO DATA A REA D instruction does not have valid associated DATA instruction.
RPBASIC-52 PROGRAMMING GUIDE APPENDIX D - Data storage STRING STORAGE BASIC-52 stores string variables between MTO P and top of variable space, call VARTO P. String $(0) would be stored from VARTOP to [VARTOP + (bytes_per_string + 1)]. String $(1) is stored from [VARTOP + (bytes_per_string + 2)] to [VARTOP +2 * (bytes_per_string + 1)], and so on. All strings are term inated with a c arriage return (0D H, 13 decim al). VARIABLE STORAGE Scaler variables are numbers not in a dimension.
RPBASIC-52 PROGRAMMING GUIDE APPENDIX E - Software revision history ;V1.02 added ; 24 key keypad scanning ; Took out BELL w hen backspacing beyond beginning of line ; Took out extra CRLF when entering in just a CR for a command. ;V1.03 added ; CARD function ; CO NFIG LINE 100 on ly now re-initia lizes p ort wit hout w riting to serial E EPR OM . ;V1.04 Changed ; Release for RPC-320 ;V1.05 Fixed ; BSA VE returne d a hardwa re error when ve rify was bad. In fact, ; save was ok.
RPBASIC-52 PROGRAMMING GUIDE V1.13 01/12/96 Added code to support IEE centry series display (3602-100-05420) Includes CONFIG DISPLAY 4 Added P RINT #port V1.14 03/28/96 Fixed bug in ON COU NT. Returns error for lines > 100 V1.15 06/26/96 PEEK $ could cause basic to lock up under right conditions. V1.16 02/18/97 O N L IN E O FF c ou ld c au se p ro g ra m to lo c k u p i f r un n in g ON C O M . Syntax error when DISPLAY used with IF-THEN-ELSE. Added PEE KF and PO KEF com mands. V1.