I dug out a real old project and blew the dust off it.
It put a screen up with 4 buttons and a text box on the PC
and when you pressed a button,up , down, left, right... ON THE SCREEN it would display text in the text box and send the text out the COM2 port to a PIC16F84 chip waiting with SERIN and the PIC would turn on relays for motors.
Here is the heart of the action, the subroutine that talks to the PIC:
SUB sendsom(stuff$)
displaybox.Text=stuff$
OPEN "COM2:300,N,8,1,CD0,CS0,DS0" FOR RANDOM AS #1
PRINT#1,stuff$;
CLOSE#1
END SUB
and when events happen they call subroutines that are
assigned to those events so when you make a button on the screen
, such as downbutton, it has an event associated with it called a CLICK so you get to have a subroutine called
downbutton_Click that executes when you click the downbutton
....real simple event driven programming... thank you Bill Gates
for this FIRST time ever event driven language.
SUB downbutton_Click()
sendsom("DOWN")
END SUB
Bookmarks