|
-
Jul 25th, 2006, 11:16 AM
#1
Thread Starter
New Member
USB Port like COM Port
Hi guys !
I'm new in the forum and I want to know if it posible simulate USB port like a COM Port ? I have an app that works with a touch screen and a printer, but the PC haven't two COM Ports.
How must to do the comunication with 2 devices?
Someone could help me ?
Thanks in advance.
-
Jul 25th, 2006, 02:35 PM
#2
Re: USB Port like COM Port
If you want to connect 2 serial devices to a computer you need 2 COM ports (or a serial switch, if they don't have to be connected at the same time). If the computer has USB ports, use USB->serial adapters. The code is the same, just the number of the port will be different - COM5 instead of COM2, for instance.
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
-
Jul 27th, 2006, 09:36 AM
#3
Thread Starter
New Member
Re: USB Port like COM Port
Hi Al42 !
I got an USB Adapter and I can instaled properly. If I try to print a document, we haven't any trouble. But when my app try to print, nothing occurs. In Our code, nothing changed.
Question : I need to configured anything else ?
Thanks
-
Jul 27th, 2006, 03:43 PM
#4
Thread Starter
New Member
Re: USB Port like COM Port
Hi people !
For any reason, my app cant use simultaneously the printer (COM3 like USB Serial Adapter) and Touch screen (COM1). My PC have one Serial Port and one USB Port.
The point is, when I verified the printer configuration, was ok and also in the touch screen configuration. The printer works properly for any document, except with app.
Can somebody help me , and suggest any idea ?
Thanks
-
Jul 28th, 2006, 03:01 AM
#5
Re: USB Port like COM Port
The printer works properly for any document, except with app.
How is that "document" print. Is "app" a VB-program. Do you print to a printer or a comm-port?
I verified the printer configuration
How?
You see, your question is not quite clear.
-
Jul 28th, 2006, 08:56 AM
#6
Thread Starter
New Member
Re: USB Port like COM Port
Hi Namrekka, I 'll try to explain.
I have a VB App that works with touch screen and a terminal printer (like automatic cashier). Both devices need COM ports. The standardt PC have 1 COM port and 2 USB port.
The touch screen use COM1 Port and is instaled properly, because the app response very good to the events.
The printer is instaled in PC using USB Port (simulating a COM3 using
USB Serial Adapter)
When I'm going to print a flat file, the printer receive the data, it go to the buffer and goes on without problem
When I'm going to print using the VB app to print a label, the data go to the buffer and stay there permanetly and nothing it happens.
I suppose that I need configure inside the code something to manage this "simulation"... but I don't know what ?
Thanks.
-
Jul 28th, 2006, 09:36 AM
#7
Re: USB Port like COM Port
When I'm going to print a flat file
But how?
When the printer is installed in Windows you can use the "Printer" object in VB. It doesn't matter if the printer is physically connected to LPT, COMM or network.
-
Jul 28th, 2006, 03:39 PM
#8
Thread Starter
New Member
Re: USB Port like COM Port
Namrekka,
I using the Printer object, the app was developed with MSComm1 commands (PortOpen, DSRHolding,etc) and each line to print is manage inside the code (dates, amounts, texts, etc) like a ticket from cashier. When whole line is configurated, is sent to printer to print (with Printer.Print ............. ) but nothing it happens.
I Dont know why not print from app.....
-
Jul 28th, 2006, 09:27 PM
#9
Re: USB Port like COM Port
Printer.Print goes to the default printer, so you have to configure your printers (in Windows) so that the printer on the USB port is the default printer. But you said that the app requires that the printer be on a COM port - the Printer object doesn't have such a requirement, so if that's how you're printing, you can use any printer Windows can install.
You have to send your "configurated" line to MSComm1.Output to get it to pring on the serial port.
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
-
Jul 29th, 2006, 09:42 AM
#10
Re: USB Port like COM Port
 Originally Posted by Al42
Printer.Print goes to the default printer...
By default it prints to default printer. However, you may programmatically assign Printer object to any printer currently configured on your system.
-
Jul 31st, 2006, 04:51 AM
#11
Re: USB Port like COM Port
Did you use "Printer.EndDoc"? Is the printer visible in Windows? And how did you print the flatfile?
-
Jul 31st, 2006, 08:19 AM
#12
Thread Starter
New Member
Re: USB Port like COM Port
Al42,
I'm trying to use MSComm1.Output , but I get an error (invalid use of property) when compile.
Namrekka,
Yes, I use Printer.EndDoc and the printer is visible in Windows XP (set as Default Printer).
-
Jul 31st, 2006, 08:31 AM
#13
Re: USB Port like COM Port
Sorry, but I don't understand a thing of it. If the printer shows up in Windows and other app's can print via Windows, why do you use the MSCOMM object?
-
Jul 31st, 2006, 09:04 AM
#14
Thread Starter
New Member
Re: USB Port like COM Port
Because I have a touch screen in COM1 and the printer needs another COM port so is redirected to USB Port (simulating a COM Port ).
The problem is that by the app not recognize the printer.... and I don't know why ?
-
Jul 31st, 2006, 09:12 AM
#15
Re: USB Port like COM Port
If you start up "Notepad", type something and print what happens?
-
Jul 31st, 2006, 09:16 AM
#16
Thread Starter
New Member
Re: USB Port like COM Port
I did this test (like a flat file), and no problem appear
-
Jul 31st, 2006, 09:23 AM
#17
Re: USB Port like COM Port
In your code from your app you don't need any MSCOMM object at all. So delete everything with MSCOMM. Just do:
[VB]
Printer.Print "Bla bla"
Printer.EndDoc
[/VB]
Then the default printer, same printer as in NotePad before, will print.
-
Jul 31st, 2006, 10:05 AM
#18
Thread Starter
New Member
Re: USB Port like COM Port
Namrekka,
How know the app that need use the USB Port ? (like COM Port #3 in example ) ?
I use :
MSComm1.Settings = "9600,n,8,1"
MSComm1.CommPort = 3
MSComm1.PortOpen = True
MsComm1.Output = bla...bla...
Can i do to another way ?
Please, I want to learn.
-
Jul 31st, 2006, 10:17 AM
#19
Re: USB Port like COM Port
 Originally Posted by cgarci60
How know the app that need use the USB Port ? (like COM Port #3 in example ) ?
How does "NotePad" knows? The printer is installed in Windows and Windows does all the comm-work.
As I told before, remove all the MSComm1 stuf and just try these 2 lines:
[vb]
Printer.Print "Bla bla"
Printer.EndDoc
[/vb]
-
Jul 31st, 2006, 11:01 AM
#20
Thread Starter
New Member
Re: USB Port like COM Port
Namrekka,
I removed all MSCOMM commands and replace by Printer.Print
I'm sorry but doesn't work. My app not recognize the printer.
How can is possible ? I don't unsderstand
May be, is somethig about printer configuration ? (Like the Flow Control, Parity, bits per second, etc...)
-
Jul 31st, 2006, 11:51 AM
#21
Re: USB Port like COM Port
 Originally Posted by cgarci60
May be, is somethig about printer configuration ? (Like the Flow Control, Parity, bits per second, etc...)
"NotePad" does not use these things as well. Windows does all these controle stuf. Did you try the 2 lines? What error codes do you get?
-
Jul 31st, 2006, 03:12 PM
#22
Thread Starter
New Member
Re: USB Port like COM Port
Namrekka,
the problem was that in the Printer configuration the variable Flow Control was in None. When I changed it to Hardware, the printer works properly. So I'll try a couple of test and will go on.
Thanks to all.
-
Aug 1st, 2006, 02:48 AM
#23
Re: USB Port like COM Port
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|