DigiTan
New Member
I'm a doing a PC interface project that involves having a AVR µcontroller connected to the COM1 port through one of those TLL/RS-232 converter chips (MAX232A). The electronics are looking nice; now I have to figure out to transfer stuff to and from this AVR.
Basically, I want to use the AVR's built-in UART. It's got 8 bits, no parity, 1 stop bit, and I'll probably have it run at 9600bps.
I'm in the process of (re)leaning QBasic just for this project (and maybe for later, but I won't go into that). I need to know how to get and send bytes using my COM1 port, so my questions boiled down to:
How do I declare the baud rate in QBasic?
It think this involves the "OPEN" command, because I could not get a lot of details on it. The tutorials and source code use it, but don't really explain the syntax of this instruction. Also, what other preferences are set by the OPEN command?
How do I send and receive?
To transfer data 1 byte at a time, exactly what syntax should I use? And what COM port pins are involved in this process?
What happens when the program detects incoming COM1 data?
I read somewhere that QBasic is able to jump into an interrupt when serial data arrives. This would be extremely helpful, because it'd prefer to use an interrupt rather that poll the port constantly.
What pins need to be used?
Most interface circuits on seem to need the "Receive Data," "Transmit Data," and "ground" pins. Would I ever need the other others like "Clear To Send," "Data Terminal Ready," etc? I'm guessing these are used to avoid collisions?
Basically, I want to use the AVR's built-in UART. It's got 8 bits, no parity, 1 stop bit, and I'll probably have it run at 9600bps.
I'm in the process of (re)leaning QBasic just for this project (and maybe for later, but I won't go into that). I need to know how to get and send bytes using my COM1 port, so my questions boiled down to:
How do I declare the baud rate in QBasic?
It think this involves the "OPEN" command, because I could not get a lot of details on it. The tutorials and source code use it, but don't really explain the syntax of this instruction. Also, what other preferences are set by the OPEN command?
How do I send and receive?
To transfer data 1 byte at a time, exactly what syntax should I use? And what COM port pins are involved in this process?
What happens when the program detects incoming COM1 data?
I read somewhere that QBasic is able to jump into an interrupt when serial data arrives. This would be extremely helpful, because it'd prefer to use an interrupt rather that poll the port constantly.
What pins need to be used?
Most interface circuits on seem to need the "Receive Data," "Transmit Data," and "ground" pins. Would I ever need the other others like "Clear To Send," "Data Terminal Ready," etc? I'm guessing these are used to avoid collisions?