Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

USB interfacing with PIC16F877A

Status
Not open for further replies.

akhter900

Junior Member level 1
Joined
Jun 7, 2009
Messages
17
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,456
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
 

usb interfacing circut and programming

One way would be to use an FTDI chip available here:
https://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.
 

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.
 

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.
 

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:
**broken link removed**

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
 

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
 

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.
 

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
 

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.
 

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.
 

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.
 

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 :)
 

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.
 

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
 

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
 

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 :)
 

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
 

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
 

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);
}
}
====================
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top