ALLEN-BRADLEYA-B VBASIC Language Development Kit(Catalog No. 2708-NBD)User Manual
Chapter 1Introduction to BASIC1–2Almost no one is using the original ANSI standard BASIC any more. Thelanguage only allowed 26 variables, had no strin
Chapter 1Introduction to BASIC1–3A-B VBASIC is a subset of Microsoft’s Visual BASIC, consisting of thosecommands which are relevant in the workstation
A–B2Chapter2–1Developing and Runningan A-B VBASIC ProgramStep #1 – PlanningThe 2708-DH5Axx workstations have approximately 96K bytes dedicated forprog
an A-B VBASIC ProgramChapter 2Developing and Running2–2In order to emulate programs on a PC the A-B Application Library wasdeveloped (see Chapter 5).
an A-B VBASIC ProgramChapter 2Developing and Running2–3The .LXE “download” file produced the the A-B VBASIC cross-compilermust be transmitted, through
an A-B VBASIC ProgramChapter 2Developing and Running2–4Prefix digits 9 and 10 of the network record: are 01. (Refer to AttendedWorkstation User’s Manu
an A-B VBASIC ProgramChapter 2Developing and Running2–5All errors encountered by the A-B VBASIC pseudo-code interpreter areserious enough to result in
an A-B VBASIC ProgramChapter 2Developing and Running2–6Circuitry within a workstation is capable of detecting and reporting to theprocessor an imminen
A–B3Chapter3–1The A-B VBASICCROSS-COMPILER (LXB)The Visual BASIC Development Environment alone will not generate aprogram for a workstation. Visual BA
CROSS-COMPILER (LXB)Chapter 3The A-B VBASIC3–2The LXB compiler is executed on a PC by entering the following command.You must be in the right director
DisclaimerSolid state equipment has operational characteristics differing from those ofelectromechanical equipment. “Safety Guidelines for the Applica
CROSS-COMPILER (LXB)Chapter 3The A-B VBASIC3–3Examples:LXBIn the case above, the operator is prompted for 3 file names.LXB Prog1In this case, the file
CROSS-COMPILER (LXB)Chapter 3The A-B VBASIC3–4B – Downloaded Executable FileThe usual extension of a file that is produced by most other compilers is“
A–B4Chapter4–1Special Devices in A-B VBASICMost I/O in A-B VBASIC is performed by accessing special device nameswhich are unique to the workstation. I
Chapter 4Special Devices in A-B VBASIC4–2Some statements and intrinsic functions implicitly refer to a specific device.These are:Front panel LCD CLS,
Chapter 4Special Devices in A-B VBASIC4–3Note: See the description of PRINT USING and WRITE for details on otherformatting options supported.See also
Chapter 4Special Devices in A-B VBASIC4–4Reserved device name: BAROpen Modes: INPUTStatements: LINE INPUTFunctions: EOF returns TRUE when a complete r
Chapter 4Special Devices in A-B VBASIC4–5This means that:1. EOF and LOF may be called any number of times before LINE INPUT,and they will return the i
Chapter 4Special Devices in A-B VBASIC4–6Reserved device names: HOST, NET, and QUEIt is very easy to forward the data collected by a workstation to th
Chapter 4Special Devices in A-B VBASIC4–7Note: There is no queue for data FROM the host, only a single buffer. Inputoperations from HOST and NET acces
Chapter 4Special Devices in A-B VBASIC4–8For example:PRINT #NETDEV, “BAD INVENTORY NUMBER”may be trapped by the host computer as a BASIC ERROR because
A–BBulletin 2708BASIC Language Development KitTable of ContentsiChapter 1What is BASIC? 1–1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 4Special Devices in A-B VBASIC4–9CLOSE “HOST”Note: When HOST is CLOSEd, the A-B VBASIC interpreter always tellsthe network task that no data i
Chapter 4Special Devices in A-B VBASIC4–10LINE INPUT # for HOST and NETGET # for HOST and NET (OPEN with RANDOM)These statements will read one record
Chapter 4Special Devices in A-B VBASIC4–11IOCTL$ (intrinsic function) for HOST and NETThis function returns a string formatted as follows:Byte 0: ‘0’
Chapter 4Special Devices in A-B VBASIC4–12A – Output to a Communication PortThe BASIC Language Development Kit (Catalog No. 2708-NBD) containssubrouti
Chapter 4Special Devices in A-B VBASIC4–13C – Modem Control LinesThe primary communication port is equipped with DTR and RTS. These canbe set through
Chapter 4Special Devices in A-B VBASIC4–14For example, in a new file:PUT #X, 1, somethingPUT #X, 1000, somethingwill result in space being allocated f
Chapter 4Special Devices in A-B VBASIC4–15The LED in the lower left corner of alphanumeric keyboards is used as ashift lock indicator by the operating
Chapter 4Special Devices in A-B VBASIC4–16Reserved device name: EGGDescription:The egg timer is a word of memory which, when non-zero, is decrementedb
A–B5Chapter5–1A-B VBASIC Application LibraryThe BASIC Language Development Kit (Catalog No. 2708-NBD) consists ofa set of BASIC source files which you
Chapter 5A-B VBASIC Application Library5–2Installation consists of installing the diskette in drive A: and typing:A:INSTALIB d:Where d is the destinat
Bulletin 2708BASIC Language Development KitTable of ContentsiiChapter 4Introduction 4–1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Chapter 5A-B VBASIC Application Library5–3If you don’t want to type this in, you will find this sample program underENVEX1.BAS. Now, assuming that the
Chapter 5A-B VBASIC Application Library5–4Figure 5.1ENVPC Main Screen (Running ENVEX1)Library TestDo somethingTimeout of 1000 has 900 left.123456789 1
Chapter 5A-B VBASIC Application Library5–5Since that is all that your BASIC program would input.TAB C or ALT C: Com port manual input. You key in a re
Chapter 5A-B VBASIC Application Library5–6The lower ASCII characters from 0 to 31 and 127 are named. These are:NUL = 0 BS = 8 DLE = 16 CAN = 24SOH = 1
Chapter 5A-B VBASIC Application Library5–7MODIFIED%: True when a read changes the default value. . . . . . TIMEOUT%: YOU set to 100th seconds before a
Chapter 5A-B VBASIC Application Library5–8Display and KeyboardYou may use the full range of PRINT, LOCATE, etc. functions to write to thedisplay. Do n
Chapter 5A-B VBASIC Application Library5–9Status DisplayThe application status display (one of the special status displays described inthe Attended Wo
A–BAAppendixA–1A-B VBASIC and Visual BASIC TipsMisspellingsDon’t misspell names. BASIC is unforgiving of such errors since it will justcreate a new v
Appendix AA-B VBASIC and Visual BASIC TipsA–2The programmer assumed that this statement would clear the second line ofthe display and then print “This
A–BBAppendixB–1Differences BetweenA-B VBASIC and Visual BASICThis document describes the differences between Allen-Bradley VBASICand Microsoft Visual
Bulletin 2708BASIC Language Development KitTable of ContentsiiiChapter 5Introduction 5–1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
A-B VBASIC and Visual BASICAppendix BDifferences BetweenB–2b. # suffix on variablesc. Floating–point constants with 8 or more significant digitsd. AS
A-B VBASIC and Visual BASICAppendix BDifferences BetweenB–3LINE INPUT Request$IF Request$ = “JUMP” THEN CHAIN “JUMP”The interpreter does not tolerate
A-B VBASIC and Visual BASICAppendix BDifferences BetweenB–4statements produce executable code, they should be placed at the start of aprogram.CONST FA
A-B VBASIC and Visual BASICAppendix BDifferences BetweenB–5DECLARE FUNCTION GetTime$()DECLARE SUB SetTime$()The generic name for declaring a procedure
A-B VBASIC and Visual BASICAppendix BDifferences BetweenB–6OPTION BASE is not supported, so in order to set the lower subscript usethe following: DIM
A-B VBASIC and Visual BASICAppendix BDifferences BetweenB–7EXIT DOEND IFLOOPCLOSE #1EXIT {DO/FOR/FUNCTION/SUB}Exits a DO...LOOP or FOR...NEXT loop, FU
A-B VBASIC and Visual BASICAppendix BDifferences BetweenB–8may not return the same file numbers, even in identical programs. Justbecause a file numbe
A-B VBASIC and Visual BASICAppendix BDifferences BetweenB–9END IFLOOPUpdateTime:LOCATE 1, 1, 0PRINT LEFT$(CurrTime$,2); “:”; RIGHT$(CurrTime$,2);RETUR
A-B VBASIC and Visual BASICAppendix BDifferences BetweenB–10INSTR([start,]stringexpression1,stringexpression2)Returns the character position of the fi
A-B VBASIC and Visual BASICAppendix BDifferences BetweenB–11LBOUND(array[,dimension])Returns the lower bound (smallest available subscript) for the in
Bulletin 2708BASIC Language Development KitTable of ContentsivDECLARE {FUNCTION | SUB} name(parameters) B–4. . . . . . . . . . . DEFINT letterrange[,l
A-B VBASIC and Visual BASICAppendix BDifferences BetweenB–12OPEN “COM” FOR INPUT AS #1 ‘Must be a normal terminal.DODO WHILE LOC(1) = 0: LOOP ‘Wait fo
A-B VBASIC and Visual BASICAppendix BDifferences BetweenB–13OCT$(numeric–expression)Returns a string representing the octal value of the numeric argum
A-B VBASIC and Visual BASICAppendix BDifferences BetweenB–14OPEN “EMPLOYEE” FOR APPEND AS #1Format$ = “$####.##”A = 123.459PRINT #1, USING Format$; A
A-B VBASIC and Visual BASICAppendix BDifferences BetweenB–15RETURNReturns control from a sub routine. No line number or line label clauses aresupport
A-B VBASIC and Visual BASICAppendix BDifferences BetweenB–16statementsEND SELECTSGN(numeric–expression)Indicates the sign of a numeric expression. Se
A-B VBASIC and Visual BASICAppendix BDifferences BetweenB–17SOUND 1400, 2 ’1400 Hz for 2 clock ticks (20 ticks per second).SPACE$(n)Returns a string o
A-B VBASIC and Visual BASICAppendix BDifferences BetweenB–18SUB GetName (Name$)DOCLSLINE INPUT “Enter your name: “;Name$PRINT Name$;“Correct? “;LINE I
A-B VBASIC and Visual BASICAppendix BDifferences BetweenB–19TIME$ = “15450000” ‘ Sets time to 3:45:00.00TIMERReturns the number of seconds elapsed si
A-B VBASIC and Visual BASICAppendix BDifferences BetweenB–20WENDExecutes a series of statements in a loop, as long as a given condition is true.A-B VB
A–BCAppendixC–1Application Library SubroutinesIn ENV.BAS and ENVPC.BASOpenLINX Opens all devices to be used by low level I/O routines. . . . . . TestE
Bulletin 2708BASIC Language Development KitTable of ContentsvPOS(0) B–13. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Appendix CApplication Library SubroutinesC–2In TRIG.BASFullArcTangent! Returns arc tangent using numerator and denominator. . ArcTangent! Relturns the
Appendix CApplication Library SubroutinesC–3The most important events are:TimeoutEvent The input timer has expired. . . . NetEvent Read from network h
Appendix CApplication Library SubroutinesC–4SetDTR Sets the state of Data Terminal Ready.SetRTS Sets the state of Request To Send for a comm port.Set
Appendix CApplication Library SubroutinesC–5PENDING% TRUE if Send will result in a pause.This should be checked before any Send, to prevent pauses in
Appendix CApplication Library SubroutinesC–6Note: In EnvPC, dashes are returned, not slashes (MM-DD-YYYY).CL1 Clears the top line of the display and h
Appendix CApplication Library SubroutinesC–7The global MODIFIED% is TRUE when the string was changed in anyway. The strlength is the maximum number
Appendix CApplication Library SubroutinesC–8ReadPassword% Inputs a password from the keyboard.e = ReadPassword% ( length%, string$ ) ;FUNCTION Read
Appendix CApplication Library SubroutinesC–9The menu string is a string in which each menu entry is preceded by a “ | ”(vertical bar). Thus a menu$ su
Appendix CApplication Library SubroutinesC–10FullArcTangent! Returns arc tangent using numerator and denominator.This is similar to ArcTangent (numera
Appendix CApplication Library SubroutinesC–11SineH! Returns the hyperbolic sine.y! = SineH! ( x! )FUNCTION SineH! ( x )CosineH! Returns the hype
Bulletin 2708BASIC Language Development KitTable of ContentsviIn TRIG.BAS C–2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
A–BDAppendixD–1A-B VBASIC LimitsFirmware Version 1.1. . . . . . . . . . . . . . . . . Maximum PRINT USING clause 80 characters. . . . . Maximum line t
Appendix DA-B BASIC LimitsD–2When compiling programs with the LXBC command, the statistics in theLST listing file show the percent of total compiler c
IndexI–2AA–B VBASIC and Visual BASICTips, A–1PRINT “text”, A–2A–B VBASIC Application Library,5–1BASIC Language DevelopmentKit, 5–1Using the ENVPC Simu
IndexI–3MMID$, B–10OOPEN, B–10PPRINT, B–10SSHARED, B–16SOUND, B–10Special Devices in A–B VBASIC,4–1#9 User Status Display, 4–15Barcode Scanners, 4–4Re
With offices in major cities worldwide.WORLD HEADQUARTERSAllen-Bradley1201 South Second StreetMilwaukee, WI 53204 USATel:(414) 382–2000Telex:43 11 016
A–B1Chapter1–1Introduction to BASICThe BASIC Language Development Kit (Catalog No. 2708-NBD) softwareconsists of BASIC source files which you may use
Comentarios a estos manuales