Back to top

AKD-Basic, Any info on INTR.MSG?

0 votes
+ vote
Vote up!
I see a description that says an interrupt is generated "When a character is received"....Any additional info?  Thanks!
0 Comments

1 Answer

0 votes
+ vote
Vote up!

Hello,

 

The INTR.MSG interrupt statement runs its interrupt service routine when any character is inputted by an input statement in program that has been received by the console tab in the program.  See the example program it demonstrates how the INTR.MSG interrupt statement is executed.

 

'-------------- Device Params -----------------------
Params 
End Params

'-------------- Define (dim) Global Variables --------
Dim Cycles, Dog as integer 
'Cycles is used in the output flashing ciruit in the interrupt so we can see it is there.  
'Dog is used with the Input Statement so a message can be received
'-------------- Main Program -------------------------
Main 
While 1 =1 
    INTR.MSG = 1' Turns the Message Interrupt On
    While DIN1.STATE = 1' Top of While-Wend Loop
        Input "Just hit carriage return" , Dog' Will sit on this line until an input is made.  This will trigger the Interrupt
    Wend'  Bottom of the While-Wend Loop
Wend    
End Main

'-------------- Subroutines and Functions ------------

'-------------- Interrupt Routines -------------------
Interrupt MSG ' This is the top of INTR.MSG 
    For Cycles = 1 To 5
        DOUT1.STATEU = 1
        DOUT2.STATEU = 0
        Pause (0.2)
        DOUT1.STATEU = 0
        DOUT2.STATEU = 1
        Pause (0.2)
    Next 
    DOUT1.STATEU = 0
    DOUT2.STATEU = 0
    For Cycles = 1 To 3
        DOUT1.STATEU = 1
        DOUT2.STATEU = 1
        Pause (0.1)
        DOUT1.STATEU = 0
        DOUT2.STATEU = 0
        Pause (0.1)
    Next 
    INTR.MSG = 1' Interrupts must be turned on again, otherwise it is just a one shot.
End Interrupt

Comments

Does this only work if an inkey$ or input command is active? Or will it fire as long as the interrupt is enabled and any character is received?
Thanks!

H.Bernier - Tue, 03/10/2020 - 08:47

The INTR.MSG interrupt statement runs its interrupt service routine, only when a input statement command is executed.

[email protected] - Tue, 03/10/2020 - 08:55
Log in or register to post comments
ANSWER THIS QUESTION
You may login with either your assigned username or your e-mail address.
The password field is case sensitive.

If you do not have an account, click here to register.