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.

ways of connecting a pic to pc

Status
Not open for further replies.

georgz

Full Member level 1
Joined
Jun 5, 2010
Messages
99
Helped
9
Reputation
18
Reaction score
5
Trophy points
1,288
Location
space
Activity points
1,832
Hello everyone, i'm looking for ways to connect a pic to my pc.
I know about serial communication using a RS232 cable and usb which requires a pic that supports it and a usb cable. Is there an other way? I would also want to ask for a tutorial on how to make the connection using a serial cable.
 

You can connect µcu with any port of PC through various interfaces, LPT, IrDA, Keyboard/Mouse connectors, sound card,e.t.c. It's just matter of what you want to achieve and how much time and effort you want to invest.
Connecting µcu through RS232 involves hardware interfacing your controller signals that might be 0 to +5V to signals of COM port that might be ±12V. Most µcu's include UART for communication through RS232. Simplest interface can be as simple as couple of resistors. Maxim (and many others) makes IC's specifically designed for this purpose. Microchip website includes ample information and examples on this subject. Most µcu's include UART for communication through RS232.
 

    georgz

    Points: 2
    Helpful Answer Positive Rating
I 'm using a 16F887 pic which supports UART communication. I have heard about max232. Will i be needing that for UART communication? There are so many things someone can learn... i'm starting to get a headache. I'll search microchips' site for information.

PS. Why are you using the μ letter for mcus?
 

For µ letter usage I just thought might be cool to actually use Greek letter micro instead of Latin letter m.
RS232 interface originally had logical false at +12V and logical true at -12V. Receiving signal of that level with µcu is not difficult, just simple series resistor to limit current through internal protection diodes of PIC controller would suffice in a lot of cases.
Transmitting signal from PIC to PC is another matter. Anything outside of ±3V should be correctly understood by PC as either logical true or false condition under more recent standards for PC communication port that is known as RS232. Unfortunately, older computer might have reliable logical condition only on higher voltages, so even 5V might not be sufficient. MAX232 (there are some newer and better versions, smaller capacitors used ) helps to make sure that even old granpa PC you plug your device to will hear your signal loud and clear. Nice thing about this kind of chips is that you don't need additional power supplies, required voltages are generated from 5V supply.
Communicating with higher speeds will raise requirements for more carefully designed interface. If you are just building some gadget for your own PC and baud rate is low, some low cost tricks might work great.
If you are not sure what you need, just take some tested example from Microchip or some other site that deals with interfacing µcu to RS232.
So, to answer your question, no you don't have to have MAX232 (or similar) in your interface, but it's easier to build interface with them then without.
And finally, RS232 is dying breed, most new computers don't come with them, but they are one of the easiest ways to get µcu and PC to talk to each other. So for learning experience if you have one on your PC, RS232 is good starting point.
 

Yes you need max232 for UART communication But you should take care that the cable not exceed it's lenght limit.In wht enviroment you are using rs232.
Follow the link for finding lenght limit

https://www.lammertbies.nl/comm/info/RS-232_specs.html
mircontrollers are also written as ""uC" OR "μC"in short form.
 

    georgz

    Points: 2
    Helpful Answer Positive Rating
Sinisa said:
And finally, RS232 is dying breed, most new computers don't come with them, but they are one of the easiest ways to get µcu and PC to talk to each other. So for learning experience if you have one on your PC, RS232 is good starting point.

I know that is the easiest way so i'm starting with that and then get familiar with usb that is a little... a lot harder than serial communication.
I 've see people using hyperterminal in their projects, do i need one too or can just make my own application written in VB or VC to communicate with pic the way i want.
Last thing to ask, my laptop does not have a rs232 port, can i use a rs232 to usb cable?

joydeepsarkar87 said:
PIC 16F887 has inbuilt I2C, so you can use this technology to connect the 2 PICs. Using UART is also a way to communicate I am just giving you options.

Its just that connections will be less complicated with I2C

Good Luck

So I2C is just for communication between pics?

engr.hayee said:
Yes you need max232 for UART communication But you should take care that the cable not exceed it's lenght limit.In wht enviroment you are using rs232.
Follow the link for finding lenght limit

https://www.lammertbies.nl/comm/info/RS-232_specs.html
mircontrollers are also written as ""uC" OR "μC"in short form.

I'll try to keep the lenght at minimum. I'm just learning now so a cable of 2 meters is long enough.


Edit:I found two guides

https://www.sparkfun.com/commerce/tutorial_info.php?tutorials_id=80&page=1

the first i thing is the good one! :idea:
 

USB is not that hard as you think if you have a uC like PIC18F2550. Serial is much easier but USB is not hard. If you go for PICs microchip got axamples ready to use with a program example for PIC and for PC side.

Cya
 

Sink0 said:
USB is not that hard as you think if you have a uC like PIC18F2550. Serial is much easier but USB is not hard. If you go for PICs microchip got axamples ready to use with a program example for PIC and for PC side.

Cya

In fact i have a pic 18F2550. I have been reading about usb protocol and how to make a connection i even have a firmware in assembly but it seems complicated and i dont want to use something ready...
Microchips firmware examples are written in C which i dont know.
Does C for computers have the same instuctions and structure as the C for pics??
 

It have the same structure but not same instuctions. Preprocessors and special functions to interact with external hardware are uC Specific and OS specific functions are PC specific. But if you learn how to program C to a PC you might not have problem to learn it to PIC.
 

    georgz

    Points: 2
    Helpful Answer Positive Rating
Connecting a PIC to USB is not that hard. But it takes time to go through the PIC datasheet and learn USB. I have interfaced a PIC184550 to a PC via USB and had implemented an USB oscilloscope to sample signals upto 40KHz. It was much fun :)

One book i would recommend to get started with PIC & USB.
Advanced PIC Microcontroller Projects in C From USB to RTOS with the PIC 18F Series - Newnes Publications. An awesome book :!:

Have fun :D
 

    georgz

    Points: 2
    Helpful Answer Positive Rating
In my opinion, best place to start with USB:

**broken link removed**
 

    georgz

    Points: 2
    Helpful Answer Positive Rating
You dont need to buy the book actualy, the link i gave you have a lot of documentation to set up a USB HID interface.
 

georgz said:
@sink0 you mean this? **broken link removed**

@hardyethan you mean this? http://www.amazon.com/Advanced-PIC-Microcontroller-Projects-RTOS/dp/0750686111

Yes.. :)

Also if you are interested you might take a look at this...
**broken link removed**
to get started with PIC18F4550/PIC18F2550...PIC DEM FS USB Demo Kit. The demo kit circuit is given in its manual and the firmware is also available in microchip USB Framework. the circuit is easy to make on our own and accompanying PICDEM sofware can be used check the functionality.

There are many sites and circuits for PIC Programmers.
But i found this and it worked like a charm. :D
http://www.oshonsoft.com/picprogpro.html
 

hardyethan i prefer to use a breadboard so i can make it the way i want. :) Btw thank you very much for the book you suggest! It's just what i'm looking for!
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top