Hi guys (and gals)
I am generally not a very technical programmer so feel like I am beating my head against a wall, I hope that you can shed some light...
My problem is that I am trying to pop open a cash drawer wich is connected to my machine via COM3 (my modem port) Now it seems quite a simple task you send a character or two to the port/drawer and it pops open.
I am trying to do this via vb.net at the moment (but have tried hyperterminal and dos to test unsuccesfully) I think Ive got the connection to the com port as a little icon pops up in my taskbar displaying to that affect but doesnt show any bytes moving around. So I think that my problem lies in writing to the port correctly?
here is an example of VB6 code they suggest you can use...
Here is the code that I am trying to write to the port with in .NetCode:Dim IntFreeFile As Integer 'Set IntFreeFile to the next available file number IntFreeFile = FreeFile 'Open the parallel port with #IntFreeFile Open "LPT1" For Output As #IntFreeFile 'Print to the parallel port, This is the line that fires the drawer. Print #IntFreeFile, Chr$(27) + "p" + "0" 'Close the port Close IntFreeFile
Has anyone done anything similar? Any advice? even maybe how to do this via Hyperterminal or something...(im getting desperate!) :PCode:Dim dt(255) As Byte Dim written As Integer Dim AE As New ASCIIEncoding Dim count As Integer = 0 '-- Was using all these characters to test... For count = 0 To 255 dt(count) = AE.GetBytes(Chr(count))(0) Next 'Check if our comport is open If Opened = True Then WriteFile(hPort, dt, 256, written, Nothing) '-- Etc..




Reply With Quote