CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

How to communicate between PIC18F4550 and USB Barcode Scaner

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
robo4



Joined: 20 Jun 2007
Posts: 3

View user's profile Send private message

How to communicate between PIC18F4550 and USB Barcode Scaner
PostPosted: Mon Aug 13, 2007 2:59 am     Reply with quote

Hi Everyone,I'm Mark.

I'm doing my project to connect USB Barcode Scaner(USB Low Speed of Metrologic,5145) with PIC18F4550.
And then I will show Barcode on LCD.
But Now,I can't to communicate between Barcode Scanner and PIC.
1. I want to know PIC can communicate with USB Device(such as Barcode Scanner,USB Keyboard,Flash Drive etc.)
or It can communicate with only computer.
2.Please tell me about How to communicate between PIC18F4550 and USB Barcode Scanerand How to set Register of USB Module.


Thank very much for your answers
Pret



Joined: 18 Jul 2006
Posts: 92
Location: Iasi, Romania

View user's profile Send private message

PostPosted: Mon Aug 13, 2007 4:31 am     Reply with quote

For this... you should read the related datasheet. First you must find out that the barcode scaner is not USB client also. If it is... you cannot link it to the PIC.

Usb is not as simple as UART or SPI. You need some experience with it. There are some examples in CCS compiler, you might find them useful.

Read the barcode scaner datasheet and find how to configure (interfaces, endpoints) the USB from PIC. If you do not have experience at all in USB related projects, you might find it quite complex.
kevcon



Joined: 21 Feb 2007
Posts: 142
Location: Michigan, USA

View user's profile Send private message

PostPosted: Mon Aug 13, 2007 7:04 am     Reply with quote

This is a USB client device and you will not be able to communicate with it using a USB PIC.

According to the manual, you should be able to switch the type of interface to RS-232 by scanning a configuration bar code.

ftp://ftp.metrologic.com/pub/download/productmanuals/00-02544.pdf
ftp://ftp.metrologic.com/pub/download/productmanuals/70-79016.pdf
robo4



Joined: 20 Jun 2007
Posts: 3

View user's profile Send private message

PostPosted: Tue Aug 14, 2007 8:43 am     Reply with quote

Acording to above, How can I use USB Barcode Scanner with Microcontroller? and What type of Microcontroller will I use?



Thank very much for your answers
Ttelmah
Guest







PostPosted: Tue Aug 14, 2007 8:58 am     Reply with quote

With the PIC, once it is programmed to RS232.
To run it using USB, you _might_ be able to use the FTDI Vinculum.

Best Wishes
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Tue Aug 14, 2007 10:06 am     Reply with quote

Additional short info on USB:
In USB you have one host and many possible slave devices. Because the barcode reader acts like a slave this has the result that your microcontroller must act like the host. A host is difficult to implement as it has to support plug&play, device descriptors, etc. You don't want to write this yourself, so this leaves open only operating systems that implement this for you like, Windows, Linux, etc. These large operating systems don't run on a PIC processor, you will have to look for something like an ARM or MIPS processor.
From asking the question my guess is you don't have a lot of experience, then don't try this and forget about USB.

From the other posts I understand the barcode reader can also be configured for RS232. This is a completely different story. Much, much, easier than USB and can be handled by a PIC processor.
robo4



Joined: 20 Jun 2007
Posts: 3

View user's profile Send private message

PostPosted: Fri Aug 24, 2007 11:52 am     Reply with quote

Um.... Somebody told me that I can use MAX3421E to be USB HOST.
And I try to study its datasheet.It's might be possible
What is your opinion?


Thank You For Your Advices?
datasheet of MAX3421E : http://www.alldatasheet.com/view.jsp?Searchword=MAX3421E
Ttelmah
Guest







PostPosted: Fri Aug 24, 2007 12:23 pm     Reply with quote

Seriously, anyone who 'knows' Maxim chips, will suggest the Vinculum instead. This does the same job, and the availabilty of Maxim chips, when they are not already in huge stocks with suppliers, makes these a poor choice for many projects....

Best Wishes
kevcon



Joined: 21 Feb 2007
Posts: 142
Location: Michigan, USA

View user's profile Send private message

PostPosted: Fri Aug 24, 2007 1:02 pm     Reply with quote

An even easier solution would be to get the RS232 cable for your gun from Metrologic or make you own and communicate with it serially.

If I remember right the gun puts out TTL levels and there is a driver chip embedded in the cable to make the signals RS232 levels. So if you made your own cable you might not need any interface chips, but you would have to verify this with a scope.
Ttelmah
Guest







PostPosted: Sat Aug 25, 2007 7:26 am     Reply with quote

It is worth saying that with the serial cable, you could have this working in a couple of days. Implementing a USB host, for the device, even if you know the coding needed by the chip involved, is likely to be a few weeks work, and starting from scratch, is likely to take longer. Unless you absolutely 'must' have the USB solution, the serial solution is dozens of times easier...

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group