PIC tutorial using C/PIC programmer circuit tutorial

Post here to discuss the PIC microcontroller tutorials.

Moderators: Chuckt, Garth, bitfogav

Post Reply [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
DanT29
newbie
newbie
Posts: 9
Joined: Thu May 03, 2012 7:36 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

PIC tutorial using C/PIC programmer circuit tutorial

Post by DanT29 » Fri May 04, 2012 3:02 pm

Hey Brad,

I'm new to this forum and I'm happy I found a forum that explictly has topics just on the PIC. I noticed you have tutorials on PIC using assembly languague, I was wondering if you can create any tutorials that use C to program that PIC. I learned C is a good way to program the PIC since it can work on various different models, while assembly languages is only restricted to a certain classes/types of PIC. Furthermore, you may already have this but can you give a tutorial on how to build a programmer circuit for the PIC? I have a PICKIT2 so using that would be a good start. I scanned the internet and seen so much different designs varying in complexity. I was wondering if you can give an explanation on which circuit elements to use in a PIC programmer circuit and why you use it. I believe learning on why a component is used will give a better understanding of what you're doing instead of copy a schematic. Thanks alot, I greatly appreciate what you're doing. I plan on learning PIC and doing mini-project when I ever I get a break of school and other projects, and hopefully posting what I've made thanks to your help!

P.S. If anyone else wants to contribute as well go for it, i apprecaite any help. Thanks!

User avatar
brad
Site Admin
Site Admin
Posts: 2578
Joined: Fri Mar 26, 2010 10:30 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: PIC tutorial using C/PIC programmer circuit tutorial

Post by brad » Wed May 09, 2012 5:42 pm

Sorry for the late reply.

Every microprocessor (and microcontroller) has an instruction set which is called assembly language, you can program any PIC in assembly language but not all can be programmed in C. When you compile C code, it will spit out an assembly listing of that code.

Unfortunately I don't have any C specific tutorials and I don't plan on making any, anytime soon. You are correct though, C is a great language to use when working with microcontrollers. Have you considered Basic? I have found it to be a fantastic language and quite similar to C in a lot of ways. I actually prefer to program microcontrollers in Basic rather than C. I do have a section of the forum that deals with Basic programming.

If you did want a C tutorial, you could try best microcontroller projects (I cant remember the exact website)

If you have a PICKIT 2 then you have all you need to program your PIC. Here is a fantastic post that will help you (thanks bitfogav!)

viewtopic.php?f=9&t=484&p=2778&hilit=pickit#p2778

What do you mean exactly about the circuit elements?

DanT29
newbie
newbie
Posts: 9
Joined: Thu May 03, 2012 7:36 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: PIC tutorial using C/PIC programmer circuit tutorial

Post by DanT29 » Tue May 15, 2012 8:28 am

Sorry for my late reply as well and thanks brad for the advice! What I mean by circuit elements are the components maybe I should have used that term instead I apologize, components such as resisters, capacitors inductors and such. Basically when I see circuits schematics of different PIC programmers they don't directly connect the wires to the PIC controller themselves. Instead the PIC is placed in a circuit with resistors, capactitors and even transistors while the wires coming from the PicKit2 are connected to that circuit. I just would like to know why those components are placed in the way there are, I would love an explanation I do know a good amount about how circuits work but if you can maybe give a small explnation on the reason why components of a circuit are placed where they are it would clear up any questions/confustions. Here's a site that I found that has a PIC programmer circuit schematic using resistors, a transistor and various other components. I hope it will help you better understand what I'm asking. Once again I apprecaite any help you can give brad and thanks again for the tutorials!

http://extremeelectronics.co.in/microch ... rogrammer/

User avatar
brad
Site Admin
Site Admin
Posts: 2578
Joined: Fri Mar 26, 2010 10:30 pm
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: PIC tutorial using C/PIC programmer circuit tutorial

Post by brad » Sat May 19, 2012 1:36 pm

The circuit that you posted a link to is to build your own (very basic) serial port programmer so that you have a way of transferring your code from the computer to the pic. You don't need to build that though because you have a pickit2 which takes care of connecting your computer to the pic. There is no special circuitry required at all. Just connect the PICKIT2 to the USB port of your computer, then connect the 5 required connections from the PICKIT2 to your pic microcontroller.

Just have a look at the link to a previous forum topic that I posted above - it's really very basic to connect your pic to the computer once you have a pickit2!

DanT29
newbie
newbie
Posts: 9
Joined: Thu May 03, 2012 7:36 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: PIC tutorial using C/PIC programmer circuit tutorial

Post by DanT29 » Mon May 21, 2012 11:44 am

Hmm that makes sense, thanks for clearing it up. So it's like the PicKit2 contains the circuit to deal with the programming. But there's a video that I found here:

http://www.youtube.com/watch?v=HVQ4tj-D ... ure=fvwrel

Here he uses the PicKit2 with resistors, a LED and a capacitor. I'm not sure why there's a capacitor but is the resistor used to limit the current so it doesn't burn the PIC and the LED is used to check if current is even flowing(it will turn on and give off light)? So these extra circuit components are like safety precautions but not needed? Thanks for the response!

P.S. If you have time in the future, can do an advance video on how a programmer circuit really works(even though we don't need it with PicKit2) I'd greatly appreciate it with the rest of the people that follow your tutorials I'm guessing. It's good knowledge to have and will greatly expand our understanding of microcontrollers. Thanks again for all the help!

User avatar
bitfogav
Moderator
Moderator
Posts: 915
Joined: Sun Mar 28, 2010 9:03 pm
Location: United Kingdom
Contact:

Re: PIC tutorial using C/PIC programmer circuit tutorial

Post by bitfogav » Tue May 22, 2012 2:59 am

DanT29 wrote:Here he uses the PicKit2 with resistors, a LED and a capacitor. I'm not sure why there's a capacitor but is the resistor used to limit the current so it doesn't burn the PIC and the LED is used to check if current is even flowing(it will turn on and give off light)? So these extra circuit components are like safety precautions but not needed? Thanks for the response!
You dont need any of them extra components (resistors, capacitors, led) to Programme the microcontroller.

The resistor is used to limit current going to the Led so that the Led doesn't burn out, the other components are used only to show you the working programmed microcontroller after he has programmed it!.

DanT29
newbie
newbie
Posts: 9
Joined: Thu May 03, 2012 7:36 am
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Re: PIC tutorial using C/PIC programmer circuit tutorial

Post by DanT29 » Tue May 22, 2012 5:30 am

Ahhh I see, thank you!

Post Reply
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Who is online

Users browsing this forum: No registered users and 14 guests