Home

ACS Basic

image

Contents

1. ooooooononnnonononcccnonooo 38 VGACIRCLE centerX centerY radius color esses ener 38 VGAELLIPSE centerX centerY width height color fillcolor eene 39 VGAARC centerX centerY width height startDegrees endDegrees color style 39 VGATEXT x y font style justify onColor offColor expt 40 VGAPOLYGON coordsX coordsY color Dlleolor 40 VGABITMAP upperX upper Y path oer pne ce ere Pet ERR D Rege E 41 VGABLIT destPage destUpperX destUpperY width height srcPage srcUpperX srcUpperY opcode as 42 CopyrightO 1992 2010 by ACS Sarasota Florida 5 ALL RIGHTS RESERVED ACS Basic User s Manual lp e 43 EXPIreSSlONS 2s 45 ele TEE 45 ASG CMAN EE 45 ABS OeXpr A A ee etenit 45 IK e el EE 45 Ee EE 45 ER OO 45 EA A LY OL NE PHI YO RONG IHR CONO 46 FIND var Search 46 EMTS fmt explain 47 GETGH expt RN 48 INSERT S varb Start var2ft ccccccccscsssseseescscsessssesesscecscsesscsesesesscsesssesssececsesssssassececsesseseaseeceesenees 48 kEFTS var len ss dose AE cede TW OIA a A 48 WEN Vd e edo de SE ee 48 MID var start en 48 MULDIV number multiplier divisor essere enne 48 MULMOD number multiplier divisor eesssseeneeeernnrnn nennen 49 RGB red green blueh sete
2. IF MID K 0 IF MID K 0 RETURN REM R command K THEN 8050 1 1 R THEN 8025 GOSUB 7005 RETURN REM K commands k ASC MID K 2 1 ASC 0 ON k GOTO 8100 8200 8300 8400 8500 8600 8700 RETURN REM K30 left most key RETURN CopyrightO 1992 2010 by ACS Sarasota Florida 61 ALL RIGHTS RESERVED 8199 REM K31 mid left key 8200 RETURN 8299 REM K32 mid right key 8300 RETURN 8399 REM K33 right most key 8400 RETURN 8499 REM K34 down arrow key 8500 LIF s lt n amp s lt 7 THEN s s 1 GOTO 8510 8505 IF n gt s 8 b s lt n 2 THEN b b 1 8510 GOSUB 7005 8515 RETURN 8599 REM K35 up arrow key 8600 LIF S gt 0 THEN s s 1 GOTO 8610 8605 IF b gt 0 THEN b b 1 8610 GOSUB 7005 8615 RETURN 8699 REM K36 enter key 8700 SOUND SOUND s RETURN ACS Basic User s Manual Running the program while connected to the PC with Hyperterminal using the above cable produces the following text Notice the ACS LCD 128x64 commands delimited with the ASCII SOH 01 ETX 03 characters run CFF007F CFFOO7F PO100420TWO WAV P0200410THREE WAV P04004100NE WAV P0800410FIVE WA V P1000410SIX WAV P2000410SEVEN WAV P4000410EIGHT WAV P8000410NINE WAV Renaming the program to CFSOUND BAS and placing it along with the requisite sound files onto the CF card will turn your CFSound 3 into a Jukebox with LCD display Here s the entire program 1 REM 2 REM LCD Jukebox Demo 3 REM 10
3. Type Error Some examples LET a0 240 100 Z9 Test TIMER 240 Copyright 1992 2010 by ACS Sarasota Florida 20 ALL RIGHTS RESERVED ACS Basic User s Manual LIF test THEN statement statement Program mode only Long IF all statements to end of line The expression fest is evaluated and if non zero all statements to the end of the current program line are executed 20 LIF CLOSURE 24 1 THEN PRINT 25 closed GOSUB 100 CLOSURE 24 0 30 GOTO 20 Multiple conditions can be tested at the same time by combining two or more fest expressions with the logical AND OR operators 20 LIF A AND CLOSURE 24 1 THEN PRINT 25 closed GOSUB 10 CLOSURE 24 0 30 GOTO 20 LIST start end LIST start end Direct mode only List program lines to the serial port May also specify a starting and ending line number to limit the range of lines that are displayed A double escape sequence will stop the portion of the file display not already queued LIST N start end LIST N start end Direct mode only List program lines to open file N 0 9 May also specify a starting and ending line number to limit the range of lines that are displayed A double escape sequence will stop the portion of the file display not already written LOAD path Program or Direct mode Load an ACS Basic program from a Compact Flash file specified by path The full path to the program file must be specified and mus
4. 1 opojojw The bitwise exclusive or operator sets a one in each bit position where its operands have different bits and zero where they are the same This can be used to toggle specific bits by ing a value with the bits to toggle So the value 1234 with 255 is 1069 Decimal 15 14 13 12 11 10 1234 0 0 0 0 0 1 4255 0 0 0 0 0 0 1069 0 0 0 0 0 1 0 ojoje 4 1 1 olojo Crit G rt EN 5 0 1 1 3 0 1 1 coc t 0 0 1 1 ol 0 The bitwise lt lt and gt gt perform left and right shifts of their left operand by the number of bit positions given by their right operand which must be positive Vacated bits on the right are filled by zeroes vacated bits on the left are filled with the value of the sign bit The bitwise lt lt shifts the bits towards the left from LSB towards MSB filling in the vacated LSB positions with zero bits Thus 1234 lt lt 2 4936 Decimal 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1234 0 0 0 0 0 1 0 0 1 1 0 1 0 0 1 0 lt lt a lt lt lt lt lt lt lt lt lt lt lt lt lt lt lt lt lt 0 0 4936 0 0 0 1 0 0 1 1 0 1 0 0 1 0 0 0 The bitwise gt gt shifts the bits towards the right from MSB towards LSB
5. 1 DEST INVERT Inverts the destination rectangle 2 NOT SRC COPY Copies the inverted source rectangle to the destination Combines the colors of the source and destination rectangles using NOT SEC ERASE the Boolean OR operator and then inverts the resultant color Combines the colors of the source and destination rectangles by EE using the Boolean AND operator 5 SRC_COPY Copies the source rectangle directly to the destination rectangle Combines the inverted colors of the destination rectangle with the j EE colors of the source rectangle by using the Boolean AND operator Combines the colors of the source and destination rectangles by 7 SRC_INVERT using the Boolean XOR operator Combines the colors of the source and destination rectangles by 8 SRC_PAINT using the Boolean OR operator 9 WHITENESS Fills the destination rectangle with OxFFFF value pixels WHITE 10 SRC BLACK MASK Copies non black CG 0x0000 pixels from the source rectangle to the destination CopyrightO 1992 2010 by ACS Sarasota Florida 42 ALL RIGHTS RESERVED ACS Basic User s Manual Operators ACS Basic supports the following operators listed in priority from highest to lowest Operators encountered during statement execution are evaluated in order of priority with higher priority operators executed before lower priority operators Operators work between a left and right operand unary operators only work on a right following operand MIN Iogaim EA p
6. Notes OE Corrected lockup bug with FIND function Corrected Syntax Error in INPUT N statements when end of file N is reached Added FINPUT N statement Corrected FREAD and FINPUT statements to give Out of Data error if they run out of data in the file N before all of the 8 27 08 variables are assigned values Added three new error codes Added LCDADDRESS specialvar Added additional error descriptions following the line number for some Syntax errors Added LCDTYPE specialvar to affect operation of LCDx statements and provide support for ACS LCD320x240 on serial port 1 18 12 09 08 Internal development version for DMX testing Added SOUNDFRAMEPRESCALER and SOUNDFRAMESYNC specialvars Fixed 49 2 10 09 syntax error display of Expected x to correct the display of anticipated keyword tokens 2 25 09 Added delay after setting DMXRESET to allow DMX CPU time to reset Added support for new Video Graphics Adaptor Adaptor VGAx ER 9 03 09 specialvars and VGAx statements Added SIN COS and RGB functions Corrected ONERROR GOTO statement to allow it to be disabled by specifying a zero line number Changed RUN statement to support optional line number or filename to 12 02 09 be LOADed and RUN Fixed REName command failure when new filename contains a Basic keyword 12 04 12 04 09 Updated RTC variables in RTC_Init so that time specialvars are correct when program starts 8 18 10 Added ability to protec
7. or attached ANSI terminal and may be invoked in PRINT commands by embedded the required ANSI character sequence in the PRINT statement s text Backspace BS Value ASCII 8 decimal 08 hex Receipt of this character causes the display to move the cursor one position to the left and over write any displayed character with a blank space This ANSI control character may be issued using the PRINT CHR 8 statement Horizontal Tab HT Value ASCII 9 decimal 09 hex Receipt of this character causes the display to move the cursor right to the next tab stop Moving past the rightmost tab stop causes the cursor to move to the beginning of the following line with display scrolling up if the cursor was on the last line There are 9 tab stops per line at positions 4 8 12 16 20 24 28 32 and 36 This ANSI control character may be issued using the PRINT CHR 9 statement Line Feed LF Value ASCII 10 decimal OA hex Receipt of this character causes the display to move the cursor down to the next line in the same column A carriage return CR character is automatically prepended The display will scroll up if the cursor was on the last line This ANSI control character may be issued using the PRINT CHR 10 statement Vertical Tab VT Value ASCII 11 decimal OB hex Receipt of this character causes the display to move the cursor down to the next line in the same column The display will scroll up if the cursor was on the last li
8. 2 and A 2 3 evaluate correctly Changed bitwise to Added NOT operator Added ERRS function to return string representation of last error number Added FINSERT N and FDELETE N commands Corrected DEL REN and MD commands to allow use in programs Added INSERTS and REPLACES commands Corrected LIF to return syntax error if line appears after THEN E EN E 7 31 07 Conditionalized contact closure and opening processing in BasicTimer Process to only set the event and remove the closure if there is an event handler defined to allow the use of CLOSURE and OPENING in a program without an event handler Increased stream I O buffer size from 512 to 32256 bytes to speed up 10 30 07 program loading and file I O statements Added escape detection to terminate TYPE command output Added MULMOD function Corrected PORT and PORT2 special variables to update the OutputContacts as well if the port number is lt 2 Added call to flush uart tx queue in Basic Process if escape Sequence is detected to interrupt long program amp type command output Added DMXxxxx specialvars Fixed bug in ORDER statement not finding the referenced DATA statement Added DMXANALOG specialvars Corrected a race condition that caused SOUNDS events to be missed 9 24 07 11 27 07 4 22 08 4 22 08 CopyrightO1992 2010 by ACS Sarasota Florida 70 ALL RIGHTS RESERVED ACS Basic User s Manual Version Date
9. 34 LCDPRINT row s col font type justify expr GLCDTYPE O eee 34 LCDPRINT rowstart col font type justify expr ELCDTYPE 1 seen 34 LCDUNPRINT rowf s col font type justify expr OGLCDTYPE O seen 34 LCDUNPRINT rowstart col font type justify expr LCDTYPE 1 eee 34 LCDCLEAR rowf s colstart colend ESLCDTYPE 0 sss ener nnne 34 LCDCLEAR rowstart rowend colstart colend ol CDTVPE I 34 LCDGRAPHIC row s col data GLCDTYPE O only 34 LCDLINE startx starty endx endy color 34 LCDBOX corner1x cornerl y corner2x corner2y color ooocononccconoccnonaconcncnonaconononnnncnnn noo nncnnn nro nennen 34 LCDPIXBLE x y colot eret te treten e ere pete ete E ee Et arte I Pes 34 LGCDCIRCLE X y radius color OD rtt ERE DRE RR OE HER arose 34 ECDTONE frequency duration eie rri re e i e e oe ide odes 34 ECDSAVE pdge ne once URP D it hte eee iens 35 ECDRESTORE page eco reet er D EXER He ERE EE ER EORR Erie PEU IEEE cidcid Eds 35 LCDBITMAP startrow col path 35 VGAX Statements cente nte pet bete ie eite o rette UU SR Uie mie ee 36 VGACLIPRECT topLeftX topLeftY bottomRightX bottomRightY sse 37 VGAPIXEL x y colot p eoo nae epe te tpe DDR E aS eB ES 37 VGA Color ou dA ute odti epu elei Pih 37 VGALINE startX start Y endX endY color 37 VGABOX corner1X cornerl Y corner2X corner2Y color fillcolor
10. 40 00 65 41 01 A 66 42 02 B 67 43 03 C 68 44 04 D 69 45 05 E 70 46 06 F 71 47 07 G 72 48 0 H 73 49 1 I 74 4A 2 J 75 4B 3 76 AC 4 L 77 4D 5 M 78 4E 6 N 79 Ap 7 o 80 50 20 P 81 51 21 Q 82 52 22 R 83 53 23 S 84 54 24 T 85 55 25 U 86 56 26 v 87 57 27 W 88 58 30 X 89 59 31 Y 90 5A 32 Z 91 5B 33 92 5C 34 N 93 5D 35 94 5E 36 95 5F 37 E 96 60 40 97 61 41 a 98 62 42 b 99 63 43 c 00 64 44 d 01 65 45 e 02 66 46 f 03 67 47 g 04 68 50 h 05 69 51 i 06 6A 52 j 07 6B 53 k 08 6C 54 1 09 6D 55 Im 10 6E 56 n 11 6F 57 o 12 70 60 p 13 SEI 61 q 14 72 62 r 15 73 63 s 16 74 64 t Copyright 1992 2010 by ACS Sarasota Florida 73 ACS Basic User s Manual ALL RIGHTS RESERVED 17 75 65 u 18 76 66 v 19 77 67 w 20 78 70 x 21 79 71 y 22 7A 72 z 23 7B 73 24 7C 74 25 7D 75 26 7E Te ics 27 TE 77 E CopyrightO 1992 2010 by ACS Sarasota Florida 74 ACS Basic User s Manual ALL RIGHTS RESERVED ACS Basic User s Manual PS 2 ANSI Character Sequences If the optional CFSound 3 VGA module is installed the IBM PS 2 keys are translated into the follow ANSI character sequences PS 2 Key ANSI Function Decimal Character Sequence Enter Carriage Return 13 End Cursor End 27 91 75 Cursor Left 27 91 68 Home Cursor Home 27 91 72 l Cur
11. back Female from back Female from back 12VDC Power Supply The program captures a directory listing of the WAN files present on the flash card and displays this listing on the LCD display The Up and Down arrows on the membrane switch scroll the selection shown in inverse font Pressing the Enter key between the arrows plays the current selection Several subroutines are used to simplify the main program logic Here s how it works The program starts by clearing the LCD display and installing an event handler for the MSG special variable 1 REM 2 REM LCD Jukebox Demo 3 REM 10 REM clear display install msg handler 15 LCDCLEAR 255 0 127 25 ONEVENT MSG GOSUB 8005 The ACS LCD Display frames its sent messages in a SOH ETX character pair which is the default value of the SOM and EOM special variables When the program is running and not processing a Basic INPUT statement characters received on the CFSound s serial port are processed looking for an SOM EOM delimited message string When such a message is detected the MSG variable receives the content of the message and the MSG event handler is signaled This causes program execution to GOSUB to line 8005 after the current statement is finished Next the program generates a file that contains the directory of WAV files present on the flash card and then displays this list The program then falls into an idle loop waiting for LCD membr
12. calloc calls to minimize memory fragmentation Increased size of the available program memory from 131068 to 524284 bytes Cleared any pending TIMER events upon TIMER assignment Clear pending escapes when RUN command issued Fix SYNTAX ERROR on empty 8 29 07 command line Fixed problem with WAIT statement hanging up due to ONEVENT handling clearing events between statements now only clear events between statements if there is an event handler defined and executed Added EDIT line command Corrected YEAR to return two digit year Corrected the ability to GOTO self AND still process events Corrected CONTACT assignments to be active true non zero assignment turns output contact on Corrected ABS function to return correct value Rewrote string handling to be to be similar to numeric expression handling allowing true nesting Change DOW to be read only O Sunday gt 6 Saturday computed from the epoch Thursday January 1 1970 Added VAL to return the numeric value of a string argument Added STRS to return the string representation of a numeric argument Added optional ELSE clause to IF THEN statement Added FOPEN N FREAD N and FWRITE N commands Added QFEOF N EN B ded 9 12 07 Specialvar Removed useless EXIT command Added EXITFOR command to allow exiting to a line from within a for next loop without receiving a nesting error Added AND OR logical operators Corrected operator priority so that statements like A 0 OR A
13. color BLACK default 41 Off color RED 42 Off color GREEN 43 Off color YELLOW 44 Off color BLUE 45 Off color MAGENTA 46 Off color CYAN 47 Off color WHITE PRINT N expr expr Prints one or more expressions to a previously opened file DN 0 23 READ varf var Program mode only Reads data from program statements into variables You MUST issue an ORDER statement targeting a line containing a valid DATA statement before using READ CopyrightO 1992 2010 by ACS Sarasota Florida 30 ALL RIGHTS RESERVED ACS Basic User s Manual RETURN Program mode only Return from a subroutine invoked via a GOSUB statement A return without a prior GOSUB will generate a Stack Error REM Comment the remainder of line is ignored Used to document the operation of the program REN oldfile newfile Renames oldfile to newfile Oldfile and newfile may be constant strings or you can use string variables as the files by concatenating them to empty strings REN O NS In Direct mode the quotes are not required RESQ start end new incr Direct mode only Resequences the program line numbers from start through end beginning with the value of new advancing by incr The default value of start is the first line of the program the default for end is the last line of the program the default for new is 10 and the default for incr is 5 The program is renumbered with all embedded referen
14. current clipping rectangle 5 REM Draw cyan ellipse 10 VGAELLIPSE 320 240 150 75 RGB 255 255 VGAARC centerX centerY width height startDegrees endDegrees color L style Draws an arc using color pixels of width and height centered at coordinates centerX centerY starting at startDegrees through endDegrees optionally styled with one or more style bits clipped to within the current clipping rectangle The starting and ending degree values should be between 0 and 359 degrees 5 REM Draw cyan arc 10 VGAARC 320 240 200 200 0 90 RGB 0 255 255 P width 320 240 0 degrees height 90 degrees Style Name Description 0 Arc Draws filled arc pie segment Chord Draws straight line between start and end angles No Fill Don t fill the arc empty pie segment Edged Draw arc edges outlined pie segment with No Fill Style bits may be combined Aur CopyrightO1992 2010 by ACS Sarasota Florida 39 ALL RIGHTS RESERVED ACS Basic User s Manual VGATEXT x y font style justify onColor offColor expr Draws the value of expr as characters using the font style justify onColor and offColor arguments clipped to within the current clipping rectangle Font Description 0 Small 5 x 7 proportional 1 Medium 9 x 16 proportional 2 Micro 4 x 5 nominal uppercase only 3 Giant Numb
15. down A negative recordnumber seeks to the end of the file before inserting The data items inserted into the file are separated by commas with string values surrounded by double quotes The record is padded with spaces to recordlength including the trailing CR LF character pair which terminates each record The file may be viewed using the TYPE command FDELETE N recordnumber Removes fixed length record recordnumber 0 lt recordnumber lt 32767 on file N 0 23 opened by FOPEN N using a temporary file FDELETE TMP Copyright 1992 2010 by ACS Sarasota Florida 19 ALL RIGHTS RESERVED ACS Basic User s Manual GOSUB line Program mode only Calls a subroutine that starts at line and ends with a RETURN statement A subroutine consists of a group of program statements that start at a certain line number and end in a line with a RETURN statement To call the subroutine from your program use the GOSUB statement which transfers program execution to the specified line number and executes those program statements until it executes a RETURN statement Upon execution of the RETURN statement program execution continues at the statement after the GOSUB The maximum number of nested FOR NEXT loops and GOSUBs is currently 50 GOTO line Program mode only Program execution continues by jumping to line IF test THEN line statement ELSE line2 statement2 Program mode only Conditional execution jump The expression fest is evaluated and
16. if non zero program execution continues at line or the single statement is executed If the optional ELSE clause is present and the fest expression evaluates to zero program execution continues at line2 or the single statement2 is executed Some IF statement examples 10 IF A 0 THEN 100 20 IF A 1 THEN GOTO 200 30 IF A 0 THEN PRINT A was zero ELSE 100 40 IF A 1 THEN PRINT A was zero ELSE PRINT A non zero Multiple conditions can be tested at the same time by combining two or more fest expressions with the logical AND OR operators 20 IF A 1 AND B 2 THEN PRINT Both A and B are correct 30 IF A 1 OR B 2 THEN PRINT Either A or B is correct ELSE PRINT Neither A or B INPUT var Get value for variable from the serial port INPUT prompt var Get value of variable from the serial port with prompt Prompt may be a constant string or you can use a string variable in the prompt by concatenating it to such a string INPUT A B INPUT N var Get value for variable from file N 0 23 Note that when an end of file occurs the variable will have its last value Test the FEOF N specialvar to detect this condition LET Jvar expr default statement Program or Direct mode Sets variable expression This is the default statement so the LET keyword is not required An attempt to assign a string value to a numeric variable or a numeric value to a string variable will generate a
17. key LIF s n amp s 7 THEN s s 1 GOTO 8510 IF n gt s amp b s lt n 2 THEN b b 1 GOSUB 7005 RETURN REM K35 up arrow key LIF S gt 0 THEN s s 1 GOTO 8610 IF b 0 THEN b b 1 GOSUB 7005 RETURN REM K36 enter key SOUND SOUND s RETURN CopyrightO9 1992 2010 by ACS Sarasota Florida 63 ACS Basic User s Manual ALL RIGHTS RESERVED ACS Basic User s Manual Fixed Length Record File LO Here s a short demonstration of the FOPEN FREAD and FWRITE commands 5 DEL test dat 10 FOPEN 1 20 test dat 15 INPUT how many records n 20 FOR r 0 TO n 1 30 FWRITE 1 r r str STR r 40 NEXT r 50 PRINT reading records 60 r 0 70 FREAD 1 r b b 75 IF FEOF 1 THEN 1000 80 PRINT rec r b b 90 r r 1 GOTO 70 1000 CLOSE 1 Ready run how many records 10 reading records rec 0 0 stro rec 1 1 str1 rec 2 2 str2 rec 3 str3 rec 4 str4 rec 5 str5 rec 6 6 str6 rec 7 7 str7 rec 8 8 str8 rec 9 9 str9 Ready type test dat 0 stro 1 str1 2 str2 3 str3 4 str4 5 str5 6 str6 7 str7 8 str8 9 str9 Ready CopyrightO1992 2010 by ACS Sarasota Florida 64 ALL RIGHTS RESERVED ACS Basic User s Manual Error Logging While developing programs without a serial connection or for stand alone program monitoring it may be advantageous to record any program errors that occur to the CF card Then when the program
18. length The 260 Numeric variables are named A0 gt A9 Z0 Z9 The 260 Numeric Array variables are named A0 A9 Z0 Z9 Array variables must be DIMensioned using the DIM statement before use The 260 Character variables are named A0 A9S Z0 Z9 The 260 Character Array variables are named A0 A9S Z0 Z9 Array variables must be DIMensioned using the DIM statement before use Note that the zero suffix variables may be referenced by their letter name only so that A is equivalent to AO Z is equivalent to Z0 etc CopyrightO 1992 2010 by ACS Sarasota Florida 8 ALL RIGHTS RESERVED ACS Basic User s Manual Special Variables ACS Basic also has built in special variables Special variables are denoted by a character as the first character of the variable name The special variable names are tokenized when entered to save program memory and speed program execution for example the special variable SECOND would be tokenized to two bytes instead of seven bytes Special variables may not be assigned a value by appearing in an FOR DIM INPUT READ FINPUT N or FREAD N statement Some special variables are read only and may not appear on the left hand side of a LET assignment statement Some special variables have Events associated with them and may be referenced in ONEVENT SIGNAL and WAIT statements See the description for the individual special variables and
19. oe ok ade ade ade ade ade ale ale ale REM Now create fixed recordlength file of filenames found REM Add ok ONERROR GOTO 180 DEL WAVLIST TXT ONERROR GOTO O FOPEN 1 16 WAVLIST TXT FOR F 0 TO N 1 INPUT 0 L W FIND L WAV F LEFT L W 4 FWRITE 1 F F NEXT F CLOSE 0 CLOSE 1 FOPEN 1 16 WAVLIST TXT REM 6 8 ak ae 28 2 2 Oak REM Now fade down turn off line input restore volume and play random sound REM xke ak ak k ak ak 3k 3K ak k 2k ak 3k 3K ak k 2K ak 3k 3K ak F 2K ak 3K 2 K k 3K ak K 3 K F 2K K K 3 K K 2K 3k K 3 K K 3K K K 2 K 3K 3K K K 3 K 3K 2K K K 3K K 3K 2K K GOSUB 500 LINEIN 0 NSVOL V FREAD 1 RND N F ONERROR GOTO 280 PLAY F ONERROR GOTO O REM xke oe oe eee eoe oe eoe oe oe ee keokekeokekekekekekekekekekekekekekekekekekeke REM Now minimize volume turn on line input fade up and wait for time delay REM xke ak ak 3k 3k ak k aK ak 3k 3 ak k 3K ak 3k 3K ak k 2K ak K 2K aK K 3K K K 2 aK K 3K K K 3 K k 3K 3k K 3 K F 2K K K 3 K K 3K K K 3 K 3K 3K K K 2K K K 2K K ANSVOL 0 LINEIN 1 GOSUB 550 FOR T 1 TO M DELAY 3000 NEXT T GOTO 240 REM xke ak 3k ak ak 3k ak ak 3 ak ak 3k ak ak 3K ak 3k 3K aK ak 3K ak k 3K K K FK K K K REM Fade down volume from current setting REM 828 5 k ak ak 2 2 ak 3k ak ak 3k ak ak eee ak ak 3K ak ak 3K EE OE K EO K K V VOL FOR T V TO 0 STEP 1 NSVOL T DELAY 2 NEXT T RETURN REM 8
20. special variable allows the ACS Basic program to determine when an end of file has occurred after an FOPEN N INPUT N FREAD N or FINPUT N statement Optionally an event handler specified with the ONEVENT statement may be activated upon an end of file occurring SECOND MINUTE HOUR DOW DATE MONTH YEAR These special variables allow the ACS Basic program to access the Real Time Clock Calendar Writing one of these variables except SECOND stops the clock and updates the associated value Writing to the SECOND variable updates the value and starts the clock running The values of these variables are updated once per second Whenever one of the values of these variables changes any associated event handler specified with the ONEVENT statement is activated See the Setting the Real Time Clock sample program in the Examples section for more information SECOND 00 lt seconds lt 59 MINUTE 00 lt minutes lt 59 HOUR 00 lt hour lt 23 DOW 0 lt day of week lt 6 read only O Sunday DATE 1 lt date of month lt 31 MONTH 1 lt month of year lt 12 YEAR 00 lt year lt 99 SOUND The GSOUNDS special variable allows the ACS Basic program to queue sound files for playing Queued sound files are played in the order that they were queued being removed as they are played A sound is queued by assigning the string value of the sound filename to the variable The currently playing soun
21. stops running the CF card can be inserted into a PC card reader and the error that caused the program to stop can be examined The following code sets up ONERROR to transfer control to line 32000 where an ERRORS TXT file is opened for appended writing and the causal error message is written at the end of the file 10 REM Error Logging Example 20 ONERROR GOTO 32000 30 A B 0 32000 OPEN t0 ERRORS TXT aw 32005 PRINT 0 ERR 32010 CLOSE 0 32015 STOP Ready run STOP in line 32015 Ready type errors txt Divide by zero error in line 30 Ready run STOP in line 32015 Ready type errors txt Divide by zero error in line 30 Divide by zero error in line 30 Ready CopyrightO 1992 2010 by ACS Sarasota Florida 65 ALL RIGHTS RESERVED ACS Basic User s Manual DMX Control Synchronized to Sound This example plays an audio file for an exhibit at the Alamo Museum in San Antonio Texas The CFSound III with DMX module synchronizes the fading up down of the house lights and scene lights with the audio track Here s how it works The show is started by pressing a button connected to the Contact 25 input The show stops by pressing a button connected to Contact 26 or when the show s sound file ends The ESOUNDFRAMEPRESCALER specialvar is set to 50 This causes a SOUNDFRAMES YNC event to fire every second while the sound is playing The subroutine at line 1000 is executed every time this happens and uses the one second
22. the Events section below for more information TIMER x The TIMER x special variables allow the ACS Basic program to measure or control time intervals There are ten timers permissible values for x are 0 through 9 Setting the variable to a non zero value activates the timer The value in the timer variable is decremented every 20mSEC 50 Hz until it reaches zero Upon reaching zero any associated event handler specified with the ONEVENT statement is activated PORT x PORT2 x The PORT x and PORT2 x special variables allow the ACS Basic program to access I O ports There are 256 eight bit ports permissible values for x are 0 through 255 Setting the variable to a value writes the value to the I O port x Reading the variable returns the value from the I O port x Note that ports O 1 and 2 are consumed by optional installed CFSound 3 Contact I O modules 9CONTACT x The ECONTACT x special variables allow the ACS Basic program to access CFSound 3 contacts There are up to 56 contact inputs and up to 16 contact outputs depending upon what optional modules have been installed on the CFSound 3 permissible values for x are 0 through 55 Setting the variable to a 1 activates output contact x Reading the variable returns the value from the input contact x CLOSURE x The CLOSURE x special variables allow the ACS Basic program to access CFSound 3 contact events There are up to 56 contact inputs dependin
23. the Windows image BMP or JPG format file at path to the screen coordinate upperX upperY clipped to within the current clipping rectangle Windows bitmap files of 1BPP 4BPP 8BPP or 24BPP are supported Windows JPEG files that are sequential sRGB YUV420 encoded are supported The entire file has to be read into the CFSound III memory for processing and rendering so the file size is limited to approximately 2MB Larger files load and display slower dir shuttle bmp SHUTTLE BMP 2 085 942 A 11 12 2009 15 27 40 1 files 0 directories vgamode 3 Ready vgabitmap 0 0 shuttle bmp Ready Copyright 1992 2010 by ACS Sarasota Florida 41 ALL RIGHTS RESERVED ACS Basic User s Manual VGABLIT destPage destUpperX destUpperY width height srcPage srcUpperX srcUpperY opcode Transfers pixels from a source drawing page and rectangle to a destination drawing page and rectangle altering the pixels during the transfer according to the opcode value The pixel destination is specified by the destination drawing page destPage and destination rectangle destUpperX destUpperY width and height The pixel source is specified by the source drawing page srcPage and source rectangle srcUpperX srcUppery width and height During the transfer the pixels are altered according to the specified opcode opcode Name Description 0 BLACKNESS Fills the destination rectangle with 0x0000 value pixels BLACK
24. the computed row bit number and the line is printed on the LCD display REM REM Display file list on LCD REM LCDCLEAR 255 0 127 0PEN 0 WAVES TXT r FOR i TO b INPUT 0 1 NEXT i FOR i 0 TO 7 INPUT 0 1 t LEFT 1 FIND 1 t 1 LIF i s THEN t 2 s t r 1 lt lt i LCDPRINT r 0 4 t 0 t NEXT i CLOSE 0 RETURN The EMSG event handler subroutine is called whenever a delimited message string has been received from the LCD display The handler captures the received MSG into the k variable freeing the special variable to receive another message The received message is then parsed to see if a LCD Reset message or Keypress message has been received Display reset messages simply refresh the display Keypress messages are further decoded to determine which key was pressed on the display and are dispatched to corresponding code fragments for processing Currently only 3 keys are handled the Up and Down arrows and the Enter key between them The Down arrow key advances the selection variable s to the bottom of the display then advances the display skip lines variable b as required redrawing the display The Up arrow key decrements the selection variable s to the top of the display then decrements the display skip lines variable b as required redrawing the display The Enter key stops any currently queued sound that is playing and starts the selected sound playing REM REM LCD received message handler REM k MSG
25. the program to see when the event occurs In order to process an event asynchronously Basic has to be informed of what code to execute when a certain event occurs This is done using the ONEVENT statement After Basic executes each program statement it scans the table of events looking to see if any have been signaled If an ONEVENT handler for a signaled event has been specified by the program then Basic will force a subroutine call to the event handler before the next program statement is executed Events have an implicit priority with higher priority events being able to interrupt execution of lower priority event handlers Here s an example of an event handling a closure on Contact 25 contact numbers start at zero 10 REM setup event subroutine for when contact 25 closes 15 ONEVENT CONTACT 24 GOSUB 100 20 REM do whatever here 25 GOTO 20 100 REM contact 25 closed event 105 PRINT CONTACT 25 closed 110 RETURN This would print CONTACT 25 closed whenever Contact 25 closes In order to handle an event synchronously a program may wait for an event to occur by using the WAIT statement Program execution stalls at that statement until the specified event happens Alternatively the program may poll the associated special variable s value in a loop looking for the event to have been signaled Here s an example of polling for a closure on Contact 25 10 REM poll contact 25 closures 15 IF ACONTACT 24 1 THEN 100 2
26. was on the last line This ANSI control character sequence may be issued using the PRINT CHR 27 D statement Cursor Down to column 1 ESC E Values ASCII 27 69 decimal 1B 45 hex Receipt of this character sequence causes the display to move the cursor down to the next line and the first column The cursor will not move and the display will not scroll up if the cursor was on the last line This ANSI control character sequence may be issued using the PRINT CHR 27 E statement Cursor Up ESC M Values ASCII 27 77 decimal 1B 4D hex Receipt of this character sequence causes the display to move the cursor up to the previous line in the same column The cursor will not move if the cursor was on the first line This ANSI control character sequence may be issued using the PRINT CHR 27 M statement ANSI Escape Sequences ESC Values ASCII 27 91 decimal 1B 5B hex Receipt of this character sequence causes the display to attempt to decode one or more of the following characters as an ANSI control sequence These sequences can have or more parameters that are expressed as decimal numbers separated by a semicolon The absence of a parameter in a control sequence that accepts a single parameters causes it to assume a default parameter value of one ESC D is the same as ESC 1D The absence of a parameter in a control sequence that accepts two or more parameters causes it to assume a default parameter va
27. 0 VGA Display of Seconds on top of a bitmap This example draws the seconds on top of a background bitmap on the CFSound III optional VGA display Here s how it works The VGA auto update is turned off in line 10 In line 40 a bitmap is loaded into the second drawing page In lines 50 and 55 the bitmap is copied back to drawing page 0 using the VGABLIT command and the VGA graphics page is updated to display it An event handler for the 9 SECOND specialvar is defined in line 60 Whenever the SECOND changes once per second the subroutine starting at line 1000 is called The program then loops forever at line 70 When the SECOND event handler fires the portion of the bitmap that will be overwritten is copied from where it was loaded into drawing page 1 to drawing page 0 Then the current value of the SECOND variable is printed out on top of it using a white color with a style of no offColor pixels drawn The VGA graphics page is then updated from the current drawing page and the subroutine returns 10 REM Blit demo 20 VGAAUTOUPDATE 0 30 REM load background bitmap 40 VGADRAWPAGE 1 VGABITMAP 0 0 test4 bmp AVGADRAWPAGE 0 50 VGABLIT 0 0 0 640 400 1 0 0 5 55 VGAUPDATEPAGE 0 60 ONEVENT SECOND GOSUB 1000 70 GOTO 70 1000 REM second event handler 1010 VGABLIT 0 100 100 100 16 1 100 100 5 1020 VGATEXT 100 100 1 2 3 RGB 255 255 255 SECOND 1025 VGAUPDATEPAGE 0 1030 RETURN CopyrightO1992 2010 by ACS Sarasota
28. 0 500 120 RETURN For the quarter past half past and three quarter past periods the handler queues the appropriate note sequences to be played and returns For the top of the hour the handler queues the note sequences and then queues the chime sound a number of times to match the hour It then returns 200 REM play whole sequence amp chime hour 202 SOUND SEQ_CEDG WAV 204 SOUND SEQ CDEC WAV 206 SOUND SEQ ECDG WAV 208 SOUND SEQ GDEC WAV 210 h HOUR IF h gt 12 THEN h h 12 211 IF h 0 THEN h 12 212 FOR c h TO 1 STEP 1 215 SOUND HOURS WAV 220 NEXT c 225 RETURN 300 REM play quarter past sequence 305 SOUND SEQ_EDCG WAV 310 RETURN 400 REM play half past sequence 402 SOUND SEQ_CEDG WAV 405 SOUND SEQ_CDEC WAV 410 RETURN 500 REM play three quarters past sequence 502 SOUND SEQ ECDG WAV 504 jSOUND SEQ GDEC WAV 506 SOUND SEQ EDCG WAV 510 RETURN Renaming the program to CFSOUND BAS and placing it along with the requisite sound files onto the CF card will turn your CFSound 3 into a Big Ben clock Here s the entire program 5 REM setup event handler 10 ONEVENT MINUTE GOSUB 100 15 REM wait here for event 20 a 0 GOTO 15 100 REM calculate period and remainder 102 p MINUTE 15 r MINUTE 15 105 REM if remainder 0 then branch on period 110 IF r 0 THEN ON p GOTO 200 300 400 500 120 RETURN 200 REM play whole sequence chime hour 202 SOUND SEQ CEDG WAV
29. 0 REM do whatever here 25 GOTO 15 100 REM contact 25 closed 105 PRINT CONTACT 25 closed clear it 110 CONTACT 24 0 115 REM do whatever here 120 GOTO 15 This would print CONTACT 25 closed clear it whenever Contact 25 closes If you poll for events you have to manually clear them in order to see the next one ONEVENT handling does this clearing automatically The SIGNAL statement may be used in a program to force an event to happen It is very important to note that the ONEVENT handler subroutine executes in the context of the running program it has access to all program variables Since the event handler may be executed at any time in between any program statements care should be used when changing program variables from within an event handler as it may cause unexpected results in the execution of other program statements that may be using and depending upon the values of those same variables Incorrect or unexpected program execution may result code event handlers carefully See the ONEVENT statement definition below for a table showing what events may be processed and listing their relative priority CopyrightO9 1992 2010 by ACS Sarasota Florida 16 ALL RIGHTS RESERVED ACS Basic User s Manual Statements ACS Basic program lines consist of an optional integer line number followed by one or more statements Multiple statements on a line are allowed separated by a colon Only the f
30. 10 BS backspace 9 09 011 TAB horizontal tab 0 0A 012 LF line feed new line 1 OB 013 T vertical tab 2 DC 014 FF form feed new page 3 OD 015 CR carriage return 4 0E 016 SO shift out 5 OF Oly SI shift in 6 0 020 DLE data link escape 7 1 021 DC1 device control 1 8 2 022 DC2 device control 2 9 3 023 DC3 device control 3 20 4 024 DC4 device control 4 21 5 025 NAK negative acknowledge 22 6 026 SYN synchronous idle 23 7 027 ETB end trans block 24 8 030 CAN cancel 25 9 031 EM end of medium 26 A 032 SUB substitute 27 B 033 ESC escape 28 G 034 FS file separator 29 D 035 GS group separator 30 E 036 RS record separator 31 F 037 US unit separator 32 20 040 Space 33 21 041 34 22 042 2 35 23 043 36 24 044 37 2h 045 38 26 046 amp 39 27 047 40 28 050 41 29 051 42 2A 052 43 2B 053 44 20 054 5 45 2D 055 5 46 2E 056 d 47 2F 057 48 30 060 0 49 31 061 1 50 32 062 2 51 33 063 3 52 34 064 4 53 35 065 5 54 36 066 6 55 37 067 7 Copyright 1992 2010 by ACS Sarasota Florida 72 ACS Basic User s Manual ALL RIGHTS RESERVED 56 38 070 8 57 39 071 9 58 3A 072 59 3B 073 i 60 3C 074 lt 61 3D 075 62 3E 076 gt 63 3F 077 64
31. 10150 F1 I1 QTIMER 1 2 RETURN IF F1 gt M1 4 THEN F1 F1 4 ELSE F1 M1 DMXDATA C1 F1 LIF F1 lt gt M1 THEN TIMER 1 2 RETURN ONEVENT TIMER 1 GOSUB 0 RETURN REM Fadeup all channels except house ONEVENT TIMER GOSUB 11050 FO 0 ATIMER 0 2 RETURN IF F0 255 4 THEN FO F0 4 ELSE F0 255 FOR C9 1 TO 31 DMXDATA C9 FO NEXT C9 LIF F0 255 THEN TIMER 2 RETURN ONEVENT TIMER GOSUB 0 RETURN REM Fadedown channels S1 gt E1 ONEVENT TIMER 1 GOSUB 11150 F1 255 ATIMER 1 2 RETURN IF F1 gt 0 4 THEN F1 F1 4 ELSE F1 0 FOR C9 S1 TO E1 DMXDATA C9 F1 NEXT C9 LIF F1 0 THEN TIMER 1 2 RETURN ONEVENT TIMER 1 GOSUB 0 RETURN CopyrightO1992 2010 by ACS Sarasota Florida 67 ALL RIGHTS RESERVED ACS Basic User s Manual Play Random Announcement Periodically This example allows the CFSound III to periodically interrupt a music source playing through the line input and play a random pre recorded announcement The CFSound III line input is connected to the music source and the line output is connected back into the distribution amp if required or the built in amplifier can be used to power the speakers Here s how it works When the program is started lines 40 60 capture a directory listing of WAV files into a text file DIRLIST TXT on the CF card Lines 70 150 count the number of WAV files that were found Lines 170 230 create a fixed length record file of these WAV filenames into a file WAVLIST TXT
32. 1090 REM XCastenada 1095 LIF S 313 THEN C1 7 11 255 M1 0 GOSUB 10100 C0 8 10 0 M0 255 GOSUB 10000 RETURN 1100 REM norCasten 1105 LIF S 326 THEN C1 8 11 255 M1 0 GOSUB 10100 C0 9 10 0 M0 255 GOSUB 10000 RETURN 1110 REM Teran 1115 LIF S 350 THEN C1 9 11 255 M1 0 GOSUB 10100 C0 10 10 0 M0 255 GOSUB 10000 RETURN 1120 REM Long Barracks 1125 LIF S 371 THEN C1 10 11 255 M1 0 GOSUB 10100 C0 11 10 0 M0 255 GOSUB 10000 RETURN 1130 REM convent 1135 LIF S 402 THEN C1 11 11 255 M1 0 GOSUB 10100 C0 12 10 0 M0 255 GOSUB 10000 RETURN 1140 REM ConventCourt 1145 LIF S 429 THEN C1 12 11 255 M1 0 GOSUB 10100 C0 13 10 0 M0 255 GOSUB 10000 RETURN 1150 REM SouthCourt 1155 LIF S 438 THEN C1 13 11 255 M1 0 GOSUB 10100 C0 14 10 0 M0 255 GOSUB 10000 RETURN 1160 REM Fortin de Cos 1165 LIF S 482 THEN C1 14 11 255 M1 0 GOSUB 10100 C0 15 10 0 M0 255 GOSUB 10000 RETURN 1170 REM moonlight 1175 LIF S 503 THEN C1 15 11 255 M1 0 GOSUB 10100 C0 16 10 0 M0 255 GOSUB 10000 RETURN 1180 REM 4th column 1185 LIF S 540 THEN C1 16 11 255 M1 0 GOSUB 10100 C0 17 10 0 M0 255 GOSUB 10000 RETURN 1190 REM 1st 2nd columns 1195 LIF S 557 THEN C1 17 11 255 M1 0 GOSUB 10100 C0 18 10 0 M0 255 GOSUB 10000 RETURN 1200 REM 3rd column 1205 LIF S 565 THEN C1 18 11 255 M1 0 GOSUB 10100 C0 19 10 0 M0 255 GOSUB 10000 RETURN CopyrightO1992 2010 by ACS Sarasota Florida 66 ALL RIGHTS RESERVED ACS Basic User s Manual REM Foothold Nor LIF S 588 THEN C1 19 11 255 M1 0 GOSUB C0 20 10 0 M0 25
33. 1234 1 1 1 1 1 0 1 1 0 0 1 0 1 1 1 0 The bitwise unary operator yields the one s complement of its following integer operand that is it converts each 1 bit into a 0 bit and vice versa Thus the value 1234 in binary bit form is Decimal 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1234 1 1 1 1 1 0 1 1 0 0 1 0 1 1 0 1 Note that each bit position in the 1234 is inverted from their 1234 values CopyrightO1992 2010 by ACS Sarasota Florida 43 ALL RIGHTS RESERVED ACS Basic User s Manual The bitwise amp operator is often used to mask off or clear some set of bits This can be used to determine which bits are set by amp ing a value with the mask of the bit to examine So the value 1234 bitwise amp with 255 is 210 Decimal 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1234 0 0 0 0 0 1 0 0 1 1 0 1 0 0 1 0 amp 255 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 210 0 0 0 0 0 0 0 0 1 1 0 1 0 0 1 0 The bitwise operator is used to turn on or set some set of bits So the value 1234 bitwise with 255 is 1279 Decimal 15 14 13 12 11 10 1234 0 0 0 0 0 1 1255 0 0 0 0 0 0 1279 0 0 0 0 0 1 opojojw eo 5 0 1 1 eel l a 3 0 1 1 Ry Ryo Nm 0 0 1
34. 204 SOUND SEQ CDEC WAV 206 ASOUND SEQ_ECDG WAV 208 SOUND SEQ GDEC WAV 210 h HOUR IF h gt 12 THEN h h 12 211 IF h 0 THEN h 12 212 FOR c h TO 1 STEP 1 215 SOUND HOURS WAV 220 NEXT c 225 RETURN 300 REM play quarter past sequence 305 SOUND SEQ_EDCG WAV 310 RETURN Copyright 1992 2010 by ACS Sarasota Florida 58 ALL RIGHTS RESERVED ACS Basic User s Manual 40 REM play half past sequence 402 SOUND SEQ_CEDG WAV 405 SOUND SEQ_CDEC WAV 410 RETURN 500 REM play three quarters past sequence 502 SOUND SEQ_ECDG WAV 504 MASOUND SEQ_GDEC WAV 506 SOUND SEQ_EDCG WAV 510 RETURN CopyrightO9 1992 2010 by ACS Sarasota Florida 59 ALL RIGHTS RESERVED ACS Basic User s Manual Jukebox with Display Turn the CFSound 3 into a jukebox with display using this short program The hardware consists of a CFSound 3 and the ACS LCD 128x64 display with membrane switch wired together with a serial cable If a special cable is constructed the PC can also be connected allowing for interactive software development The following cable allows both the PC and the LCD to talk to the CFSound 3 by using two diodes and a resistor for implement a wired or of the LCD and PC TxD signals This allows the PC to communicate with the CFSound 3 via Window s Hyperterminal accessory and the LCD keystrokes to be sent to the CFSound 3 to interact with the Basic program CFSound 3 LCD PC Female from
35. 5 GOSUB 10000 RETURN REM Low Barrack LIF S 604 THEN C1 20 11 255 M1 0 GOSUB C0 21 10 0 M0 255 GOSUB 10000 RETURN REM Long Barracks LIF S 611 THEN C1 21 11 255 M1 0 GOSUB C0 22 10 0 M0 255 GOSUB 10000 RETURN REM Convent On LIF S 612 THEN C0 23 10 0 M0 255 GOSUB RETURN REM Long Barracks Off LIF S 623 THEN C1 22 11 255 M1 0 GOSUB RETURN REM Bowie s Room On LIF S 642 THEN C0 24 10 0 M0 255 GOSUB RETURN REM Convent Off LIF S 676 THEN C1 23 10 0 M0 255 GOSUB RETURN REM Bowie s Room Off LIF S 645 THEN C1 24 11 255 M1 0 GOSUB RETURN REM Palisade On LIF S 681 THEN C0 25 10 0 M0 255 GOSUB RETURN REM Palisade Off LIF S 686 THEN C1 25 11 255 M1 0 GOSUB RETURN REM Church On LIF S 688 THEN C0 26 10 0 M0 255 GOSUB RETURN REM Dawn LIF S 696 THEN GOSUB 11000 RETURN REM 1 thru 8 off LIF S 710 THEN S1 1 E1 7 GOSUB 11100 RETURN REM 9 thru 14 off LIF S 717 THEN S1 8 E1 13 GOSUB 11100 RETURN REM 15 thru 20 off LIF S 726 THEN S1 14 E1 19 GOSUB 11100 RETURN REM 21 thru 27 off LIF S 735 THEN S1 20 E1 26 GOSUB 11100 RETURN RETURN REM Fadeup house lights others off C0 0 10 DMXDATA 0 M0 255 GOSUB 10000 FOR C9 1 TO 31 DMXDATA C9 0 NEXT C9 RETURN REM Fadeup channel CO from IO to MO ONEVENT TIMER GOSUB 10050 FQ 10 TIMER 2 RETURN IF FQ lt M 4 THEN FO F0 4 ELSE F0 MO DMXDATA C0 FO LIF F lt gt M THEN TIMER 2 RETURN ONEVENT TIMER GOSUB 0 RETURN REM Fadedown channel C1 from I1 to M1 ONEVENT TIMER 1 GOSUB
36. 8 8 k 28 28 28 2 ak k ak ak k OO ke oe ak K OO OO K K OO HK OE REM Fade up volume back to current setting REM 768 k ak ak 2 ak ke ak k aK ak OO OO OO OO OO OK K OK KE FOR T TO V NSVOL T DELAY 2 NEXT T RETURN Copyright 1992 2010 by ACS Sarasota Florida 68 ALL RIGHTS RESERVED ACS Basic User s Manual VGA Display of Random Colored Triangles This example draws random colored triangles on the CFSound III optional VGA display Here s how it works The VGA screen is cleared to black in line 7 Line 10 declares x and y to be dimensioned numeric arrays of three coordinates index of 0 1 and 2 Lines 20 and 30 fill these coordinate arrays with random x and y values that are limited to the current display mode s screen width VGAWIDTH and height VGAHEIGHT The randomly generated triangle is then rendered on the screen in line 40 with randomly generated outline and fill colors using the RGB function A descriptive text label is applied in line 42 and then the screen is updated with the result in line 45 5 REM draw random triangles 7 VGAMODE 0 VGASHOWCURSOR VGAAUTOUPDATE 0 VGAFILL O 10 DIM x 2 y 2 20 x 0 RND QVGAWIDTH x 1 RND QVGAWIDTH x 2 RND VGAWIDTH 30 y RND VGAHEIGHT y 1 RND VGAHEIGHT y 2 RND VGAHEIGHT 40 VGAPOLYGON x y RGB RND 256 RND 256 RND 256 RGB RND 256 RND 256 RND 256 42 VGATEXT 0 QVGAHEIGHT 40 1 2 1 1 0 TRIANGLES 45 VGAUPDATEPAGE 50 GOTO 2
37. A E E EE A 11 OSOM as 11 QO OM EE 12 OD PAT EE EE EE E E E E SE EE E E E E A E 12 RVI A EE 12 HE EC 12 ODINXRESELTI 2 1 c it hr b ro Lor e Decet Ee or pl De athe e Ue e 12 ODMAMASTER o dedere eat 12 QODMXERAMEDPELDA Y tenue E eal bub se dusasesh exiseeete neue eub ixe eue ratus t exi see ete eun 12 EBI RE DN EE 12 A EE 12 EU RRE CERN EE 12 DMXFRAMES Y NC i dad 13 LCDADDRESS EE 13 HR SBA A A EE 13 ASOUNDFRAMEPRESCALER noore soeirresreerroiteeiini etienne itie ieai esiet aa ieie e inei eie tie iiie 13 SOUNDFRAMES Y NG t a e ina 13 VGAMODE a 13 V GABNABLE ee eeh EE E 14 OVOADRA WEA GE eseou ee ee 14 OVGAUPDATERAGE eeh See EE 14 OVGA SHOV PA GE EE Re se eee a ek 14 VGAAUTOUPDATE 2 0 eccccccccccesecesesesevesevevevesevevevevevevesesesesevesereveveveveveveseseseresesesesesesesesesesesesesesesens 14 ON GAWD IT m tad 14 VGAHEIGH is 15 QVGAPRINT ee VERSER QUI AR VIP OUR NER 15 ONOGASHOWCURSOR eee emen eh en en eh inen enin eee e nene eden Ene nene nene ne enne ener enne ene AE 15 EVENTS Ee 16 CopyrightO1992 2010 by ACS Sarasota Florida 3 ALL RIGHTS RESERVED ACS Basic User s Manual Statement EE 17 GIN er EE 17 CLOSE FAN tias teen tette n RU 17 DATA uA temo ieu m ada 17 DEL path tnr re AA era eR GER RE ete ae aed 17 DELAY Me 45 seeded odio eere eitis 17 DIM val Size edi ltd reete rettet ie dee ere eet 17 BAUEN i a P 18 DIR HN path EE 18 IE KREE 18 pa EE 18 ERROR value canem ease UI eie icone 18 EXI
38. ACS Basic User s Manual v1 31 12 31 2010 chnological Evolution 6233 E Sawgrass Rd Sarasota FL 342400 941 377 5775 FAX 941 378 4226 www acscontrol com Ackerman Computer Sciences Copyright O 2002 2010 by ACS Sarasota Florida ALL RIGHTS RESERVED ACS Basic User s Manual Notice This Information or any portion thereof remains the property of ACS The Information contained herein is believed to be accurate and ACS assumes no responsibility or liability for its use in any way and conveys no license or title under any patent or copyright and makes no representation or warranty that this Information is free from patent or copyright infringement ACS warrants that the specified product shall function in accordance with the features of the design for a period of one 1 year from the date of purchase This warranty does not cover any ACS product which has been subjected to any abuse misuse accident act of God alteration or modification not authorized by ACS in writing ACS offers no other warranty either expressed or implied and specifically denies all other warranties including any warranty for merchantability or fitness ACS s sole obligation upon the discovery of any error in the specified product or breach of the warranty in this paragraph shall be to replace or repair the specified product or to correct the design of the specified product Under no circumstances shall AC
39. CDEFGHIJKLMNOPQRSTUVWXYZ 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ EOT Ready CopyrightO1992 2010 by ACS Sarasota Florida 32 ALL RIGHTS RESERVED ACS Basic User s Manual In this incorrect example program execution would lock forever on line 20 since all statements on the same line before the WAIT are executed continuously while waiting Since these statements reload the timer that the WAIT is waiting on the program will never execute past this line 5 REM Wrong use of the WAIT statement 10 PRINT start timer wait timer 20 QTIMER 0 50 WAIT TIMER O 30 PRINT done Ready run start timer wait timer ESC at line 20 Ready CopyrightO9 1992 2010 by ACS Sarasota Florida 33 ALL RIGHTS RESERVED ACS Basic User s Manual LCDx Statements The following LCD commands operate on an ACS LCD display connected to the CFSound 3 serial port that is configured for SOH ETX protocol The commands generate and send formatted strings of ASCII characters that the connected LCD display interprets to perform the operation The proper command formatting for the attached display is controlled by the current value of the LCDTYPE special variable The LCDADDRESS special variable ma
40. FREAD record Out of Range error The data items in the file are separated by commas with string values surrounded by double quotes If the data in the file ends before all of the variables have been assigned values an Out of Data Error occurs Incorrect data formatting in the file can cause a Syntax Error to occur FWRITE N recordnumber var var var Writes ASCII data into fixed length records on file N 0 23 opened by FOPEN N from the list of variables Before the data is written the file is positioned to the desired recordnumber 0 lt recordnumber lt 32767 A negative recordnumber seeks to the end of the file Writing at the current end of file extends the file by the record size Writing past the current of file generates a FWRITE record Out of Range error The data items written to the file are separated by commas with string values surrounded by double quotes The record is padded with spaces to recordlength including the trailing CR LF character pair which terminates each record The file may be viewed using the TYPE command FINSERT N recordnumber var var var Inserts ASCII data into fixed length records on file N 0 23 opened by FOPEN N from the list of variables using a temporary file FINSERT TMP Before the data is inserted the file is positioned to the desired recordnumber 0 lt recordnumber lt 32767 and records in the file after recordnumber are shifted
41. Fay mins Gem Ps compren E Uary Bitwise NOT Ps complement i 7 a Mutiplication division modulus 6 asii string concatenation S wmm AND OR Parenthesis may be used to change or enforce expression execution priority with the innermost grouped parenthesis expression evaluated first The six test relational operators lt gt lt lt gt gt can be used in any expression and evaluate to 1 if the tested condition is TRUE and 0 if it is FALSE The IF and LIF commands accept any non zero value to indicate a TRUE condition Multiple test operators can be combined with the logical NOT AND OR operators and suitable parenthesis There are six operators for bit manipulation amp l lt lt gt gt these may only be applied to integer operands The 16 bit positions in the integer are numbered from right to left starting with O the Least Significant Bit up to 15 the Most Significant Bit or sign bit MSB LSB 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 16 bit Integer value Thus the value 1234 in binary bit form is Decimal 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1234 0 0 0 0 0 1 0 0 1 1 0 1 0 0 1 0 And the value 1234 in binary bit form is Decimal 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
42. Florida 69 ALL RIGHTS RESERVED ACS Basic User s Manual Firmware Revisions 3 1 8 29 06 Changed DisplayProgramListing to add a preceding space to a j secondary keyword if it s preceded by an unsubscripted specialvar Upgrade VDSP toolset from 3 5 to 4 5 Changed MEMORY specialvar to call new heap_space_unused 0 to show program memory left Added BAUD special var Added MULDIV function Added support for string lexicographical relation checking with lt lt gt gt operators Added 1 4 9 20 06 divide by zero checking on and MULDIV function Increased size of available program memory from 4095 bytes to 131068 bytes by moving the heap from L1 to L2 memory Added FIND function Corrected MSG variable events Corrected MID index to be zero based Added LCDx statements to support ACS LCD 128x64 on serial port Added PTT special var Clear CFSound Red LED indicator flashes if 1 11 15 06 RUN command issued 5 11 29 06 Added LCDBITMAP command 2 08 07 Added MUTE special var Un mute amplifier if RUN command issued 8 1 6 25 07 Added PORT2 special var and support functions for new CFSound 3 8 revision 3 Added LINEIN special var Disable line input if RUN command issued Added NSVOL special var that changes the current volume but doesn t save it to NVRAM Corrected syntax error on attempts to access PORT2 special var Corrected LCDBITMAP command memory free calls to be in reverse matching order to
43. GA screen within the clipping rectangle with color 5 REM Clear VGA screen to black 10 VGAFILL O VGALINE startX startY endX end Y color Draws a line consisting of color pixels from startX startY to endX endY coordinates clipped to within the current clipping rectangle 10 VGALINE 20 10 24 14 RGB 255 0 20 10 24 14 CopyrightO1992 2010 by ACS Sarasota Florida 37 ALL RIGHTS RESERVED ACS Basic User s Manual VGABOX corner1X corner1Y corner2X corner2Y color fillcolor Draws a rectangular box from corner1X corner1Y to corner2X corner2Y consisting of 4 lines of color pixels optionally filled with fillcolor pixels clipped to within the current clipping rectangle 5 REM Draw green box filled with blue 10 VGABOX 20 10 25 14 RGB 255 0 RGB 255 20 10 25 14 VGACIRCLE centerX centerY radius color Draws a circle using color pixels centered at coordinates centerX centerY of radius clipped to within the current clipping rectangle 5 REM Draw magenta circle 10 VGACIRCLE 320 240 100 RGB 255 0 255 CopyrightO01992 2010 by ACS Sarasota Florida 38 ALL RIGHTS RESERVED ACS Basic User s Manual VGAELLIPSE centerX centerY width height color fillcolor Draws an ellipse using color pixels of width and height centered at coordinates centerX centerY optionally filled with fillcolor pixels clipped to within the
44. LMNOPQRSTUVWXYZ r replace REM replace at beginning PRINT REPLACE s 0 r REM replace in middle PRINT REPLACE s 13 r REM replace past end PRINT REPLACE s 30 r Ready run replaceHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMreplaceUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZreplace Ready RND expr Returns a psuedo random number that ranges from 0 to expression 1 SIN degrees Returns a scaled sine value of the degree argument where 1024 lt SIN lt 1024 The degree argument ranges from 0 360 and arguments larger than 360 degrees are converted modulo 360 SIN 0 0 SIN 90 1024 SIN 180 0 SIN 270 1024 etc STR expr Returns a string representation of the numeric argument VAL expr Returns the numeric value of the string argument representation of a number Copyright 1992 2010 by ACS Sarasota Florida 49 ALL RIGHTS RESERVED ACS Basic User s Manual Errors The following errors can be produced The placeholder dd in the message is replaced with the line number where the error was detected if the error was encountered in a running program Some Syntax Errors will provide additional information after the line number further identifying the error Target line number notin program 6 Divide by zero eorin Ine da Ufer s T4 a CLOSE LIST PRINT or INPUT without successful OPEN File not open error in line dd EE H File already open error in line dd OPEN on already open fi
45. R 27 3B statement Cursor Down n lines to first column ESC n E Values ASCII 27 91 48 57 69 decimal 1B 5B 30 39 45 hex Receipt of this character sequence causes the display to move the cursor down n lines and to the first column The cursor will not move past the bottom line in the display and the display will not scroll up For example the cursor may be moved down one line to the first column by using the PRINT CHR 27 1E statement Cursor Right n characters ESC n C Values ASCII 27 91 48 57 67 decimal 1B 5B 30 39 43 hex Receipt of this character sequence causes the display to move the cursor right n characters on the same line The cursor will not move past the end of the current line For example the cursor may be moved right four characters by using the PRINT CHRS 27 4C statement Cursor Left n characters ESC n D Values ASCII 27 91 48 57 68 decimal 1B 5B 30 39 44 hex Receipt of this character sequence causes the display to move the cursor left n characters on the same line The cursor will not move past the beginning of the current line For example the cursor may be moved left three characters by using the PRINT CHRS 27 3D statement Move cursor to n ESC n G Values ASCII 27 91 48 57 71 decimal 1B 5B 30 39 47 hex Receipt of this character sequence causes the display to move the cursor to column n on the current line The cursor will
46. RAW PAGE SCREEN COORDINATES 0 VGAHEIGHT 1 VGAWIDTH 1 VGAHEIGHT 1 There are 5 drawing pages selected via VGADRAWPAGE that can be updated to the VGA frame buffer page via the VGAUPDATEPAGE VGAAUTOUPDATE mechanism The attached LCD video monitor displays the VGA frame buffer contents via VGASHOWPAGE See the VGAx specialvars description above for more information VGADRAWPAGE 0 pe Y 1 Draw Pages 0 4 VGA Frame Buffer l NEN RN VGAMODE VGASHOWPAGE c on E VGAAUTOUPDATE MAX Copyright 1992 2010 by ACS Sarasota Florida 36 ALL RIGHTS RESERVED ACS Basic User s Manual VGACLIPRECT topLeftX topLeftY bottomRightX bottomRightY Sets the clipping rectangle to the arguments provided The arguments are internally sorted left to right top to bottom and force limited to the current screen resolution The screen operations of VGAx statements are clipped to the rectangular region specified if the affected pixel coordinates are outside of the rectangle they are unchanged Setting VGAMODE resets the clipping rectangle to the entire screen area VGAPIXEL x y color Sets the VGA pixel at coordinate x y to color if the x y location is within the current clipping rectangle 5 REM Draw a red pixel 10 VGAPIXEL 20 10 RGB 255 0 0 20 10 VGAFILL color Fills the V
47. REM clear display install msg handler 15 LCDCLEAR 255 0 127 25 ONEVENT MSG GOSUB 8005 30 REM generate and display wav file list 35 GOSUB 6005 GOSUB 7005 100 GOTO 100 6000 REM 6001 REM Generate list of WAV files 6002 REM 6005 OPEN 0 WAVES TXT w 6010 DIR 0 wav 6015 CLOSE 0 6020 n 0 0PEN 0 WAVES TXT r 6025 INPUT 0 1 6030 LIF LEN 1 gt 0 THEN n n 1 GOTO 6025 6035 CLOSE 0 6040 IF n gt 3 THEN n n 3 6045 RETURN 7000 REM 7001 REM Display file list on LCD 7002 REM 7005 LCDCLEAR 255 0 127 0PEN 40 WAVES TXT r 7010 FOR i 0 TO b INPUT 0 1 NEXT i 7015 FOR i 0 TO 7 7020 INPUT 0 1 t LEFT 1 FIND 1 7025 t 1 LIF i s THEN t 2 s t 7030 r 1 i LCDPRINT r 0 4 t 0 t 7035 NEXT i 7040 CLOSE 0 7045 RETURN 8000 REM 8001 REM LCD received message handler 8002 REM 8005 k MSG 8010 IF MID K 0 1 K THEN 8050 8015 IF MID K 0 1 R THEN 8025 8020 RETURN 8024 REM R command 8025 GOSUB 7005 8030 RETURN 8049 REM K commands CopyrightO1992 2010 by ACS Sarasota Florida 62 ALL RIGHTS RESERVED 8050 8055 8060 8099 8100 8199 8200 8299 8300 8399 8400 8499 8500 8505 8510 8515 8599 8600 8605 8610 8615 8699 8700 k ASC MID K 2 1 ASC 0O ON k GOTO 8100 8200 8300 8400 8500 8600 8700 RETURN REM K30 left most key RETURN REM K31 mid left key RETURN REM K32 mid right key RETURN REM K33 right most key RETURN REM K34 down arrow
48. S its owners officers employees or agents be held liable for any special incidental indirect consequential or other damages including lost profits fees or revenues Any purchase of our products or use of our services constitutes your complete agreement and binds you and your company to all the terms policies conditions and prices as is herein described ACS PRODUCTS ARE NOT AUTHORIZED FOR USE AS CRITICAL COMPONENTS IN LIFE SUPPORT DEVICES OR SYSTEMS WITHOUT THE EXPRESS WRITTEN APPROVAL OF ACS As used herein 1 Life support devices or systems are devices or systems which a are intended for surgical implant into the body or b support or sustain life and whose failure to perform when properly used in accordance with instructions for use provided in the labeling can be reasonably expected to result in a significant injury to the user 2 A critical component is any component of a life support device or system whose failure to perform can be reasonably expected to cause the failure of the life support device or system or to affect its safety or effectiveness Symbolic Abbreviations In this manual the following symbolic abbreviations apply N Represents a file number 0 lt N lt 23 var Represents a numeric program variable var Represents a string program variable var Represents a numeric array program variable specialvar Represents a special program variable line Represents a program l
49. SC n A iiio RD OP eR Pe th PEE e ENEE er 28 Cursor Up n lines to first column ESC n P nennen enne nennen 28 Cursor Downn lines ESC m B ete e oce edt et AAR BATA 29 Cursor Down n lines to first column ESC n E sss enne enne 29 Cursor Right n characters ESC A C eiie eter ree RR HR seo rr EEEE dns 29 Cursor Left n characters ESC n D ssssssessssessseseeeeeeee enne enne enne enne enne 29 Move cursorto d ESC Tt Eesen 29 Move cursor to r c ESC rt H nnne adas alas ies 29 Erase all or part of display ESC DD ooonccnncnncccononancnnnonnnonnnonanonononoco noc noco rennen eene Eens 29 Erase all or part of me ESC 1 y o 30 Save cursor position CHSC MS Rt eee c EEGENEN eer 30 Restore cursor position BSCTnui tiee tesrestese stts eesseeses 30 Select Graphic Rendition ESC a b fm 30 PRINTEN expt expt oerte teet era tete dons ete Hee dee ere e edes 30 READ Var V lida 30 RETURN Ae pe Be URGE Uni ara 31 EE 31 REN oldtile mewtile m n Robie ten id 31 RESO start end new emer an ca ER ete Et oe coe EA 31 RUN lire or RUN path ta 31 SAVE pat RERI OD nem ett tu bonne sies 31 SIGNAL special Vato e e te rero e p ed e e e e iiem epo eed tes 32 STOB ueste RU dde etate air or Ee Der 32 TYPE cM 32 WAIT QGspecialv t e irre e t EH OPERE EE REES DETO EE ce 32 LODO ee eee eir cites euet eee vem eeepc tL E gie ema devenit
50. SEC While the delay is in process Events can occur but any defined ONEVENT handlers will not be executed until the delay has expired 10 REM delay for one second 20 DELAY 50 DIM var sizeJ Dimension a numeric or character array variable to hold size integers or character strings Array variable elements may then be accessed using a numeric index in parenthesis that ranges from the first element of zero to the last element of size A 0 A 1 A size If an attempt is made to access a variable as an array before it has been dimensioned a Dimension Error will result If an attempt is made to access an array element with a negative index or an index beyond the currently defined array size an Index Out of Range Error will result A variable may be re dimensioned however the current contents of the variable will be lost CopyrightO 1992 2010 by ACS Sarasota Florida 17 ALL RIGHTS RESERVED ACS Basic User s Manual DIR path Show files on the Compact Flash card An optional path may be specified without a leading backslash Wildcard characters and may be used to match multiple files DIR N path Write a list of files on the Compact Flash card to an open file N 0 23 An optional path may be specified without a leading backslash Wildcard characters and may be used to match multiple files EDIT line Direct mode only Using an ANSI terminal or the optional VGA module allows ed
51. T 2 205 a a 1 210 GOTO 20 300 PRINT 3 305 a a 1 310 GOTO 20 400 PRINT 4 405 a a 1 410 GOTO 20 500 PRINT 5 505 a a 1 510 GOTO 20 Ready run 12345 12345 12345 1234 ESC at line 20 Ready ONERROR GOTO line Program mode only Provides one shot error handling Upon any error statement execution starts at line and the ERR function has the value of the error number and the ERR function has the string version of the error number The ONERROR condition is then cleared so that subsequent errors result in program termination The ONERROR can be disabled by specifying a line number of zero 10 ONERROR GOTO 100 20 REM error follows 30 a 10 0 40 STOP 100 PRINT Error ERR ERR Ready run Error 6 Divide by zero error in line 30 Ready A common use of ONERROR statement is to allow execution of a command that might fail without causing the program to stop execution For example if you want to delete a file with the DEL command if the file didn t exist the DEL command would produce an error and the program would stop By setting up an ONERROR handler to bracket the DEL command the program will continue execution if the file to be deleted did or did not exist 170 ONERROR GOTO 180 DEL WAVLIST TXT ONERROR GOTO O 180 REM execution continues here even if WAVLIST TXT didn t exist CopyrightO 1992 2010 by ACS Sarasota Florida 23 ALL RIGHTS RESERVED ACS Basic User s Man
52. TFOR line 5 3 Rr nhe terere ipe tipi ueniet eee 18 FINPUT N var var 9 iere et ree tr rei eee i ro ree ER ORE EE Eie diets 18 FOR var init TO limit STEP increment oooooconnonoccnononanononononononnnononnnonnnnnnnnnnnnnnnnnonn eren enne nennen 18 FOPEN N recordlength pat cs une ai o e om UR VAN ert dei 19 EPRINT N expr expr e RR eee Hee eel tov EA 19 FREAD AN recordnumber var var var 19 FWRITE N recordnumber var var var 19 FINSERT N recordnumber var var var sse 19 EDELETESRN recordn umber rete te t ero iere rre Eee ere repe eee Ee aee gut 19 GOSUB ime oh DDR Mina EU LS PE 20 GOT OMINE c E 20 IF test THEN line statement ELSE line2 statement2 esses 20 INPUT EE WI A HE 20 INPUT prompt Vat x eet mter OS 20 INPUT AN Vaso iit A HE oH sic 20 LET var expr default statement ssssessseseeeneeeenene nennen nennen 20 LIF test THEN statement statement 21 LIST start end LIST Taart end 21 LIST N start end LIST N start end 0 0 0 eee ccccsseceeseececeesseeecsseeecesseeecseaececeeeaeeessneeesseaeens 21 EOAD p thliz deleita 21 MD path ii eR E ER SE ERE RII eite dne iiec 21 MEMORY 55th ti a ne uti TT lee 22 Dn d M M as 22 NEXT FVat e e tle e titt eee a tia a
53. TT 1 PLAY FOUR WAV PTT 0 RETURN Copyright 1992 2010 by ACS Sarasota Florida 56 ALL RIGHTS RESERVED ACS Basic User s Manual Westminster Chimes Turn the CFSound 3 into a digital audible clock with this short program The program plays a chime melody using pre recorded waveforms to emulate the Big Ben clock in London It plays a portion of the Westminster chimes on the quarter hour and the entire melody at the top of the hour along with chiming the hour Here is a flowchart of the program s logic Initialize Minute Wait for Minute Event Handler Event to fire Y Minute changed Play sequence kb E D C G Yes No Play sequence C E D G C D E C Yes gt No Play sequence Yes E C D G G D E C E D C G Play sequence C E D G C D E C E C D G G D E C Chime gt lt the Hours Looking at the diagram you can see that you need five different note sequences and the Hours chime The note sequences can be generated using individual wave files for each note or recorded or synthesized as short sequences In this example Cool Edit Pro was used to capture a bell sound shorten its envelope then generate the musical note sequences and the hours chime sound The five sequence sound files and hours chime are named dir wav SEQ_GDEC WAV 581954 A 08 23 2006 SEQ_CDEC WAV 581954 A 08 23 2006 SEQ_CEDG WA
54. V 581954 A 08 29 2006 SEQ_ECDG WAV 581954 A 08 23 2006 SEQ_EDCG WAV 581954 A 08 23 2006 HOURS WAV 264434 A 08 23 2006 6 files 0 directories Here s how it works The Acs Basic program initializes a line number of an event handler for the MINUTE special variable that will be fired whenever the MINUTE changes It then falls into a loop waiting for the event to fire Other statements can be executed while waiting but to keep this example simple it doesn t do anything else while waiting CopyrightO 1992 2010 by ACS Sarasota Florida 57 ALL RIGHTS RESERVED ACS Basic User s Manual 5 REM setup event handler 10 ONEVENT MINUTE GOSUB 100 15 REM wait here for event 20 GOTO 15 Whenever the MINUTE changes the program performs a GOSUB to the event handler program line The event handler calculates the period of the hour by dividing the current minutes value by 15 minutes per period and the minutes remaining in the period remainder by taking the modulo of the current minutes by 15 If the remainder is zero then it is the start of a new period and the event handler branches to the line number for the current period If the remainder is not zero the event handler returns Note that the four decision diamonds above are collapsed into the single program line 110 10 REM calculate period and remainder 102 p MINUTE 15 r MINUTE 15 105 REM if remainder 0 then branch on period 110 IF r 0 THEN ON p GOTO 200 300 40
55. a sound is playing SOUNDFRAMESYNC This special variable returns the current frame number of the playing sound It starts at zero when a sound starts playing and advances at the SOUNDFRAMEPRESCALER rate Due to implementation latency it can be off from 0 to 20mSEC from the actual start of the sound playing but this offset should remain constant for the duration of the sound play out Optionally an event handler specified with the ONEVENT statement may be activated whenever SOUNDFRAMESYNC changes This is a 16 bit signed integer that will wrap negative as it increments past 32767 requiring a judicious choice of SOUNDFRAMEPRESCALER value to allow the range to accommodate the length of the sound being synchronized to SOUNDFRAMEPRESCALER yields 20 mSEC per frame max 655 second sound SOUNDFRAMEPRESCALER 5S0 yields 1 SEC per frame max 32768 second sound VGAMODE Copyright 1992 2010 by ACS Sarasota Florida 13 ALL RIGHTS RESERVED ACS Basic User s Manual This special variable gets or sets the current Video Graphics Adaptor resolution per the following table VGAMODE Video Graphics Adaptor Resolution 0 640 x 480 x 16 72Hz 1 640 x 480 x 16 75Hz 2 800 x 600 x 16 72Hz 3 1024 x 768 x 16 70Hz Setting VGAMODE sets VGADRAWPAGE 1 OVGAUPDATEPAGE 0 and OVGASHOWPAGE O fills the graphics page with black restores the clipping rectangle to full screen and does a screen update to show the resu
56. am line entry it issues a READY prompt via the serial port ACS Basic v1 4 Sep 25 2006 11 44 00 Ready dir bas TEVENT BAS PROGRAM1 BAS SOUNDS BAS TEST BAS CEVENTS BAS PROGRAM2 BAS ONGOTO BAS ONGOSUB BAS TIMER BAS CHIMES BAS LCDDEMO BAS MSGTEST BAS 11 09 2058 11 09 2058 01 01 1980 01 01 1980 01 01 1980 11 09 2058 05 08 2052 11 09 2058 11 15 2058 09 07 2021 11 13 2020 11 11 2020 A A A A A A A A A A A A 0 directories Programs may be entered a line at a time by a stream of characters via the serial port or by loading from a file off of an optional Compact Flash card When entered via the serial port a program line will replace any matching program line and entering a line number only will delete the corresponding program line Entered program lines are limited to 255 characters of length 10 PRINT This is a Test 20 STOP list 10 PRINT This is a Test 20 STOP Ready 20 list 10 PRINT This is a Test Ready run This is a Test Ready print This is also a Test This is also a Test Ready CopyrightO1992 2010 by ACS Sarasota Florida 7 ALL RIGHTS RESERVED ACS Basic User s Manual ACS strongly recommends developing Basic programs interactively via a connected terminal computer or optional VGA PS2 keyboard so that error messages can be viewed and the program operation can be refined quickly otherwise the program may silently stop running leaving no clue as to what has hap
57. ane switch key press messages to process 30 REM generate and display wav file list 35 GOSUB 6005 GOSUB 7005 100 GOTO 100 The subroutine to generate the WAV directory file opens a text file WAVES TXT for destructive writing directing the output of the DIR command into that file The file is then re opened for reading and CopyrightO01992 2010 by ACS Sarasota Florida 60 ALL RIGHTS RESERVED ACS Basic User s Manual the number of lines in the file are counted subtracting 3 lines for the summary lines at the bottom of the DIR command REM REM Generate list of WAV files REM OPEN 0 WAVES TXT w DIR 0 wav CLOSE 0 nz0 0PEN 0 WAVES TXT r INPUT 0 1 LIF LEN 1 0 THEN n n 1 GOTO 6025 CLOSE 0 IF n gt 3 THEN n n 3 RETURN The subroutine to display the WAVES TXT file on the LCD display clears the screen then skips over lines in the file that have scrolled off the top of the display contained in the b variable It then prints the next 8 lines which is all that the LCD can show at a time The LCD print subroutine t variable receives the file name from each line discarding the following file size information The t variable receives the desired display print type 1 normal 2 inverse depending upon whether or not the screen row index variable i matches the current screen selection variable s and the currently selected WAV filename is saved in variable s Finally the LCDPRINT rows variable r receives
58. ar In line 10 if there is a closure AND there is a sound currently playing the sound is stopped then the triggering specialvar is cleared by setting it to zero In line 20 if there is a closure AND there isn t a sound currently playing then the desired sound is started playing and then the specialvar is cleared by setting it to zero 5 REM start stop sound with a single push button on Contact 25 input 10 LIF CLOSURE 24 1 AND SOUND lt gt THEN SOUND CLOSURE 24 0 GOTO 10 20 LIF CLOSURE 24 1 AND SOUND THEN SOUND SOUND WAV CLOSURE 24 0 GOTO 10 30 GOTO 10 Ready Copyright 1992 2010 by ACS Sarasota Florida 54 ALL RIGHTS RESERVED ACS Basic User s Manual Activating Multiple Output Contacts for a Sound The CFSound 3 can activate a single output contact when a sound is played in CFSound mode Here s a simple ACS Basic program that will allow multiple output contacts to be controlled when a sound plays Remember that the 9 CLOSURE x special variable index argument x is zero based so for Contact 25 the x value would be 24 etc This example assumes that the CFSound III is equipped with a Contact T O 8 module installed on the rear expansion connector to provide output contacts 0 7 In this sample a closure on contact 25 plays sound ONE WAV and activates output contacts 1 and 2 while the sound is playing A closure on contact 26 plays sound TWO WAV and activates output contacts 1 and 3 while
59. assigning a numeric selector value to the variable The current baud rate selector may be determined by reading the numeric value of the variable A selector is used to allow baud rates greater than 28800 which would result from the 16 bit integer limitation of the Basic language Note that the baud rate selector is saved in non volatile memory and is restored every time the CFSound 3 powers up The non volatile memory has a limited number of write cycles 100 000 and can be worn out by excessive writes so this special variable should not be written in a loop or on every program execution Exercise caution to avoid non volatile memory failure A good practice is to check the variable s value and only then write to it if it is not the desired value BAUD Baud Rate 0 110 1 300 2 600 3 1200 4 1800 5 2400 factory default 6 3600 7 4800 8 7200 9 9600 10 14400 11 19200 12 28800 13 38400 14 57600 15 115200 16 230400 MSG This special variable is updated by receipt of a serial data stream message that is framed with the SOM and EOM characters which are not included in the MSG It retains the framed message until it is read at which point the search for the next received SOM begins again It may also be cleared by assigning it a string value which is not saved MSGENABLE This special variable controls whether the serial data stream is parsed for messages as outl
60. at specification is a single character or a number signifying a particular format option The simplest format specification contains only the percent sign and a type character for example d If a percent sign is followed by a character that has no meaning as a format field the character is copied to the return value For example to produce a percent sign in the return value use 9696 The optional fields which appear before the type character control other aspects of the formatting as follows Required character that determines whether the associated argument is interpreted as a character a string or a number c character d signed decimal integer i signed decimal integer Type u unsigned decimal integer S string o unsigned octal integer X unsigned hexadecimal integer X unsigned HEXADECIMAL integer Optional character or characters that control justification of output and printing of signs blanks and octal and hexadecimal prefixes More than one flag can appear in a format specification left align the result in the given field width t prefix the output with a sign if the type is signed Flags if Width is prefixed with 0 zeros are added until the minimum width is 0 reached If 0 and appear the O is ignored If 0 is specified with an integer format the 0 is ignored blank prefix the output with a blank if the result is signed and positive the blan
61. ces to the new line numbers corrected It is displayed and written to a file with the same name as the original program with the extension RSQ If there are syntax errors in the program or references to non existent line numbers the RESQ will error and stop The original program should be SAVEd before attempting to resequence it No checks are made to avoid overlapping line numbers and the generated RSQ file should be loaded viewed and run before saving it over the original program file list 10 ON N GOTO 100 150 200 20 GOSUB 250 30 GOTO 30 100 REM 150 REM 200 STOP 250 RETURN Ready resq Writing resequenced program to test2 RSQ ON N GOTO 25 30 35 GOSUB 40 GOTO 20 REM REM STOP RETURN RUN line or RUN path Direct mode only Executes the program starting at the lowest or optional line number Basic version v1 22 added the ability to LOAD and RUN a file directly at the lowest line number by typing RUN filename If not present the BAS file extension on the filename at the end of the path is added SAVE path Direct mode only Saves the current program to a disk file on the Compact Flash card with the filename specified in path or to the filename in the previous LOAD statement or RUN command if not specified If not present the BAS file extension on the filename at the end of the path is added CopyrightO1992 2010 by ACS Sarasota Florida 31 ALL RIGHTS RESERVED ACS Basic User s Manual SIGNAL spe
62. character serial protocol that is used to play specific sounds and activate the push to talk relay while the sounds are playing The protocol consists of a single character sound number delimited by the default SOM and EOM characters This yields a message structure of an ASCII Start of Header SOH character CTRL A followed by the ASCII number of the sound to play Cl 4 followed by a ASCII End of Text ETX character CTRL C The files ONE WAV TWO WAV FOUR WAV are on the CF card Here s how it works An event handler is setup in line 20 when a character string delimited by the SOM and EOM characters is received control transfers to line 50 with the MSG variable holding the inner contents of the string Line 60 copies the string and resets the MSG variable for receipt of the next message The message number is converted from a string to a number in line 70 and is adjusted so that it is zero based Line 80 calls the subroutine matching the numeric value the called subroutine activates the PTT relay plays the sound deactivates the PTT relay and returns Line 90 then returns from the MSG event handler REM setup MSG event handler ONEVENT MSG GOSUB 50 GOTO 30 REM MSG event handler n MSG QMsG n VAL N 1 ON n GOSUB 100 200 300 400 RETURN 100 QPTT 1 PLAY ONE WAV QPTT 0 RETURN 200 PTT 1 PLAY TWO WAV QPTT 0 RETURN 300 PTT 1 PLAY THREE WAV PTT 0 RETURN 400 P
63. cialvar Signal an event associated with Special variable STOP Program mode only Terminates the program and issues a STOP message Closes all open files 10 a a 1 20 STOP Ready run STOP in line 20 Ready TYPE path Displays the contents of a CF card filename named path as ASCII characters on the serial port Path may be a constant string or you can use a string variable as the path by concatenating it to such a string TYPE P In Direct mode the quotes are not required A double escape sequence will stop the portion of the file display not already queued WAIT specialvar Execution pauses at this statement until the associated special variable has been signaled Note that all statements on the same line before the WAIT are executed continuously while waiting In this example program execution would pause at line 110 until all of the queued sounds had finished playing 10 SOUND one wav 20 SOUND two wav 30 ASOUND three wav 40 SOUND four wav 50 ASOUND five wav 60 ASOUND six wav 70 ASOUND seven wav 80 ASOUND eight wav 90 SOUND nine wav 100 SOUND ten wav 110 WAIT SOUND In this example program execution would pause at line 40 until all of the queued serial data had finished sending 10 REM test EOT 20 FOR I 1 TO 10 PRINT 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ NEXT I 40 WAIT EOT 50 PRINT EOT Ready run 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789AB
64. cimal 7F hex Receipt of these characters cause the display to show the character on the screen at the current cursor location and then move the cursor right to the next position The cursor will automatically wrap to the beginning of the next line if required scrolling the screen contents up if the cursor was on the last line The following characters are displayed Upper Bits Lower Bits 0010 0011 0100 0101 0110 0111 0000 space 0 P P 0001 1 A Q a q 0010 S 2 B R b r 0011 3 C S c s 0100 4 D T d t 0101 5 E U e u 0110 amp 6 F V f v 0111 y 7 G W g w 1000 8 H X h x 1001 9 I Y i y 1010 J Z j z 1011 bl K k 1100 i lt L 1 1101 M m 1110 gt N A n E 1111 0 E o s CopyrightO1992 2010 by ACS Sarasota Florida 27 ALL RIGHTS RESERVED ACS Basic User s Manual Reset Display ESC c Values ASCII 27 99 decimal 1B 63 hex Receipt of this character sequence causes the display to clear the cursor position to move to the upper left corner and the backlight to turn off This ANSI control character sequence may be issued using the PRINT CHR 27 c statement Cursor Down ESC D Values ASCII 27 68 decimal 1B 44 hex Receipt of this character sequence causes the display to move the cursor down to the next line in the same column The cursor will not move and the display will not scroll up if the cursor
65. d FOUR WAV when it opens Here s how it works The program lines 10 through 40 poll the contact 25 amp 26 CLOSURE and OPENING specialvars When one is found active non zero the desired sound file is played then the triggering specialvar is cleared by setting it to zero 5 REM play sounds on contact open and close 10 LIF CLOSURE 24 THEN PLAY ONE WAV CLOSURE 24 GOTO 10 20 LIF OPENING 24 THEN PLAY TWO WAV OPENING 24 GOTO 10 30 LIF CLOSURE 25 THEN PLAY THREE WAV CLOSURE 25 0 GOTO 10 40 LIF OPENING 25 THEN PLAY FOUR WAV OPENING 25 0 GOTO 10 50 GOTO 10 Ready Starting Stopping a Sound with a Single Button The CFSound 3 can play a single sound in response to a contact closure or opening in CFSound Mode using the file naming contact attribute association In order to toggle between starting and stopping a sound with a contact closure a simple ACS Basic program is required Remember that the CLOSURE x special variable index argument x is zero based so for Contact 25 the x value would be 24 etc In this sample a single momentary push button connected between the Contact 25 input and Ground on the Main connector starts and stops a sound Contact 25 plays sound SOUND WAV when it closes if no sound is currently playing and stops playing the sound when it closes and a sound is playing Here s how it works The program loops through lines 10 through 30 polling the contact 25 CLOSURE specialv
66. d may be determined by reading the value of the variable The queue may be flushed by assigning an empty string to the variable When the queue becomes empty any associated event handler specified with the ONEVENT statement is activated Up to 128 sounds may be queued Attempting to queue a sound when the queue is full results in an Invalid WAV file error Queued sounds play even if the Basic program has stopped VOL NSVOL The VOL and NSVOL special variables allow the ACS Basic program to control the CFSound 3 volume The volume is set by assigning a numeric value to the variable The current volume may be determined by reading the numeric value of the variable The range is 0 mute to 63 max volume Note that the EVOL volume setting is saved in non volatile memory and is restored every time the CFSound 3 powers up The non volatile memory has a limited number of write cycles 100 000 and can be worn out by excessive writes so this function should not be used in a loop and with caution The NSVOL volume setting doesn t save the value in the non volatile memory and doesn t have a use limit however the volume will be restored to the last 9 VOL or pushbutton set value upon the next power up or reset CopyrightO 1992 2010 by ACS Sarasota Florida 10 ALL RIGHTS RESERVED ACS Basic User s Manual BAUD The BAUD special variables allow the ACS Basic program to control the CFSound 3 serial port baud rate The baud rate is set by
67. dc tede e Ed T ts 22 ON expr GOSUB line0 line line2 lineN sssssssssssssesseeeenenenenenenen enne 22 ON expr GOTO line0 line line2 E N E ener renes 23 ONERROR GOTO Tine 55er nieht n eae bti tvi aped pei pecie e rr ie eb s 23 ONEVENT specialvar GOSUB line eese nooo nooo nono nono eene ener tren nennen nenne 24 OPEN N path options versmes pete eE eE r ep a EEE ORE eE EVET E EE S ORS EEEE 25 ORDER ENEE 25 PLAYA EE 25 PRINT expr expt s L e teer AA ette e GENEE 26 Backspace BS ua en th etre ette pue e pep t iere terre pedi eee erg 26 Horizontal Tab HT sc diel ete RO el ned ee buen enn 26 Terrie Feed DB fee Saeed td ct dedi 26 Vertical Tab V Di A ae eee 26 Form Feed FE acia 27 Carriage Return CR iot rtp PR EH FREE e NE ESFERA erotica Eet eeh 27 Cancel CAN tee tice EG eee dci vit e etui eee tono 27 Escape ES eiae ERR te e t Rn IR NE PR de 27 Displayed Characters tomadas 27 Reset Display ESC 6 aieo e pre eee DRIED e RH EH Rd ERA 28 Cursor Down ESC D d id ede pti tee tete dde 28 Cursor Down to column 1 ESC E 00 ecceccccsssseceeseececsensececseceecessneeecsesaececsesaeeeseueeessesaeeecseaaeeeees 28 CopyrightO1992 2010 by ACS Sarasota Florida 4 ALL RIGHTS RESERVED ACS Basic User s Manual Cursor Up BSC M ieee ee Ht UR ERREUR REIR EE UR EE eeh 28 ANSI Escape Sequences ESC J nerenin EEE trente eene Poner eene EE E Ea 28 Cursor Up n lines E
68. e next contact closure 5 REM play two sequences off of the two built in rear contacts 10 ONEVENT CLOSURE 24 GOSUB 1000 20 ONEVENT CLOSURE 25 GOSUB 2000 30 S 0 S1 0 40 GOTO 40 1000 REM contact 25 s sequence 1005 SOUND 1010 ON S GOSUB 1100 1105 1110 1115 1015 SO SO 1 1020 IF SO gt 3 THEN SO 0 1025 RETURN 1100 SOUND ONE WAV RETURN 1105 SOUND TWO WAV RETURN 1110 SOUND THREE WAV RETURN 1115 SOUND FOUR WAV RETURN 2000 REM contact 26 s sequence 2005 SOUND 2010 ON S1 GOSUB 2100 2105 2110 2115 2015 S1 S1 1 2020 IF S1 gt 3 THEN S1 0 2025 RETURN 2100 SOUND FIVE WAV RETURN 2105 SOUND SIX WAV RETURN 2110 SOUND SEVEN WAV RETURN 2115 SOUND EIGHT WAV RETURN CopyrightO9 1992 2010 by ACS Sarasota Florida 53 ALL RIGHTS RESERVED ACS Basic User s Manual Different Sounds for Contact Closure Opening The CFSound 3 can play a single sound in response to a contact closure or opening in CFSound Mode using the file naming contact attribute association In order to play two different sounds for the contact closing or opening a simple ACS Basic program is required Remember that the 9 CLOSURE x special variable index argument x is zero based so for Contact 25 the x value would be 24 etc In this sample Contact 25 plays sound ONE WAV when it closes and sound TWO WAV when it opens Contact 26 plays sound THREE WAV when it closes and soun
69. ear 00 99 y 52 IF y 0 THEN 50 53 IF y gt 99 THEN 50 60 YEAR y 65 INPUT hour 00 23 h 70 IF h lt 0 THEN 65 72 IF h gt 23 THEN 65 75 HOUR h 80 INPUT minute 00 59 m 85 IF m lt 0 THEN 80 87 IF m gt 59 THEN 80 90 MINUTE m 95 INPUT second 00 59 s 100 IF s lt 0 THEN 95 102 IF s gt 59 THEN 95 105 SECOND s 110 ONEVENT SECOND GOSUB 1000 120 GOTO 120 1000 PRINT CHR 13 1002 ON DOW GOSUB 2000 2001 2002 2003 2004 2005 2006 1005 ON MONTH GOSUB 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1010 PRINT d m FMT 2d DATE FMT 2d YEAR 1015 PRINT FMT X2d HOUR FMT 2d MINUTE FMT X02d QSECOND 1020 RETURN 1200 m RETURN 1201 m JAN RETURN 1202 m FEB RETURN 1203 m MAR RETURN 1204 m APR RETURN 1205 m MAY RETURN 1206 m z JUN RETURN 1207 m JUL RETURN 1208 m AUG RETURN 1209 m SEP RETURN 1210 m 0CT RETURN 1211 m z NOV RETURN 1212 m DEC RETURN 2000 d SUN RETURN 2001 d MON RETURN 2002 d TUE RETURN 2003 d WED RETURN 2004 d THU RETURN 2005 d FRI RETURN 2006 d SAT RETURN CopyrightO9 1992 2010 by ACS Sarasota Florida 52 ALL RIGHTS RESERVED ACS Basic User s Manual Two Sound Sequences The CFSound 3 can play a single sequence of sounds in CFSound Mode using a CFSOUND INI file to configure the sequence contact number and sound range Here s a sim
70. ers 30 x 56 numbers only 4 Fixed 5 x 7 fixed 5 Large 18 x 32 proportional doubled version of Medium Style Description 0 Normal 1 Inverted 2 No offColor pixels drawn Style bits may be combined Justify Description 0 Left text aligned to x 0 y Centered text aligned to VGAWIDTH 2 y Right text aligned to VGAWIDTH y Absolute text left aligned to x y Right Absolute text right aligned from x y Center Absolute text centered on x y Ma juin The x and y coordinates specified for the justified text refer to the top edge and left or right corners of the generated text display VGAPOLYGON coordsx coordsY color fillcolor Draws a polygon using color lines whose vertex coordinates are passed as numeric arrays coordsX coordsY optionally filled with fillcolor pixels The coordinate arrays must be identically DIMensioned to be greater than or equal to 3 points DIM x 2 y 2 triangle coordinates x 0 y 0 x 1 y 1 xQ y 2 5 REM Draw random triangles 7 VGAFILL O 10 DIM x 2 y 2 20 x RND VGAWIDTH x 1 RND VGAWIDTH x 2 RND QVGAWIDTH 30 y 0 RND QVGAHEIGHT y 1 RND QVGAHEIGHT y 2 RND QVGAHEIGHT 40 VGAPOLYGON x y RGB RND 256 RND 256 RND 256 RGB RND 256 RND 256 RND 256 50 GOTO 20 CopyrightO 1992 2010 by ACS Sarasota Florida 40 ALL RIGHTS RESERVED ACS Basic User s Manual VGABITMAP upperX upperY path Draws
71. ex Receipt of this character sequence causes part or all of the line that the cursor is on to clear If n 0 the line is cleared from the cursor position to the end of the line If n 1 the line is cleared from the beginning to the cursor position If n 2 the entire line is cleared The position of the cursor is not affected by this command Save cursor position ESC ns Values ASCII 27 91 114 decimal 1B 5B 73 hex Receipt of this character sequence causes the display to save the current cursor position Restore cursor position ESC n u Values ASCII 27 91 116 decimal 1B 5B 75 hex Receipt of this character sequence causes the display to restore the previously saved cursor position Select Graphic Rendition ESC a b f m Values ASCII 27 91 109 decimal 1B 5B 6D hex Receipt of this character sequence causes the display to select how subsequent text is rendered Up to 10 parameters may be specified separated by semicolons from the following table of attributes Parameter value Attribute 0 Reset normalize all attributes 7 Negative reverse on off colors 8 Conceal no off color drawn 27 Positive normal on off colors default 30 On color BLACK 31 On color RED 32 On color GREEN 33 On color YELLOW 34 On color BLUE 35 On color MAGENTA 36 On color CYAN 37 On color WHITE default 40 Off
72. filling in the vacated MSB positions with copies of the sign bit 15 Thus 1234 gt gt 2 308 Decimal 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1234 0 0 0 0 0 1 0 0 1 1 0 1 0 0 1 0 gt gt 2 0 0 gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt 308 0 0 0 0 0 0 0 1 0 0 1 1 0 1 0 0 Since the bits filling into the vacated MSB positions are copies of the sign bit bit 15 then 1234 gt gt 2 308 Decimal 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1234 1 1 1 1 1 0 1 1 0 0 1 0 1 1 1 0 gt gt 2 l1 gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt gt 308 1 1 1 1 1 1 1 0 1 1 0 0 1 0 1 1 Copyright 1992 2010 by ACS Sarasota Florida 44 ALL RIGHTS RESERVED ACS Basic User s Manual Expressions In ACS Basic expressions consist of one or more variables constants functions or special variables that may optionally be joined together by Operators The evaluation order may be controlled by the judicious use of parenthesis Expressions may be nested up to 10 levels Some examples a 10 Ready print a 30 300 Ready print fmt 02X a 0A Ready print a 2 40 Ready print a 2 0 D Ready print a lt lt 2 lt gt 0 1 Ready Functions ACS Basic provides several funct
73. fter INPUT N FINPUT N or FREAD N reaches the GCRECEGN end of file HN 0 23 SECOND The event occurs once per second MINUTE The event occurs once per minute HOUR The event occurs once per hour DOW The event occurs once per day at midnight DATE The event occurs once per day at midnight MONTH The event occurs once per month at midnight of day 1 YEAR The event occurs once per year SOUND The event occurs after the last queued SOUND sound has finished playing MSG The event occurs after receipt of a serial character stream delineated by the SOM and EOM characters EOT The event occurs upon complete transmission of a serial character stream of one or more characters when both the output buffer and UART are empty Here is a short program that outputs the current time once per second on the serial port Note that the program s idle loop which it executes while waiting for the second event to occur consists of a single GOTO self statement 5 REM print the time once per second 10 ONEVENT SECOND GOSUB 100 20 GOTO 20 PRINT CHR 13 PRINT FMT 2d HOUR PRINT PRINT FMT 2d MINUTE PRINT ery PRINT FMT 2d SECOND RETURN Ready run 14 47 15 ESC at line 30 Ready Copyright 1992 2010 by ACS Sarasota Florida 24 ALL RIGHTS RESERVED ACS Basic User s Manual OPEN N path options Open filename path as file N 0 23 for subsequent acces
74. g upon what optional modules have been installed on the CFSound 3 permissible values for x are O through 55 Reading the variable returns a 1 if the input contact x has had a closure since last being read Closures are sticky and the program must clear the closure by assigning it a zero before it can be detected again Optionally an event handler specified with the ONEVENT statement may be activated upon an input closure which automatically clears the closure 10 ONEVENT CLOSURE 24 GOSUB 100 20 ONEVENT CLOSURE 25 GOSUB 200 30 GOTO 30 100 PRINT contact 25 closed RETURN 200 PRINT contact 26 closed RETURN Ready run contact 25 closed contact 26 closed CopyrightO 1992 2010 by ACS Sarasota Florida 9 ALL RIGHTS RESERVED ACS Basic User s Manual OPENING x The OPENING x special variables allow the ACS Basic program to access CFSound 3 contact events There are up to 56 contact inputs depending upon what optional modules have been installed on the CFSound 3 permissible values for x are 0 through 55 Reading the variable returns a 1 if the input contact x has had an opening since last being read Openings are sticky and the program must clear the opening by assigning it a zero before it can be detected again Optionally an event handler specified with the ONEVENT statement may be activated upon an input opening which automatically clears the opening FEOF N The FEOF N
75. has not reached the limit Execution of a NEXT statement without a preceding FOR causes a Nesting Error ON expr GOSUB lineo line line2 lineN Program mode only Case statement dispatching via subroutines The value of expr is evaluated and a subroutine call is performed to the line0 statement if zero linel if one etc If the value of expr is negative or greater than the number of line numbers present execution continues with the next statement Upon return from the GOSUB execution continues with the next statement 5 REM ONGOSUB Demo 10 a 0 20 ON a GOSUB 100 200 300 400 500 30 GOTO 20 100 PRINT 1 105 a a 1 110 RETURN 200 PRINT 2 205 a a 1 210 RETURN 300 PRINT 3 305 a a 1 310 RETURN 400 PRINT 4 405 a a 1 410 RETURN 500 PRINT 5 505 a 0 510 RETURN Ready run 12345 12345 12345 12345 12345 1 ESC at line 105 Ready CopyrightO9 1992 2010 by ACS Sarasota Florida 22 ALL RIGHTS RESERVED ACS Basic User s Manual ON expr GOTO lineo line line2 lineN Program mode only Case statement dispatching via jumps The value of expr is evaluated and a jump is performed to the line0 statement if zero linel if one etc If the value of expr is negative or greater than the number of line numbers present execution continues with the next statement 5 REM ON GOTO DEMO 10 a 0 20 ON a GOTO 100 200 300 400 500 30 GOTO 10 100 PRINT 1 105 a a 1 110 GOTO 20 200 PRIN
76. ine number 0 lt line lt 65535 Delineates optional arguments or parameters filename Represents a DOS style 8 3 filename up to 8 characters with an optional 3 character extension Represents a complete path to a file including the filename without leading backslash There is no concept of path a current directory other than the root file system statement Represents a program statement expr Represents a program expression recordlength Represents a Fixed Length File I O record length 0 lt recordlength lt 127 including the trailing CR LF on the end of each record recordnumber Represents a Fixed Length File I O record number 0 lt recordnumber lt 32767 color Represents a 16 bit pixel color expressed as RGB565 Copyright 1992 2010 by ACS Sarasota Florida 2 ALL RIGHTS RESERVED ACS Basic User s Manual Table of Contents Table Of Gontents iii ENNER NEES 3 FO ATU EE 7 Programs Si ee 7 MariableS ciclones 8 Special Variables iio dd dia 9 AIM ae e e AE 9 POR TUS DES AAA MM A Bac ete a aes eR LES 9 SERIES 9 CLOSURE IS ends ered e cael het es el T M ieee lM cae EE 9 OPENING eese Stach os 10 e NB Dose eee E A CELL AN fe sR SI xD RE SCR PRE SON OO ETI 10 SECOND EMINUTE HOUR DOW DATE MONTH QGYEAR 10 SOUNDS ee ee 10 KO BECKEN 10 IBA des 11 OMS Goins ict EUER 11 OMSGENADBEPE 25 3 erret deett iet esee tede dee eege dieere tte iode eese 11 MET E E E E
77. ined in the MSG description above The ability to disable MSG processing is required to support the GETCHO function on the serial port It defaults to 1 enabled EOT This special variable returns when any serial data sent by BASIC console operation or PRINT or LCDx statements has finished transmitting It can be cleared by setting it to zero but will immediately return again unless serial data is sending SOM This special variable determines the character used to delineate the Start of Message It defaults to ASCII SOH 01 Copyright 1992 2010 by ACS Sarasota Florida 11 ALL RIGHTS RESERVED ACS Basic User s Manual EOM This special variable determines the character used to delineate the End of Message It defaults to ASCII ETX 03 PTT Writing this special variable to a non zero value activates the CFSound III PTT relay Setting it to zero deactivates the PTT relay Reading this special variable returns 1 if the PTT relay is active else zero MUTE Writing this special variable to a non zero value mutes the CFSound III speaker amplifier Setting it to a zero value un mutes the amplifier Reading this special variable returns 1 if the amplifier is muted else zero The RUN command automatically un mutes the speaker amplifier LINEIN Writing this special variable to a non zero value enables the CFSound III Line level Input Setting it to zero disables the Line level input Reading this special variable
78. ions that may be used in expressions There must not be a space between the function name and the opening parenthesis Functions must be used in a statement such as a LET or PRINT they cannot be executed standalone in immediate mode ASC char Returns the numeric ASCII value of the character argument ABS expr Returns the absolute value of the numeric argument CHR expr Returns an ASCII string containing the character equivalent of the expression argument COS degrees Returns a scaled sine value of the degree argument where 1024 lt COS lt 1024 The degree argument ranges from 0 360 and arguments larger than 360 degrees are converted modulo 360 COS 0 1024 COS 90 0 COS 180 1024 COS 270 0 etc ERR Returns the last error number CopyrightO 1992 2010 by ACS Sarasota Florida 45 ALL RIGHTS RESERVED ACS Basic User s Manual ERR Returns the string representation of the last error number FIND var searchvar Returns the zero based position of string searchvariable in string variable or 1 if the searchvariable was not found Copyright 1992 2010 by ACS Sarasota Florida 46 ALL RIGHTS RESERVED ACS Basic User s Manual FMT fmt expr Returns a formatted ASCII string of expression using format specification fmt A format specification consists of optional and required fields and has the following form Flags Width Precision Type Each field of a form
79. irst statement on a line may have a line number A Direct mode of operation is available for some statements when they are entered without a line number and are executed immediately Here are some sample program statements 10 REM This is a comment 20 FOR I TO 10 PRINT I NEXT I The statement keywords are tokenized when entered to save program memory and speed program execution ie the keyword GOSUB would be tokenized to a single byte instead of five bytes In addition the statement line numbers are converted to a two byte unsigned integer form to save space and facilitate program execution Saved programs are expanded un tokenized on the CF card to allow program storage viewing and editing with an external text editor 1f required The following statement keywords are supported CLEAR Erases all variables and closes all open files CLOSE N Close file N 0 23 opened with OPEN statement DATA Program mode only Enter inline DATA statements holding values that can be accessed by READ and ORDER statements All related DATA statements should be in a group of sequential lines DEL path Delete files and directories on the Compact Flash card The full path must be specified without a leading backslash Directories must be empty to be deleted Path may be a constant string or you can use a string variable as the path by concatenating it to such a string DEL PS DELAY value Pause program execution for value 20m
80. iting a line by displaying the statement moving the cursor with the Home Left arrow Right arrow End and Backspace keys Typed characters are entered at the cursor The Enter key accepts the changes a double ESC key aborts the edit END Program mode only Terminate program with no message Closes all open files ERROR value Force an error Program execution stops and an error message is displayed 10 ERROR 250 Ready run 250 error in line 10 Ready EXITFOR line Program mode only Exit out of a FOR NEXT loop by popping the FOR off of the control stack and jumping to ine FINPUT EN var var Gets value s for one or more variables from a single line from file N 0 23 Note that when an end of file occurs the variables will have their last value Test the FEOF N specialvar to detect this condition The data items in the file are separated by commas and string values must be surrounded by double quotes See the FPRINT N statement below that can be used to produce a file in the correct format If the data in the file ends before all of the variables have been assigned values an Out of Data Error occurs Incorrect data formatting in the file can cause a Syntax Error to occur FOR varzinit TO limit STEP increment Program mode only Perform a counted loop incrementing var from the init value to the limit value by the optional increment value executing statements up until the matching NEXT sta
81. k is ignored if both the blank and flags appear when used with o x or X format prefix any nonzero output value with 0 Ox or OX respectively otherwise ignored Nonnegative decimal integer controlling the minimum number of characters printed If the number of characters in the output value is less than the specified width blanks are added to the left or the right of the values depending on whether the flag for left alignment is Width specified until the minimum width is reached If Width is prefixed with 0 zeros are added until the minimum width is reached not useful for left aligned numbers The Width specification never causes a value to be truncated If the number of characters in the output value is greater than the specified width or if Width is not given all characters of the value are printed subject to the Precision specification Specifies a nonnegative decimal integer preceded by a period which specifies the number of characters to be printed the number of decimal places or the number of significant digits Unlike the Width specification the precision specification can cause truncation of the output value If Precision is specified as O and the value to be converted is O the result is no characters output Precision c Precision has no effect Precision specifies the minimum number of digits to be output If the number of digits is less than Precision the output is padded on the left with zeroes The va
82. le ___ Contact out of range error in line dd sO CLOSURE x OPENING x subscript out of Stack Overflow error in line dd Too many nested FOR and or GOSUB and or events No CF card error in line dd Statement requiring Compact Flash card with no card detected Invalid WAV file error in line dd al format not 44 1KHz 16 bit mono or stereo or SOUND LCDx arguments Out of Range error in line dd One or more argument to a LCDx statement are out of range FWRITE record Out of Range error in line dd d is FWRITE to a record number that is past the immediate P 5 Length of data in FWRITE variables list including commas and FWRITE O length irorin line dd quotes exceeds the recordlength specified in the associated FOPEN 6 27 FINSERT record Out of Range error in line dd Attempt to FINSERT to a record number that is past the immediate end of file 8 7 L2 o Length of data in FINSERT variables list including commas and oo os quotes exceeds the recordlength specified in the associated FOPEN No DMX module error in line dd ae specialvar access attempted with no DMX I O module DMX Channel Out of Range error in line dd DMXDATA x access where x gt 511 DMX Analog Out of Range error in line dd DMXANALOG x access where x gt 7 DMX Analog Read Only error in line dd Attempt to set DMXANALOG x Unknown Command error in line dd ACS Basic doesn t recognize the command T d
83. lt VGAENABLE Gets or sets the state of the Video Graphics Adaptor blanking Setting this non zero the default will enable the display setting this to zero will blank the display The display contents are not affected by this command VGADRAWPAGE Gets or sets the current drawing page that will be used by the VGAx statements Defaults to zero upon Reset or whenever the VGAMODE is set There are a total of five drawing pages numbered 0 4 VGAUPDATEPAGE Gets or sets the current Video Graphics Adaptor display page that will be updated by the VGAx statements Defaults to zero upon Reset or whenever the VGAMODE is set The number of available pages is a function of the VGAMODE VGAMODE Resolution Number of Pages 0 640 x 480 109 1 640 x 480 109 2 800 x 600 69 3 1024 x 768 42 If VGAAUTOUPDATE 0 then setting VGAUPDATEPAGE will cause the page to be updated VGASHOWPAGE Gets or sets the current Video Graphics Adaptor display page that will be displayed if VGAENABLE 1 Defaults to zero upon Reset or whenever the VGAMODE is set See VGAUPDATEPAGE above for the number of available pages VGAAUTOUPDATE Gets or sets the state of the Video Graphics Adaptor update mechanism VGAx commands will automatically cause a screen update if VGAAUTOUPDATE 1 default Setting VGAAUTOUPDATE 0 allows multiple VGAx commands to be issued without updating the screen resulting in faster drawing but re
84. lue is not truncated when the number of digits exceeds Precision Precision specifies the maximum number of characters to be output Characters in excess of Precision are not output d i u O x X CopyrightO1992 2010 by ACS Sarasota Florida 47 ALL RIGHTS RESERVED ACS Basic User s Manual GETCH expr If expr evaluates to zero GETCH 0 returns the numeric value of the next available serial character Gf EMSGENABLE 0 or the next PS 2 ASCII key character if VGA module installed or it returns a zero if no character is currently available from either enabled source If expr evaluates to non zero GETCH 1 waits for the next available serial character if MSGENABLE 1 or PS 2 ASCII key character if VGA module installed and then returns its numeric value INSERT var start var2 Returns a string variable with the contents of variable2 inserted at zero based position start REM test insert s ABCDEFGHIJKLMNOPQRSTUVWXYZ i insert REM insert at beginning PRINT INSERT s 0 i REM insert in middle PRINT INSERT s 13 i REM insert past end PRINT INSERT s 30 i Ready run insertABCDEFGHIJKLMNOPQRSTUVWXYZ ABCDEFGHIJKLMinsertNOPQRSTUVWXYZ ABCDEFGHIJKLMNOPQRSTUVWXYZinsert Ready LEFT var len Returns a string containing the leftmost length characters of string variable LEN var Returns the length number of characters of string variable MID var start len Returns a
85. lue of zero ESC m is the same as ESC 0m The ANSI escape character sequence may be issued using the PRINT CHR 27 statement as a prelude to the optional parameters and requisite command character Cursor Up n lines ESC n A Values ASCII 27 91 48 57 65 decimal 1B 5B 30 39 41 hex Receipt of this character sequence causes the display to move the cursor up n lines in the same column The cursor will not move up past the first line in the display For example the cursor may be moved up one line by using the PRINT CHR 27 1A statement Cursor Up n lines to first column ESC n F Values ASCII 27 91 48 57 70 decimal 1B 5B 30 39 46 hex Receipt of this character sequence causes the display to move the cursor up n lines and to the first column The cursor will Copyright 1992 2010 by ACS Sarasota Florida 28 ALL RIGHTS RESERVED ACS Basic User s Manual not move up past the first line in the display For example the cursor may be moved up two lines to the first column by using the PRINT CHR 27 2F statement Cursor Down n lines ESC n B Values ASCII 27 91 48 57 66 decimal 1B 5B 30 39 42 hex Receipt of this character sequence causes the display to move the cursor down n lines in the same column The cursor will not move past the bottom line in the display and the display will not scroll up For example the cursor may be moved down three lines by using the PRINT CH
86. naesesneeeneeeeseaeseseaeseseeeeseesesnaesaseeneneeees 75 Copyright 1992 2010 by ACS Sarasota Florida 6 ALL RIGHTS RESERVED ACS Basic User s Manual Features ACS Basic is an integer microcomputer basic designed for simple control applications ACS Basic executes programs consisting of one or more statements Statements consist of an optional line number followed by reserved keyword commands specifying operations for Basic to perform followed by required and or optional arguments Statements that begin with a line number are entered and held sorted by line number until Basic is commanded to execute them This is called the Program mode of operation Statements entered without a line number are evaluated and executed immediately This is called the Direct mode of operation Some keyword commands are Direct mode only and may not appear in a program Some keyword commands are Program mode only and may not be evaluated and executed immediately after being typed in These limitations are listed in the keyword command definitions below Programs In ACS Basic a Program consists of one or more program lines Each program line consists of a line number followed by one or more statements Multiple statements in a program line must be separated by 66 99 colons Program lines that are entered without a line number are executed directly Only certain statements may be executed directly When ACS Basic is awaiting statement or progr
87. ne This ANSI control character may be issued using the PRINT CHR 11 statement CopyrightO 1992 2010 by ACS Sarasota Florida 26 ALL RIGHTS RESERVED ACS Basic User s Manual Form Feed FF Value ASCII 12 decimal OC hex Receipt of this character causes the display to move the cursor down to the next line in the same column The display will scroll up if the cursor was on the last line This ANSI control character may be issued using the PRINT CHR 12 statement Carriage Return CR Value ASCII 13 decimal OD hex Receipt of this character causes the display to move the cursor left to the first column on the current line This ANSI control character may be issued using the PRINT CHR 13 statement Note that all PRINT statements without a trailing comma result in a trailing CR LF sequence being sent to the VGA Cancel CAN Value ASCII 24 decimal 18 hex Receipt of this character causes the display to abort any escape sequence that may be in process No other action is taken This ANSI control character may be issued using the PRINT CHR 24 statement Escape ESC Value ASCII 27 decimal 1B hex Receipt of this character causes the display to attempt to decode one or more of the following characters as a control or escape sequence that will affect the display This ANSI control character may be issued using the PRINT CHR 27 statement Displayed Characters Values ASCII 32 decimal 20 hex through ASCII 127 de
88. not move past the beginning or end of the current line For example the cursor may be moved to the beginning of the current line by using the PRINT CHR 27 G statement Move cursor to r c ESC r c H Values ASCII 27 91 48 57 59 48 57 72 decimal 1B 5B 30 39 3B 30 39 48 hex Receipt of this character sequence causes the display to move the cursor to row r column c The value for r ranges from 0 bottom row the value for c ranges from 0 rightmost column The values for r or c will be limited to the selected screen resolution if they exceed it For example the cursor may be moved to the home position 0 0 by using the PRINT CHRS 27 H statement Erase all or part of display ESC n J Values ASCII 27 91 48 50 74 decimal 1B 5B 30 32 4A hex Receipt of this character sequence causes part or all of the display to clear If n 0 the display is cleared from the cursor position to the end If n 1 the display is cleared from the beginning to the cursor position If n 2 the entire display is cleared and the cursor is moved to the upper left 0 0 For example the screen may be cleared by using the PRINT CHR 27 2J statement Copyright 1992 2010 by ACS Sarasota Florida 29 ALL RIGHTS RESERVED ACS Basic User s Manual Erase all or part of line ESC n K Values ASCII 27 91 48 50 75 decimal 1B 5B 30 32 4B h
89. pened Program lines may be viewed with the LIST statement All program lines may be cleared with the NEW statement Program execution is started using the RUN statement Upon power up ACS Basic clears the program memory and awaits statement or program line entry via the serial port Program lines may be edited via a connected ANSI terminal or computer with ANSI terminal emulation with the EDIT statement See the EDIT keyword command definition below for more information Entering an Escape character 0x1B twice in succession via the serial port while a program is running will cause termination of the program and ACS Basic will output a message then await further statement or program line entry via the serial port If the program is awaiting input by executing an INPUT statement a trailing carriage return may be necessary to terminate the INPUT before the Escape sequence is seen new Ready 10 for i 1 to 10 20 print i 30 delay 10 40 next i list 10 FOR i 1 TO 10 20 PRINT i 30 DELAY 10 40 NEXT i Ready run 4 lt Escape key pressed twice here ESC at line 20 Ready Variables ACS Basic has four types of variables 16 bit Integer Numeric 16 bit Integer Numeric Arrays unsigned 8 bit character Strings and unsigned 8 bit character String Arrays Variable names are not case sensitive Numeric variables can assume the integer values 32768 lt variable lt 32767 Character Strings are limited to 255 characters in
90. ple ACS Basic program that will allow two different sequences each controlled by a built in contact Remember that the CLOSURE x special variable index argument x is zero based so for Contact 25 the x value would be 24 etc Contact 25 activations cycle through sounds ONE WAV TWO WAV THREE WAV and FOUR WAV and contact 26 activations cycle through sounds FIVE WAV SIX WAV SEVEN WAV and EIGHT WAV Here s how it works The program lines 10 and 20 setup event handlers for contact closures on contacts 25 and 26 The subroutine at line 1000 is called whenever a closure is detected on contact 25 the subroutine at line 2000 is called whenever a closure is detected on contact 26 Line 30 clears the two sequence variables that keep track of what sound to play next The variable SO keeps track of what sound to play for contact 25 and S1 tracks the sounds for contact 26 When a closure is detected on contact 25 the subroutine at line 1000 stops any currently playing sound by clearing the ESOUNDS special variable Line 1010 then starts playing the next sound in the sequence based upon the current value of SO and advances the value of SO for the next contact closure When a closure is detected on contact 26 the subroutine at line 2000 stops any currently playing sound by clearing the SOUNDS special variable Line 2010 then starts playing the next sound in the sequence based upon the current value of S1 and advances the value of S1 for th
91. program execution use the SOUND special variable CopyrightO9 1992 2010 by ACS Sarasota Florida 25 ALL RIGHTS RESERVED ACS Basic User s Manual PRINT expr expr Prints one or more expression s to the serial port and optional VGA display if VGAPRINT 1 If the statement ends in a comma no Carriage Return Line Feed pair is appended to the printed expressions allowing multiple print statements to display on the same line If the optional Video Graphics Adaptor is installed the PRINT statement is also shown on the attached display as ANSI text The ANSI text is printed using a fixed pitch font in the current VGAMODE setting with the number of characters per line and lines per screen automatically adjusted to overlay the entire screen The size of the fixed pitch font is 5 x 7 pixels in a 6 x 12 box to improved screen readability allow for lower case descenders and accommodate a flashing underline cursor The location of the printed text starts at the upper left corner of the screen 0 0 and ranges to the lower right corner The location may be controlled by the use of embedded ANSI control sequences to position the cursor before printing Upper Left Lower Right Gye MOvE Col Row Col Row 0 640 x 480 0 0 106 40 1 640 x 480 0 0 106 40 2 800 x 600 0 0 133 50 3 1024 x 768 0 0 170 64 The following ANSI cursor controls are supported by the Video Graphics Adaptor
92. quires setting VGAUPDATEPAGE to cause the screen to update when drawing is done VGAWIDTH Copyright 1992 2010 by ACS Sarasota Florida 14 ALL RIGHTS RESERVED ACS Basic User s Manual This read only special variable gets the width of the screen in pixels for the current Video Graphics Adaptor VGAMODE setting VGAHEIGHT This read only special variable gets the height of the screen in pixels for the current Video Graphics Adaptor VGAMODE setting VGAPRINT This special variable enables or disables whether PRINT statements are also sent to the optional Video Graphics Adaptor as ANSI text The default is enabled 1 See the PRINT statement below for additional information VGASHOWCURSOR This special variable enables or disables the display of a flashing cursor showing the current PRINT position on the optional Video Graphics Adaptor The default is enabled 1 Copyright 1992 2010 by ACS Sarasota Florida 15 ALL RIGHTS RESERVED ACS Basic User s Manual Events ACS Basic provides the concept of an Event Events occur outside of the normal program execution flow and are processed in between the execution of individual program statements Some special variables have Events associated with them and may be referenced in ONEVENT SIGNAL and WAIT statements There are two ways to process an event asynchronously with an ONEVENT handler or synchronously with a WAIT statement or by polling the special variable s value in
93. r T Illegal use of specialvar in FOR DIM INPUT READ FREAD or 38 Can t use VAR in line dd FINPUT statement Mis matched quotes in line dd Missing one of a pair of double quotes delimiting a string 40 No VGA module error in line dd VGA specialvar access or VGAx statement attempted with no VGA module present Copyright 1992 2010 by ACS Sarasota Florida 50 ALL RIGHTS RESERVED ACS Basic User s Manual Unsupported bitmap file Problem with filename argument to the VGABITMAP statement FREAD record Out of Range error in line dd Attempt to FREAD 49 65535 ERROR x statement Copyright 1992 2010 by ACS Sarasota Florida 51 ALL RIGHTS RESERVED ACS Basic User s Manual Examples Here are a few sample programs that illustrate the various language features and what can be done with some simple lines of code Setting the Real Time Clock Set the CFSound 3 s Real Time Clock with this short program The program prompts for the values of the Month Date Year Hour Minute and Second while range checking the values then displays the formatted time on the connected ANSI terminal once a second 5 REM set the cfsound rtc 7 INPUT set the RTC first y n s 8 IF s y THEN 20 9 IF s Y THEN 20 10 GOTO 110 20 INPUT month 1 12 m 25 IF m lt 1 THEN 20 27 IF m gt 12 THEN 20 30 MONTH m 35 INPUT date 1 31 d 40 IF d lt 1 THEN 35 42 IF d gt 31 THEN 35 45 DATE d 50 INPUT y
94. returns 1 if the line level input is enabled else zero The RUN command automatically disables the Line level input Audio on the Line level Input is amplified to the current volume level and is presented to the speakers and Line level Output when it is enabled and no other sound is playing DMXRESET Writing this special variable to a non zero value resets the optional DMX I O module if present DMXMASTER Writing this special variable to a non zero value enables the optional DMX I O module as a master controller if present A value of zero enables sets slave device mode DMXFRAMEDELAY Writing this special variable sets the inter frame delay in multiples of 20mSEC when the optional DMX I O module is present and configured as a master DMXCHANNELS Writing this special variable sets the number of channels transmitted times 2 if the optional DMX I O module is present and configured as a master DMXDATA x Gets or sets the current value of channel x 0 lt x lt 511 if the optional DMX I O module is present DMXANALOG x Gets or sets the current value of analog input x 0 lt x lt 7 if the optional DMX I O module is present Copyright 1992 2010 by ACS Sarasota Florida 12 ALL RIGHTS RESERVED ACS Basic User s Manual DMXFRAMESYNC Returns a 1 if a DMX frame has been sent DMX master mode or received DMX slave mode since last checked else returns 0 Optionally an event handler specified with an ONEVENT sta
95. s a circle on an ACS LCD display connected to the CFSound 3 serial port LCDTONE frequency duration Produces a tone on an ACS LCD display connected to the CFSound 3 serial port Copyright 1992 2010 by ACS Sarasota Florida 34 ALL RIGHTS RESERVED ACS Basic User s Manual LCDSAVE page Saves a screen on an ACS LCD display connected to the CFSound 3 serial port LCDRESTORE page Restores a screen on an ACS LCD display connected to the CFSound 3 serial port LCDBITMAP startrow col path Displays a Windows BMP bitmap file named path starting at startrow 0 7 and column on an ACS LCD display connected to the CFSound 3 serial port Only mono 16 color and 256 color bitmaps are supported Any pixel whose color is not R 255 G 255 B 255 white will be displayed as an on pixel black Issues multiple LCD display Horizontal Load commands to image the bitmap on the display Copyright 1992 2010 by ACS Sarasota Florida 35 ALL RIGHTS RESERVED ACS Basic User s Manual VGAx Statements The following VGA statements operate on the optional Video Graphics Adaptor Adaptor installed in the CFSound 3 Attempting to execute these VGA statements without a VGA module installed results in a No VGA module error The VGAx statements affect the current VGADRAWPAGE and utilize screen coordinates that start from x 0 y 0 in the upper left corner to x VGA WIDTH 1 y 0VGAHEIGHT 1 in the lower right corner 0 0 VGAWIDTH 1 0 D
96. s via DIR N INPUT N FINPUT N PRINT N or FPRINT N statements The options string characters are ep opens file for reading if path does not exist an error is generated ew opens file for writing if path exists its contents are destroyed r opens file for read and write the path must exist gt opens an empty file for read and write if path exists its contents are destroyed ay Opens file for reading and appending seek to end of file after open b opens file in binary mode no translations opens file in text mode default CR LF pairs are ep translated to LF on input and LF translated to CR LF pairs on output ORDER line Program mode only This statement positions the read data pointer to statement line number The statement at line must be a series of one or more DATA statement PLAY file Plays the sound file and waits until it completes Program execution then continues with the next statement If the file is not a valid WAN file of the correct format sample rate and sample size for the CFSound 3 an Invalid WAV File Error is generated File may be a constant string or you can use a string variable as the file by concatenating it to such a string PLAY P8 While the sound file is playing Events can occur during the PLAY statement but any defined ONEVENT handlers will not be executed until the sound has finished playing In order to play sounds while continuing
97. sor Down 27 91 66 gt Cursor Right 27 91 67 1 Cursor Up 27 91 65 Fl Function 1 27 79 80 F2 Function 2 27 79 81 F3 Function 3 27 79 82 F4 Function 4 27 79 83 F5 Function 5 27 79 84 F6 Function 6 27 79 85 F7 Function 7 27 79 86 F8 Function 8 27 79 87 F9 Function 9 27 79 88 F10 Function 10 27 79 89 F11 Function 11 27 79 90 F12 Function 12 27 79 65 Copyright 1992 2010 by ACS Sarasota Florida 75 ALL RIGHTS RESERVED
98. sound frame number to start DMX channels fading up down to make the show happen 10 REM Program to fade DMX controlled lamps up and down during the playout of audio file 15 REM Start DMX 20 DMXMASTER 1 SOUNDFRAMEPRESCALER 50 25 REM Stop Show 30 SOUND ONEVENT SOUNDFRAMESYNC GOSUB GOSUB 9000 35 REM Check for show start button 40 IF ACLOSURE 24 0 THEN 40 42 CLOSURE 24 0 45 REM Show start 5 ONEVENT SOUNDFRAMESYNC GOSUB 1000 55 SOUND ALAMO WAV 60 REM Check for show end sound or button 65 IF CLOSURE 25 AND SOUND lt gt THEN 65 70 CLOSURE 25 0 SOUND 75 GOTO 25 1000 REM Sound Frame Sync handler 1005 S SOUNDFRAMESYNC 1010 REM Phil s Intro 1015 LIF S 1 THEN C1 0 11 255 M1 127 GOSUB 10100 RETURN 1020 REM Charli 1025 LIF S 170 THEN C1 0 11 127 M1 0 GOSUB 10100 C0 1 10 0 M0 255 GOSUB 10000 RETURN 1030 REM Lunette 1035 LIF S 185 THEN C1 1 11 255 M1 0 GOSUB 10100 10 0 M0 255 GOSUB 10000 RETURN 1040 REM Bowie s room 1045 LIF S 220 THEN C1 2 11 255 M1 0 GOSUB 10100 10 0 M0 255 GOSUB 10000 RETURN 1050 REM Kitchen 1055 LIF S 243 THEN C1 3 11 255 M1 0 GOSUB 10100 10 0 M0 255 GOSUB 10000 RETURN 1060 REM Ramp 1065 LIF S 249 THEN 11 255 M1 0 GOSUB 10100 10 0 M0 255 GOSUB 10000 RETURN 1070 REM Gunade 1075 LIF S 281 THEN C1 5 11 255 M1 0 GOSUB 10100 10 0 M0 255 GOSUB 10000 RETURN 1080 REM Trevino 1085 LIF S 295 THEN C1 6 11 255 M1 0 GOSUB 10100 C0 7 10 0 M0 255 GOSUB 10000 RETURN
99. string consisting of length number of characters of string variable from zero based start character position MULDIV number multiplier divisor Returns a 16 bit result of number multiplier divisor where number multiplier and divisor are 32 bit internally Useful for calculating percentages etc where the normal multiply would overflow a signed 16 bit number 10 REM calculate 55 percent of 999 20 PRINT MULDIV 999 55 100 MULMOD 999 55 100 Ready run 549 45 CopyrightO 1992 2010 by ACS Sarasota Florida 48 ALL RIGHTS RESERVED ACS Basic User s Manual MULMOD number multiplier divisor Returns a 16 bit result of number multiplier divisor where number multiplier and divisor are 32 bit internally Useful for calculating remainders of percentages etc where the normal multiply would overflow a signed 16 bit number RGB red green blue Returns a 16 bit color value for use with the VGAx statements where red green and blue are packed into a RGB565 format for the VGA 5 bits of red 6 bits of green and 5 bits of blue 65536 colors The red green and blue arguments are limited to a range of 0 255 low order bits are truncated RIGHT var len Returns a string containing the rightmost length characters of string variable REPLACE var start var2 Returns a string variable with the contents of variable2 overwritten at zero based position start REM test replace s ABCDEFGHIJK
100. t integrator developed programs 11 09 10 o MAX STRING SIZE from 127 to 255 characters Added GETCH x nction to allow working with single serial or PS 2 characters ded MSGENABLE specialvar to allow GETCH x to work with serial characters by disabling the MSGS specialvar Added support for Mensioned string variables Added ability to escape LIST and TYPE commands ed RESQ resequencing command Added support for VGA PS 2 numeric keypad and function keys Added FPRINT 4N to complement FINPUT N Corrected erroneous repeating error message display when running incorrect integrator developed program Changed N range from 0 9 to 0 23 so up to 24 files can be open Corrected operation of LIST command when used with a single line Fixed problem with undetected FREAD past valid data added new error 50 FREAD record Out of Range Added setting of FEOF N on FOPEN N if the file is empty CopyrightO9 1992 2010 by ACS Sarasota Florida 71 ALL RIGHTS RESERVED ASCII Table Dec Hex Octal Character 0 00 000 NUL null 1 01 001 SOH start of heading 2 02 002 STX start of text 3 03 003 ETX end of text 4 04 004 EOT end of transmission 5 05 005 ENO enquiry 6 06 006 ACK acknowledge 3 07 007 BEL bell 8 08 0
101. t not start with a leading backslash When LOAD is used within a program execution continues with the first line of the newly loaded program In this case the user variables are not cleared This provides a means of chaining to a new program and passing information to it When used in a program note that LOAD must be the last statement on a line If not present the BAS file extension on the filename at the end of the path is assumed load program1 Ready list 10 PRINT Program 1 A 20 a a 1 30 LOAD program2 Ready load program2 Ready list 10 PRINT Program 2 A a a a 1 LOAD programi Ready run Program Program Program Program ESC at Ready MD path Direct mode only requires a CF card Makes a new directory on the Compact Flash card Path must be a complete path for the new directory without the leading backslash and 1t must not already exist Path may be a constant string or you can use a string variable as the path by concatenating it to such a string MD P CopyrightO 1992 2010 by ACS Sarasota Florida 21 ALL RIGHTS RESERVED ACS Basic User s Manual MEMORY Displays the currently available program memory and CF card memory if a CF card is present NEW Direct mode only Erase all program statements clear all variable values and closes all open files NEXT var Program mode only End of a counted loop Statement execution resumes with the matching FOR statement if the step increment of the control variable
102. te OD E ARTES 49 RIGHTS var len eet rr re DRIED atta rr ou wee AL ae adores 49 REPE AGCES var start Vii ida 49 DND eet eto arto E a AU Ab RON A ON 49 ill tee E RE A0 RE RE 49 VAL GX DIB ettet et e etie peti e eet e ed rt d e ete e eed 49 A eege geesde Ee EE EE Ee egen 50 Examples mper ee 52 Setting the Real Time Clocks 2i tse eege ee EE 52 BR RT RE DEE 53 Different Sounds for Contact Closure Opening 54 Starting Stopping a Sound with a Single Button oooncnnccnnonnonnnonoconoconccononononnnonnnonn nono non conc cnn co nennen 54 Activating Multiple Output Contacts for a Sound 55 Control froma Serial Port etr ertet eter peter eere eee e eire dE a eno ee eue eo 56 Westminster COMES nere re ER RR OPERETUR EES ee Ee ETE Ee 57 Jukebox with Display o iie Re eret e e re t or ob add d dude ed 60 Fixed Length Record File T O tee e lg een eee He EUER reete EEE ies 64 Error LEogging san hao HR e EISE duet ote 65 DMX Control Synchronized to Sound sieissanto iiser ieir ir Er nennen rennes 66 Play Random Announcement Periodically eese ener nennen 68 VGA Display of Random Colored Triangles esses eene nennen nenne 69 VGA Display of Seconds on top of a bitmap 00 eee eee eeeceesceeecesecaeceaecsaecaeecseseseseeeeeeeeeeeeseenseenaes 69 Firmware PBevisions nasi iaie 70 AS CIRM able iii ia Ti 72 PS 2 ANSI Character SCQUuencCes s ecccseeeseseeeseeeeeeeeeeeenees
103. tement The maximum number of nested FOR NEXT loops and GOSUB subroutines is currently 50 CopyrightO1992 2010 by ACS Sarasota Florida 18 ALL RIGHTS RESERVED ACS Basic User s Manual FOPEN EN recordlength path Opens filename path as a fixed record length file DN 0 23 for subsequent sequential random access via FREAD FWRITE statements If recordlength is negative or greater than 255 it is forced to 255 The recordlength includes the trailing CR LF character pair that terminates each record If the file is empty FEOF N will be set FPRINT EN expr expr Prints one or more expression s to the file N 0 23 that is OPENed for writing as a single line The data items on the line in the file are separated by commas with string values surrounded by double quotes The produced file is compatible with the FINPUT N statement FREAD HN recordnumber var var var Reads ASCII data from fixed length records on file N 0 23 opened by FOPEN N into the list of variables Before the data is read the file is positioned to the desired recordnumber 0 lt recordnumber lt 32767 A negative recordnumber seeks to the end of the file Reading at the current end of the file sets the FEOF N specialvar and signals the associated event Note that when an end of file occurs the variables will have their last value from a prior successful FREAD Reading past the current end of the file generates a
104. tement may be activated when this event occurs LCDADDRESS This special variable sets the current value of the LCD address to be used with all of the LCDx commands When a LCDx statement is processed the value of LCDADDRESS is tested If LCDADDRESS is set to a value greater than or equal to zero the generated LCDx commands include the LCD address prefix characters 0 LCDADDRESS lt 255 inserted after the initial SOH and before the command character If LCDADDRESS is set to a value less than zero the generated LCDx commands do not include the LCD address prefix characters LCDADDRESS defaults to a value of 1 when ACS Basic is started the NEW statement is executed or a program is loaded See the ACS LCD 128x64 and ACS LCD 320x240 Display User Manuals for additional information about display addressing LCDTYPE This special variable sets the current value of the LCD type which controls the operation of the LCDx commands The currently supported values are 0 ACS LCD128x64 command formatting the default 1 ACS LCD320x240 command formatting LCDTYPE defaults to a value of 0 when ACS Basic is started the NEW statement is executed or a program is loaded See the ACS LCD 128x64 and ACS LCD 320x240 Display User Manuals for additional information about display addressing SOUNDFRAMEPRESCALER This special variable sets the value of the number of 20mSEC 50Hz ticks that elapse between SOUNDFRAMESYNC events while
105. that can be accessed randomly Now the program begins normal operation Lines 250 275 fades down the volume disables the line input restores the volume to the current setting and then plays a random selected WAV file Lines 290 310 minimizes the volume enables the line input fades up the volume to the current setting and waits for the inter announcement time delay to expire before the process is repeated 5 REM 88 28 od ode 2 2 o ode ade ode al le le ode od a le ode od a le le od ad le ale ode od a le le od al e 10 REM Play random announcement periodically 20 REM xke OO OO OO OO OO OK K OK OE 25 M 15 REM minutes between announcements 30 REM Ad ee K K ok ok ad ad ade ade ade ale ale ale oe oe oe oe ad ok ade ade ade ade ale ale ale ale ale 31 REM Capture directory of WAV files 32 REM xke k ak ak k 3 ak OK OK OK OK HK KK 2K K K 35 REM 40 OPEN 40 DIRLIST TXT w 50 DIR 0 WAV 60 CLOSE 0 65 REM kkk 3k ak ak 3k ak k 3k ak k 3k ak k 3k ak k 3k ak k 3K ak k 3K K k K K 66 REM Count number of WAV files found 67 REM K ade k K k ok ok ok ade ade ode ale ale ale ale oe a e ok ad ade ade ade ode ale ale ale ale ak ke 70 OPEN 0 DIRLIST TXT r 80 N 0 INPUT 0 L IF FEOF THEN 150 W FIND L WAV IF W 0 THEN 100 N N 1 GOTO 100 CLOSE 0 OPEN 0 DIRLIST TXT r REM kk ok ok ok SK ade ade ade ok ok ok oe oe ok ok oe ok ade ade ade ode ok ok ke ale oe oe oe oe ok ad ade ade ade ale ok ale oe oe oe oe
106. the sound is playing Here s how it works The program runs a loop in lines 10 through 30 looking to see if an input closure was detected on contacts 25 and 26 A closure on contact 25 jumps to line 100 A closure on contact 26 jumps to line 200 This process is referred to as polling the input contacts for closures Starting at line 100 the desired output contacts are activated then the sound is played then the output contacts are deactivated The contact closure is cleared and the program starts polling again The same process is programmed starting at line 200 for the other contact and desired output contact configuration 5 REM Poll the two contact inputs for closures 10 IF CLOSURE 24 THEN GOTO 100 20 IF CLOSURE 25 THEN GOTO 200 30 GOTO 10 100 REM Input 25 had a closure 110 CONTACT 1 CONTACT 1 1 120 PLAY ONE WAV 130 CONTACT 0 CONTACT 1 0 140 CLOSURE 24 0 150 GOTO 10 200 REM Input 26 had a closure 210 CONTACT 1 CONTACT 2 1 220 PLAY TWO WAV 230 CONTACT 1 0 CONTACT 2 0 240 CLOSURE 25 0 250 GOTO 10 CopyrightO1992 2010 by ACS Sarasota Florida 55 ALL RIGHTS RESERVED ACS Basic User s Manual Control from a Serial Port The CFSound 3 can be controlled by serial commands in CFSound mode If your application requires custom functionality in addition to being controlled by serial commands use the 9 MSGS special variable to implement a serial protocol This example shows a simple three
107. ual ONEVENT specialvar GOSUB line Program mode only Provides semi asynchronous event handling via subroutines Certain ACS Basic special variables can trigger events The ONEVENT statement allows the event to be associated with the execution of a subroutine When the event occurs after execution of any current statement that does not transfer control control is transferred to the subroutine starting at line While in the event subroutine only higher priority events will be recognized until after the RETURN statement is executed An event handler can be disabled by specifying a line number of zero Executing the ONEVENT statement clears the associated event in preparation for the subsequent event handling The following special variables can cause events and are listed in order of decreasing priority ESOUNDFRAMESYNC The event occurs every SOUNDFRAMEPRESCALER x 20mSEC while a sound is playing DMXFRAMESYNC The event occurs after a DMX frame is sent master or received slave v1 24 or later The event occurs one time whenever the timer counts down to zero Special TIMER x variable TIMER 0 is the highest priority followed by TIMER 1 then TIMER 9 0 lt x lt 9 CLOSURE x The event occurs whenever the associated CFSound 3 contact has closed 0 lt x lt 55 GOPENING x The event occurs whenever the associated CFSound 3 contact has opened 0 lt x lt 55 The event occurs a
108. y also optionally be used to selectively address multiple displays by inserting the display address into the generated commands See the ACS LCD 128x64 or ACS LCD 320x240 Display User Manuals for additional information about these command s arguments LCDPRINT row s col font type justify expr LCDTYPE 0 LCDPRINT rowstart col font type justify expr LCDTYPE 1 Displays an expr on an ACS LCD display connected to the CFSound 3 serial port LCDUNPRINT row s col font type justify expr LCDTYPE 0 LCDUNPRINT rowstart col font type justify expr LCDTYPE 1 Un displays an expr on an ACS LCD display connected to the CFSound 3 serial port LCDCLEAR row s colstart colend LCDTYPE 0 LCDCLEAR rowstart rowend colstart colend LCDTYPE 1 Clears an area of the screen on an an ACS LCD display connected to the CFSound 3 serial port LCDGRAPHIC row s col data LCDTYPE 0 only Displays a byte of data on an ACS LCD display connected to the CFSound 3 serial port This command is not supported on the ACS LCD 320x240 display LCDLINE startx starty endx endy color Displays a line on an ACS LCD display connected to the CFSound 3 serial port LCDBOX corner1x corner1 y corner2x corner2y color Displays a box on an an ACS LCD display connected to the CFSound 3 serial port LCDPIXEL x y color Displays a pixel on an ACS LCD display connected to the CFSound 3 serial port LCDCIRCLE x y radius color Draw

Download Pdf Manuals

image

Related Search

Related Contents

Manuel d`installation pour douche coulissante avec      Quinny CV080 User's Manual  errata - Index of  Ewent EW3556 mobile headset  Fenoxaprop-P-Ethyl 45 EC  normas de operacion - Pipeline Inspection Co. Ltd  取扱説明書(PDF) - ecg-kokusai co.,ltd  

Copyright © All rights reserved.
Failed to retrieve file