The premise is not to drive, write USB port directly, hope ace directions
CodePudding user response:
Used createfile to open the serial port for data reading and writing, usb should also canPlease refer to the following link
http://www.docin.com/p-63912601.html
CodePudding user response:
Please refer to open a serial port example with createfile//open port
Iu_file=CreateFileA (ls_com, 3221225472, 0, 0, 3, 128, 0)
If (iu_file & lt; 0) then
Gnv_app. Of_message (" unable to open "+ ls_com +" # "+ string (getlasterror ()), StopSign!)
If PortOpen then closehandle (iu_file)
PortOpen=false
Return PortOpen
End the if
//initialize the DCB
If (Not BuildCommDcbA (ls_commset lst_dcb)) then
Gnv_app. Of_message (" unable to create DCB "+" # "+ string (getlasterror ()), StopSign!)
If PortOpen then closehandle (iu_file)
PortOpen=false
Return PortOpen
End the if
//set port
If (Not setcommstate (iu_file lst_dcb)) then
Gnv_app. Of_message (" unable to set port "+ ls_com +" # "+ string (getlasterror ()), StopSign!)
If PortOpen then closehandle (iu_file)
PortOpen=false
Return PortOpen
End the if
//set the timeout
Commtimeouts lst_to
Lst_to. Readintervaltimeout=4294967295//MAXDWORD
//lst_to readtotaltimeoutconstant=60000
//lst_to readtotaltimeoutmultiplier=10
SetCommTimeouts (iu_file lst_to)
CommError=0
Return PortOpen
CodePudding user response:
I just want to use FileWrite write port, no problem, wrote before the COM now need to write just don't know how to make the USB portPreliminary understanding as PB make uncertain, may need to use VC or other language?
CodePudding user response:
Call the API should be able to solveCodePudding user response:
Is there any which old assembly?It seems the problem have higher difficulty (or remote), to solve the set to open 200 points, is not enough to say grateful of a drop in the bucket
CodePudding user response:
No, if you install a usb com driver, then use your com directly before, speaking, reading and writingCodePudding user response:
Thank LZP reply, but substitute driving for instruction, just returned to the problem: (Recently put this problem aside, ready to say
after Spring FestivalSeems to need to use VC to handle? Use VC for a long time, be flexible enumeration to a USB device, as the use of VC in also very troublesome
Still want an experienced player can provide examples
CodePudding user response:
I don't drive, is the purpose of reducing the operation of the terminal customers, more can't depend on a particular manufacturer of driverCodePudding user response:
I may want to know how to deal withCodePudding user response:
FileOpen (" PRN "/* USB port, such as \ \ server \ HP also go */, linemode! The write! , lockwrite! The replace!FileWrite (li_filename ls_PrtStr)
FileClose (li_filename)
Li_filename is directive
CodePudding user response:
After another wall bumps bumpsCodePudding user response:
Upstairs someone said, usb com port driver, usb is a serial port, so use drive to it for a com name should be okCodePudding user response:
Are posted, forget this didn't solveThank you for your participation, see have points!
CodePudding user response:
Put up for a long time, although not solve, thank you for your participation, see have points!CodePudding user response: