Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
Hi, I have a steel frond cash drawer connected to my com port. I need to create a small program in VB.NET to open the drawer. The drawer's manual has some code and I don't understand a single line of it. The code is as follows, it says that the code is in QBASIC:

OPEN "COM1:300,N,8,1"
FOR RANDOM AS #1
PRINT #1, "0000000000"

I need to implement the open functionality via VB.NET. Please help

Out of curiosity: What is QBasic? Never heard of it.
Posted

1 solution

Start by looking at reference and examples here http://msdn.microsoft.com/en-us/library/system.io.ports.serialport.aspx[^].

You need to open a com port with 300baud, no parity, 8 data bits and 1 stop bit.

After that you can create a stream to write and read from the serial port.
 
Share this answer
 
Comments
thatraja 1-Jun-11 22:42pm    
Yep, 5!
obhasha07 1-Jun-11 22:57pm    
"You need to open a com port with 300baud, no parity, 8 data bits and 1 stop bit.". OK that explains the first line of QBasic. But what does
FOR RANDOM AS #1
PRINT #1, "0000000000"

those two lines mean? I think the first one should be a for loop to create a random number. Also, where sould I call these commands? Is it in the SerialPort.Write() method?
Mathew Crothers 1-Jun-11 23:07pm    
In QBasic opening a stream started with an OPEN command then finished with a FOR (type) and a file number.

So FOR RANDOM AS #1 means open the com port for RANDOM access and assign it the file handle #1

PRINT #1, "0000000000" just means write "0000000000" to the file handle #1.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900