Can the PIC microcontroller be a USB Host for USB perhiperals ?

Discussion in 'Embedded Systems and Microcontrollers' started by a.salah, Mar 25, 2009.

  1. a.salah

    Thread Starter Member

    Mar 24, 2008
    Hello Folks,

    i am doing a project that contains a barcode reader that reads barcode from a product and then transfer it to a PIC microcontroller that will forward it to a ZIGBEE transceiver.

    i want the PIC microcontroller to take the input from the barcode reader so i want a communication link between them?

    i am thinking of USB connection, so i should make the PIC as a USB Host

    is that possible? or if there are another ways to get the barcode and the pic communicated ?

    Thank you

    Ahmed Salah
  2. AlexR

    Well-Known Member

    Jan 16, 2008
    The 8 bit PICs (PIC16/PIC18 series) can only act as USB peripheries.
    I do have a vague recollection of reading somewhere that some 16 bit PICs (PIC24 series) can be set up as hosts but I would have thought that a bar code reader with a serial interface would be simpler to interface to a PIC. Its not as if you need the speed of USB if all you are doing is reading bar codes.
  3. a.salah

    Thread Starter Member

    Mar 24, 2008
    thank you AlexR for your replay

    actually the circuit that contains the bar code and the pic will be on the hyper market karts so that the customer will pass the product through the reader and will be charged from his mobile credit.

    i am taking the electronics part of the project that is the implementation of the device that will be integrated in the hypermarket karts.

    if the serial connection is easier so can you guide me where i can start designing the interface between the barcode reader and the PIC?

    Thank you

    Ahmed salah
  4. kristt2001

    New Member

    Oct 13, 2009
    Hi, i am doing a similar project. did u get this to work?
  5. BMorse

    AAC Fanatic!

    Sep 26, 2009
    this is actually quite simple to do over RS232 to Pic, I have designed a circuit before that would read an input from either a Metrologic or Spectra Physics scanners, (although it would work with any RS232 interface scanner, either the hand held or the counter mount with or with out scale). The pic was instructed to gather data from scanners and pass information to a PC, then it would wait for a response from the PC and send information to another pic that controlled automated machinery.

    What type of barcode symbology are you going to be scanning/decoding? (i.e. UPC-A,UPC-E, EAN128, etc...) I guess that would not matter if the pic was just retransmitting the code without decoding the data first.

    I used a pic with 5 volt tolerant inputs and used a MAX232CPE for the communication, the MAX232 would work good if you are implementing an interface with RTS/CTS functions, or you can just use the TX/RX and do the polling method of acquiring the data from the scanner, and you can use the other 2 for communicating with PC. Use a pic with UART and interface scanner to pic with the MAX232CPE (MAX3323 for 3 volt pic) or similar IC to translate the signals to the required RS232 levels for the scanner and PC.

    My .02