+ Post New Thread
Results 1 to 19 of 19
  1. #1
    Junior Member level 1
    Points: 732, Level: 5

    Join Date
    Jun 2009
    Posts
    17
    Helped
    0 / 0
    Points
    732
    Level
    5

    usb interfacing

    Dear all,

    I am doing a project using PIC16F877A.
    I need to transfer some data, stored in PIC, to PC using USB port.
    I need the following clarification...

    a) Which components should I use to build the interfacing circuit between PIC16F877A and PC through USB?
    b) How can I design the circuit?
    c) How can I get help to write necessary USB communication program for that circuit?

    Is there anybody to help me?
    I am eagerly expecting your valuable comments and guidelines.

    Thanks a lot.

    akhter900

  2. #2
    Advanced Member level 5
    Points: 17,955, Level: 32

    Join Date
    Jul 2001
    Location
    Oberon
    Posts
    1,882
    Helped
    416 / 416
    Points
    17,955
    Level
    32

    usb interfacing circut and programming

    One way would be to use an FTDI chip available here:
    http://www.ftdichip.com/
    Writing usb code is not trivial, but if you use an FTDI chip, that is all taken care of for you with free drivers for download.
    They also sell complete modules that plug into a 28pin dill socket on your board for easy usb interfacing.



  3. #3
    Junior Member level 1
    Points: 732, Level: 5

    Join Date
    Jun 2009
    Posts
    17
    Helped
    0 / 0
    Points
    732
    Level
    5

    mikroc cdc

    Thanks a lot.

    but I dont want to use the module. I want to design my own circuit.
    can you help me about this?

    thank you again.



  4. #4
    Advanced Member level 5
    Points: 17,955, Level: 32

    Join Date
    Jul 2001
    Location
    Oberon
    Posts
    1,882
    Helped
    416 / 416
    Points
    17,955
    Level
    32

    pic16f877a usb programming

    Again, go to FTDI websiite.
    If you want your own circuit, they have application circuit diagrams when using ftdi chips and sample code you can download.



    •   Alt7th June 2009, 16:36

      advertising

        
       

  5. #5
    Full Member level 5
    Points: 2,729, Level: 12

    Join Date
    Jun 2008
    Location
    Egypt/Canada
    Posts
    246
    Helped
    19 / 19
    Points
    2,729
    Level
    12

    usb interfacing chip with pic16f877a

    in my opinion, change your target device from 16F877A to PIC18F4550, this MCU has nearly the same GPIO ports assignment like the 16F877, beside the USB firmware is available on microchip website:
    http://www.microchip.com/stellent/id...param=en534494

    otherwise use FTDI chips like FT245 USB-parallel or FT232 USB-serial converter, but still recommend PIC18F4550.
    if you used it i also recommend to use microchip CDC firmware (available in the link above inside the software package you will download) cause it will emulate a PC COM port and will be easy to implement application on the host (PC) to communicate with the PIC18F4550 using win32 API's in visual C++ or V BASIC.
    good luck



    •   Alt8th June 2009, 22:33

      advertising

        
       

  6. #6
    Full Member level 4
    Points: 2,752, Level: 12
    saeed_pk's Avatar
    Join Date
    May 2006
    Location
    Islamabad, Pakistan
    Posts
    236
    Helped
    33 / 33
    Points
    2,752
    Level
    12

    pic16f877a usb interfacing

    i agree with 'elrayes' switch to 18F4550

    - your single MCU will be able to communicate over USB and available for you Control application



  7. #7
    Full Member level 1
    Points: 1,288, Level: 8

    Join Date
    Mar 2009
    Posts
    109
    Helped
    4 / 4
    Points
    1,288
    Level
    8

    programming pic16f877a in usb port

    akhter, the USB protocol is no trivial matter. The recommendations to go with either an onboard engine or a dedicated driver is the 'only' way to go. I personally use a MAX3421 with Atmel devices and find it very friendly. Using SPI, this 'paste in' device can be either host or device.



  8. #8
    Junior Member level 3
    Points: 1,032, Level: 7

    Join Date
    Apr 2008
    Location
    Egypt
    Posts
    26
    Helped
    1 / 1
    Points
    1,032
    Level
    7

    usb interfacing with pic16f877

    i am with the opinion of using pic18f4550 microchip is already make the application on the pc through which you can communicate with your usb device , also the firmware you will put on the pic18f4550 which include the whole implementation for the usb protocal and the driver of the usb device.

    making usb by yourself is not easy it will take a long time from you as you have to develop :
    1-pc application
    2- usb driver on windows
    3- firmware

    and with this solution you willl design your own circuit and you will edit the firmware and application to suit your design



    •   Alt10th June 2009, 14:56

      advertising

        
       

  9. #9
    Junior Member level 1
    Points: 732, Level: 5

    Join Date
    Jun 2009
    Posts
    17
    Helped
    0 / 0
    Points
    732
    Level
    5

    pic16f877a interface with pc via usb port

    hello everybody......

    Thanks a lot lot lot......
    I am studying on FTDI (FT245BM) chip.
    Thanks for the suggestion to use 18F4550. I also study on it.

    Thank you again for your valuable suggestions.



  10. #10
    Junior Member level 1
    Points: 732, Level: 5

    Join Date
    Jun 2009
    Posts
    17
    Helped
    0 / 0
    Points
    732
    Level
    5

    pic16f877a usb

    Oh....... FT245BM is not available, and it is so complex.

    Yes..... using 18F4550 is more easier.
    I have bought that IC just today. I have to study on it first then I will start my work.

    Hai, scholars.... I am eagerly expecting your valuable comments and suggestions about the driver(s) and compiller. I want to use PICC compiller.
    what do you think?

    Ok, thank you again.
    good luck.



  11. #11
    Advanced Member level 5
    Points: 14,575, Level: 29
    blueroomelectronics's Avatar
    Join Date
    Sep 2006
    Location
    Toronto, Canada
    Posts
    1,682
    Helped
    178 / 178
    Points
    14,575
    Level
    29

    18f4550 islamabad

    The FT245R is very simple compared to using the USB stack. You could try Swordfish BASIC as it has USB support in the full version.



  12. #12
    Full Member level 5
    Points: 2,729, Level: 12

    Join Date
    Jun 2008
    Location
    Egypt/Canada
    Posts
    246
    Helped
    19 / 19
    Points
    2,729
    Level
    12

    microchip usb programmer for pic16f877

    you can use "microchp USB firmware", i posted the link before in my previous reply, install it then you will find a variety of ready made drivers (HID, CDC, mass storage) all for PIC mcu.
    In my opinion use the CDC firmware, its more easier as it will implement a virtual COM on the PC with will be easier to interface using VB or VC#.
    just you will put ur code inside a function called "processio".
    Contact me if you needed anything regarding CDC solution.
    Good luck :)



  13. #13
    Junior Member level 1
    Points: 732, Level: 5

    Join Date
    Jun 2009
    Posts
    17
    Helped
    0 / 0
    Points
    732
    Level
    5

    mikroc usb cdc

    hi..... every one...
    how is going on?

    oh... I am facing compiler problem now.
    I was using PICC compiler for 16F series. It does not work for 18F4550.
    How can I get the updated compiler?
    Do you have that compiler... Is it possible to give me that?

    I will be so much grateful to you.

    Thank you very much.
    TC.



  14. #14
    Full Member level 5
    Points: 2,729, Level: 12

    Join Date
    Jun 2008
    Location
    Egypt/Canada
    Posts
    246
    Helped
    19 / 19
    Points
    2,729
    Level
    12

    16f877a firmware usb

    Hi Akhter

    I used C18 compiler, however PICC is easier but C18 isn't bad and will do fine, install MPLAB then C18 (a free academic version is available on microchip website) then install Microchip USB framework (link posted previously).
    Beside so far as I know that there is a PICC version for 18F family, check the web for it.

    Good luck



  15. #15
    Junior Member level 1
    Points: 732, Level: 5

    Join Date
    Jun 2009
    Posts
    17
    Helped
    0 / 0
    Points
    732
    Level
    5

    microchip c18 interfacing ftdi

    Hie everyone,

    I am facing so many problems........ offfff ... i dont know what is happening....
    I have loaded the following example code (From MPLAB) to PIC18F4550... BUT its not working. This is the simple program to test..... i think so...

    #include <p18F4550.h>
    #pragma config WDT = OFF

    void delay (void)
    {
    unsigned int i;
    for (i = 0; i < 10000 ; i++)
    ;
    }
    void main (void)
    {
    TRISB = 0;
    while (1)
    {
    /* Reset the LEDs */
    PORTB = 0x00;
    /* Delay so human eye can see change */
    delay ();
    /* Light the LEDs */
    PORTB = 0x5A;
    /* Delay so human eye can see change */
    delay ();
    }
    }

    I am using the same circuit designed previously for 16F877A. Is the circuit OK for the PIC18F4550?
    I checked the data sheet and other example circuits from internet.....and the circuits are same both for the PIC.

    I am using "Pickit 2" programmer v2.40 to load the .hex file of that program. But I found no output in the PIC.... offff..........

    What should I do in this situation? Is the problem in bootloader? How to load it....using Pickit 2 programmer?
    please help me.

    TC



  16. #16
    Full Member level 5
    Points: 2,729, Level: 12

    Join Date
    Jun 2008
    Location
    Egypt/Canada
    Posts
    246
    Helped
    19 / 19
    Points
    2,729
    Level
    12

    microchip c18 ftdi

    First you can use the PICkit2 from inside MPLAB, but make sure to make it "Release" not "Debug" to program the PIC.

    Secondly try to put intial value in the PORT latch "LATB", like:

    #include <p18F4550.h>
    #pragma config WDT = OFF

    void delay (void)
    {
    unsigned int i;
    for (i = 0; i < 10000 ; i++)
    ;
    }
    void main (void)
    {
    TRISB = 0;

    LATB = 0x00; //initial value for port B


    while (1)
    {
    /* Reset the LEDs */
    PORTB = 0x00;
    /* Delay so human eye can see change */
    delay ();
    /* Light the LEDs */
    PORTB = 0x5A;
    /* Delay so human eye can see change */
    delay ();
    }
    }

    thirdly: the issue may be found in the compiler optimizer, disable the optimizer to avoid skipping the for loop you are using in delay, you can use timers instead to generate delays.

    good luck :)



  17. #17
    Junior Member level 1
    Points: 732, Level: 5

    Join Date
    Jun 2009
    Posts
    17
    Helped
    0 / 0
    Points
    732
    Level
    5

    18f4550+picc+usb

    Thanks a lot....
    Actually the problem was in compiler............that was really a pain for the last two weeks.......offff....

    I just switch to mikroC v: 8.2.0.0 compiler.... now the PIC is working...
    BUT....
    When I try to assign a variable to PORTB.... the PIC does not work.

    Example:
    ====================
    char i;

    void main (void) {

    TRISB = 0;
    PORTB = 0;

    i = 1;

    while (1) {
    PORTB=i; //light the first LED
    delay_ms(1000); //delay 1 second
    if(i == 255) i = 0;
    else i++;
    } // end while(1)
    } // end main
    ====================

    Any one can help about this?
    I am using PIC 18F4550 and mikroC v: 8.2.0.0

    TC



  18. #18
    Member level 4
    Points: 1,467, Level: 8

    Join Date
    May 2007
    Posts
    68
    Helped
    1 / 1
    Points
    1,467
    Level
    8

    pic16f877 usb support

    u are trying to source the LEDs why do not u use the sink configuration

    first connet the positive end of the led to the battery via the resistor to limit the current ,

    conect the negative side of the led to the microcontroller portb pins

    and then low the portb pins one by one

    instead of sending char values use the unsigned int

    by the way how u figured out that controller is working



  19. #19
    Junior Member level 1
    Points: 732, Level: 5

    Join Date
    Jun 2009
    Posts
    17
    Helped
    0 / 0
    Points
    732
    Level
    5

    mass storage.c pic16f877

    The code without loop is working well........

    PORTB = 0x02;
    delay_ms(1000);
    PORTB = 0x04;
    delay_ms(1000);
    PORTB = 0x08;
    delay_ms(1000);
    PORTB = 0x10;
    delay_ms(1000);
    PORTB = 0x20;
    delay_ms(1000);

    thats why i said that the PIC is working.....

    Added after 2 hours 57 minutes:

    Any one can give me the hex file for the following program?

    I am using PIC18F4550

    ==================
    unsigned int i;

    void main()
    {
    ADCON1=15;
    TRISB=0b00000000;
    PORTB=0;

    i=0;

    while(1)
    {
    if(i==255) i=0;
    else i=i+1;

    delay_ms(10);
    PORTB=i;

    delay_ms(1000);
    }
    }
    ====================



+ Post New Thread
Please login