Home > Vidicode > Communications System > Vidicode Argus Basic Programmers Reference Manual

Vidicode Argus Basic Programmers Reference Manual

    Download as PDF Print this page Share this page

    Have a look at the manual Vidicode Argus Basic Programmers Reference Manual online for free. It’s possible to download the document as PDF or print. UserManuals.tech offer 9 Vidicode manuals and user’s guides for free. Share the user manual or guide on Facebook, Twitter or Google+.

    							ARGUS Programmable Modem 
    BASIC Programmers Reference Manual 
    © 1990 - 1997 Vidicode Datacommunicatie BV 
    138
      
    ON BUTTON    USER button event handler 
    ON BUTTON is used to automatically detect the operation of the USER buttons on the modems front panel.  Pressing one 
    of these buttons will result in the immediate execution of the command following the ON BUTTON command. 
    10 REM Button demo
    20 ON BUTTON1 GOTO %Keypress
    30 %Start
    40 REPEAT
    50 PRINT GET$;
    60 UNTIL FALSE
    70 %Keypress
    80 PRINT BUTTON1 PRESSED
    90 GOTO %Start
    Pressing of the button can be detected up to 4 times a second.  Communication will not be affected by operation of this 
    function, and buffers are not emptied. 
     
    ON BUTTONn will remain active after the program is finished, and must therefore be disabled explicitly using ON
    BUTTONn OFF. 
     
    Button3 is the S/A switch, which has many useful functions in the modem environment. 
     
    You can use Button3 for your own purposes also; but because this switch remains in the in position when pressed once, a 
    second event will occur when it is brought back to the out position. 
    Examples: 
    ON BUTTON1 GOTO %Stop
    ON BUTTON2 PRINT DISCONNECT : DCD=0 : RUN 100
    ON BUTTON3 OFF
     
    Syntax: 
    ON BUTTON[integer 1...3] ...
    ON BUTTON[integer 1...3] OFF
      
    						
    							ARGUS Programmable Modem 
    BASIC Programmers Reference Manual 
    © 1990 - 1997 Vidicode Datacommunicatie BV 
    139
      
    ON CONNECT    connection detect event handler 
    This event handler can be used to automatically detect when a connection has been established with a remote system.  Thus 
    waiting for an incoming call can be a background process for your modem.  This means that your modem can be doing many 
    other things while waiting for a call.  The only thing you have to do is to tell your modem once which parts of your program 
    have to be executed when a call is detected (and when a connection is lost). 
    10 ON CONNECT GOSUB Answ
    20 REPEAT
    30 PUT GET
    40 UNTIL FALSE
    50%Answ
    60 PRINT Incoming call received..
    70 REPEAT UNTIL SREG50
    80 ...
    In the example above, the ON CONNECT command causes execution of the subroutine starting at the label %Answ. 
     
    After connection, the modem will always fill S-register 50 with the currently connected line-speed.  After a hangup it will clear 
    SREG50 again.  The line-speed is in bits 0 till 5 of this register; see SPEED for the possible values.  If bit 6 in SREG50 is 
    set then error correction is used (V42 or MNP) and if bit 7 is set then data compression is active (V42bis or MNP5). 
     
    To disable the operation of ON CONNECT use ON CONNECT OFF. 
     
    Pressing STOP or RESET will also disable ON CONNECT. 
     
    ON CONNECT is generally used in conjunction with ON HANGUP, but some care is needed to ensure correct program 
    operation.  Further details are given under ON HANGUP. 
    Examples: 
    ON CONNECT
    ON CONNECT GOTO %Phone
    ON CONNECT OFF
     
    Syntax: 
    ON CONNECT ...
    ON CONNECT OFF
    See also: 
    ANSWER, CONNECT, ON HANGUP
      
    						
    							ARGUS Programmable Modem 
    BASIC Programmers Reference Manual 
    © 1990 - 1997 Vidicode Datacommunicatie BV 
    140
      
    ON DTD    DTR loss event handler 
    There are two associated events, DTD (Data Terminal [Ready] Drop) and DTR (Data Terminal Ready).  These events help 
    your program respond to the status of your terminal. 
     
    For more information please refer to the description of ON DTR on the following page. 
    Examples: 
    ON DTD GOSUB Mailbox-entry
    ON DTD OFF
    Syntax: 
    ON DTD ...
    ON DTD OFF
    See also: 
    ON DTR, DTR
      
    						
    							ARGUS Programmable Modem 
    BASIC Programmers Reference Manual 
    © 1990 - 1997 Vidicode Datacommunicatie BV 
    141
      
    ON DTR    DTR event handler 
    When you enable a terminal program, or switch a terminal on, DTR goes high on the port to the modem.  Your modem can 
    react to this event with whatever procedure you like.  Like any event handler, this is a background process. 
     
    A likely use of this command is to let your modem go from whatever it is normally doing (e.g. operating as a mailbox) to 
    modem mode as soon as you start your terminal; and then return to its original function when you disable your terminal. 
     
    The following short program routine will make your modem flash its LEDs when your terminal is switched off, while remaining 
    in modem mode when your terminal is switched on (or your terminal program is enabled): 
    10 AT &D3
    20 ON RESET RUN
    30 REPEAT
    40 FOR X=1 TO 5
    50 WAIT 10
    60 LEDX=LEDX EOR 1
    70 NEXT
    80 UNTIL DTR#1=1 OR DTR#2=1
    90 MODEM
    The systems variable PORT will always tell you on what port the event happened. 
     
    The ON DTR event handler can be disabled with ON DTR OFF. 
    Examples: 
    ON DTR GOSUB Hayes-Modem
    ON DTR OFF
    Syntax: 
    ON DTR ...
    ON DTR OFF
    See also: 
    ON DTD, DTR
      
    						
    							ARGUS Programmable Modem 
    BASIC Programmers Reference Manual 
    © 1990 - 1997 Vidicode Datacommunicatie BV 
    142
      
    ON ERROR    error handler 
    The ON ERROR event handler allows errors that occur during the execution of a program to be trapped so that the 
    appropriate corrective action can be taken.  When ON ERROR is active, a run-time error will cause program execution to 
    jump to the first command following ON ERROR. 
     
    ON ERROR is often used with ERL, ERN and REPORT to obtain precise information about when an error occurred and 
    the type of error. 
     
    ON ERROR OFF is used to disable error handling so that any error causes immediate termination of the program.  In this 
    case the modem will automatically print the appropriate error message. 
     
    ON ERROR cannot be used to trap the following: 
    •STOP 
    •NMI/STOP 
    •RESET 
    •  errors that occur within an ON TIMEOUT routine. 
    Examples: 
    ON ERROR GOTO %Mistake
    ON ERROR REPORT : PRINT  at line ;ERL : END
    ON ERROR OFF
    Syntax: 
    ON ERROR ...
    ON ERROR OFF
    See also: 
    ERL, ERN, REPORT 
    						
    							ARGUS Programmable Modem 
    BASIC Programmers Reference Manual 
    © 1990 - 1997 Vidicode Datacommunicatie BV 
    143
      
    ON ESCAPE    Escape event handler 
    This event handler can be compared with ON ERROR, but will trap an escape only; and will only work when your BASIC 
    program is running. 
     
    ON ERROR will also trap an escape, but this event handler is easier to use if you want to trap escapes only. 
     
    ESCAPE events can only occur when escapes have been enabled with the ESCAPE command. 
    Examples: 
    ON ESCAPE GOSUB Switch
    ON ESCAPE OFF
    Syntax: 
    ON ESCAPE ...
    ON ESCAPE OFF
    See also: 
    ON ERROR, ESCAPE
      
    						
    							ARGUS Programmable Modem 
    BASIC Programmers Reference Manual 
    © 1990 - 1997 Vidicode Datacommunicatie BV 
    144
      
    ON ... GOSUB/GOTO    jump on value 
    ON...GOSUB and ON...GOTO are used to jump to another section of code depending on the value of a variable.  For 
    instance, if the user is asked to choose one item from a list of options, an ON...GOSUB command could be used to 
    execute the appropriate section of code for each option: 
    500%Menu
    510 PRINT 1) Read message
    520 PRINT 2) Send message
    530 PRINT 3) List program
    540 PRINT 4) Set password
    550 PRINT 5) Exit
    560 ON GET-48 GOSUB 600, 700, 800, 900,
    1000 ELSE %Menu
    600 ...
    If the user types 1, the subroutine starting at line 600 will be executed; if the user types 2 the subroutine at line 700 will be 
    executed; and so on.  If an invalid selection is made, then the ELSE clause of the ON...GOSUB command will be 
    executed and the menu will be re-displayed. 
    Examples: 
    ON Season GOSUB %Spring, %Summer, %Autumn, %Winter : ELSE %Error
    ON Type GOTO 100,150, 200
    Syntax: 
    ON [integer] GOTO [line-num | label] (, ...) : ( ELSE[line-num | label ]
    )
    ON [integer] GOSUB [line-num | label] (, ...) : ( ELSE[line-num | label
    ])
    See also: 
    GOSUB ... RETURN, GOTO
      
    						
    							ARGUS Programmable Modem 
    BASIC Programmers Reference Manual 
    © 1990 - 1997 Vidicode Datacommunicatie BV 
    145
      
    ON HANGUP    loss of connection event handler 
    When the modem is used to process incoming calls the ON HANGUP event handler can be used to automatically detect 
    when the connection has been lost. 
     
    Both ON HANGUP and ON CONNECT remain active after program execution has ceased.  ON HANGUP OFF should 
    therefore always used to disable the event handling at the end of a program. 
     
    Pressing the STOP button will always terminate all ON functions except ON RESET RUN.  The same applies for a RESET 
    or power interruption. 
    Examples: 
    ON HANGUP RESET
    ON HANGUP GOTO %Bye
    ON HANGUP OFF
    Syntax: 
    ON HANGUP ...
    ON HANGUP OFF
    See also: 
    ON CONNECT
      
    						
    							ARGUS Programmable Modem 
    BASIC Programmers Reference Manual 
    © 1990 - 1997 Vidicode Datacommunicatie BV 
    146
      
    ON OFF    disable events 
    The command ON OFF will disable all ON-events except ON RESET and 
    ON ERROR. 
    Example: 
    ON OFF
    Syntax: 
    ON OFF
      
    						
    							ARGUS Programmable Modem 
    BASIC Programmers Reference Manual 
    © 1990 - 1997 Vidicode Datacommunicatie BV 
    147
      
    ON RESET    reset event handler 
    ON RESET provides one of the most useful facilities in the modem, by allowing program operation to resume automatically 
    at a predetermined point, following a RESET or power failure.  The result of the reset procedure is that you can depend on 
    your modem to do exactly what you want it to when you power it up. 
     
    There are four ways in which a reset may occur: 
    •  the RESET button is pressed; 
    • a RESET command is executed; 
    •  there is a power failure, or power surge; 
    •  the internal watchdog circuit times out due to severe errors in programming. 
    If an ON RESET command is included in the program, any one of these events will cause it to be executed with the 
    following actions being taken: 
    •  all ports will be re-initialized 
    •  all buffers will be emptied 
    •ECHO will be switched on 
    •  RTS and DTR will be set to 1 (high) for all serial ports 
    •PRINTER will be turned off 
    •ON BUTTON will be disabled 
    •ON ERROR will be disabled 
    •ON TIMEOUT will be disabled. 
    All communications settings including BAUD, LENGTH, PARITY and LINK will retain their previous settings, and BASIC 
    variables will retain their values. 
     
    Because the reset function has the highest priority, the ON RESET procedures will be effective even if the modem was in 
    Modem mode.  Thus you can give priority to operation under BASIC after a power failure. 
     
    Read the small demonstration program given under ON DTR, to see the effect of ON RESET RUN. 
     
    When a reset occurs, four different situations are possible.  You have entered: 
    •ON RESET OFF (or the reset event is not yet enabled) 
    •ON RESET RUN FILENAME
    •ON RESET RUN
    •ON RESET .....
    When ON RESET OFF is valid (no reset event has been enabled yet) the modem will stay in the same mode as before 
    the reset happened - either modem-mode or BASIC. 
     
    However, when in BASIC mode, there are three further possible situations: 
    (a) A !BOOT program is found on the RAM-disk 
    The modem will load this program at &3000 (the default value of PBOT) and RUN it. 
    (b) No program running at moment of reset  
    						
    All Vidicode manuals Comments (0)

    Related Manuals for Vidicode Argus Basic Programmers Reference Manual