Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Serial Mouse

Paul_WPaul_W Member Posts: 3
I dunno how stupid or pointless this quesiton is but I'm gonna ask it anyway. Is it possible (and practical) to take input from the a second mouse in Qbasic? I don't need it to me recognised as a mouse, just as a serial device. I figured that it'd be sending data down the line so maybe that data can be read like a file but used to direct a cursor or measure revolutions or movement or whatever.. Maybe I'm talking garbage, but it seems to make sense to me. I'm new to hardware interfacing so code examples would really help.

Any and all help is appreciated


Paul.

Comments

  • mstechcamstechca Member Posts: 64
    It isnt a stupid question!

    To read data from a serial port, you can do one of two things:

    Use the open command. The following statement opens com port 1 and sets the baud rate (bits per second) to 1200, sets parity to nothing (n), sets data bits to 7, and sets stop bits to 1, and op0 means use no timeout.

    open "com1:1200,n,7,1,op0" for binary as #1

    OR, if you know the port address, you can issue INP and OUT staements.
    You can find out port addresses by checking the device in Windows device manager, or through the MSD utility. (Microsoft Diagnosis?)

    This example reads one byte from the standard com1 port (3F8) and then writes the same value back.

    item% = inp(&H3F8)
    out &H3F8,item%

    the &H in front of the characters indicates that those characters form a hexadecimal digit.

    so: 0x330 = &H330 = 330 hex.

Sign In or Register to comment.