Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Pic question. Sorry for beating a dead horse.

Status
Not open for further replies.

cubdh23

New Member
Ok now i am dead serious about buying a PIC and a programmer. I need to jump on the PIC bandwagon now because i have only experience with the costly 112pin motorola processor which is ridiculous for small projects..
Ok i have a few questions. First of all.
1) what site can i buy the cheapest, programmer board?
2) what do each of these things mean e.g 16F648A
I assume 16 means 16 i/o what does the 64 mean and what about the 8A.
3) How do i know if what i am gettting is "One time programmable"or 1,000,000 time programamble?
4) lets say i need 30 pins for my project and i have 2 16 pins pics
can i hook up the 2 pics to in effect have 32 pins?
5) There are tons of different PICs, which should i get? i guess it makes sence to buy a bunch of them.
6) My previous processor had input capture/ output compare capability.
Do PICs have this capability? I checked micropics site and didnt see mention of this. I want a PIC with this capability.
7) Do Pics have preassigned functions like Reset, interrupts in memory?
8) Why do i always hear about people using crystal clocks. isnt the crystal built inside the Pics?
9) Are the instructions the same for all Pics?
10) In Nigel's site. Is that software the assembler? where do i find the software that assembles the code and gets it ready for burning?
11) Most importantly where can i find a good, cheap programmer. Is it cheaper/ too hard to build my own?

thanks a lot. Nigel you are the man.
lets go cubbies.
 
cubdh23 said:
Ok now i am dead serious about buying a PIC and a programmer. I need to jump on the PIC bandwagon now because i have only experience with the costly 112pin motorola processor which is ridiculous for small projects..
Ok i have a few questions. First of all.
1) what site can i buy the cheapest, programmer board?

You don't have your location filled in, so we don't know what country you are in, so it's rather difficult to make recommendations for a specific site!.

However, you should be able to buy a kit for the P16PRO40 pretty well anywhere, and various sites will post anywhere in the world.

2) what do each of these things mean e.g 16F648A
I assume 16 means 16 i/o what does the 64 mean and what about the 8A.

'16' means it's a '16 series' PIC, which is a mid-range PIC and actually uses a 14 bit core, the 'F' means it's FLASH or EEPROM (mostly EEPROM) which means it's capable of being easily reused. The 648 is the specific designation for that chip, and the A means it's a later silicon version than one without the A.

3) How do i know if what i am gettting is "One time programmable"or 1,000,000 time programamble?

See above! - look for an 'F' in the type number, a 'C' is usually OTP, and if it has a JW at the end it's also UV eraseable. You could also look on MicroChip's website, where you can list them by various criteria.

4) lets say i need 30 pins for my project and i have 2 16 pins pics
can i hook up the 2 pics to in effect have 32 pins?

You can, but it's up to you how you implement it, you need to design some kind of communication protocol between them, a lot depends on what you are doing and why!. Probably easier to go for a bigger PIC, the 16F877 is a popular one and has 40 pins - the datasheet will tell you how many are available as I/O.

5) There are tons of different PICs, which should i get? i guess it makes sence to buy a bunch of them.

Try following my tutorials, I would suggest starting with the 16F628, then the 16F876/7 and 16F819. Once you've got used to those, you could try moving to the high-end PIC's, the 18F series.

There are basically three ranges of PIC's, the 12 bit (12 series), 14 bit (16 series), and 16 bit (18 series) - I would advice you start on the 16 series (14 bit) as I suggested above - most code is written for this series, as are my tutorials.

6) My previous processor had input capture/ output compare capability.
Do PICs have this capability? I checked micropics site and didnt see mention of this. I want a PIC with this capability.

I don't quite understand what you mean, the 16F628 has analogue comparator inputs? - what are you wanting to do?.

7) Do Pics have preassigned functions like Reset, interrupts in memory?

The reset vector is 0x0000 on most modern PIC's (it wasn't always), and the interrupt vector is 0x0004.

8) Why do i always hear about people using crystal clocks. isnt the crystal built inside the Pics?

No, some have an inbuilt RC oscillator (like the 16F628 and 16F819), most require an external oscillator.

9) Are the instructions the same for all Pics?

They are upwards compatible, the 16 series have more instructions than the 12 series, and the 18 series have more instructions than a 16 series. Generally you can run 12 or 16 series code on an 18 series, but not the other way (unless the code only uses the smaller instruction set).

10) In Nigel's site. Is that software the assembler? where do i find the software that assembles the code and gets it ready for burning?

No, the assembler comes from MicroChip, it's called MPASM and comes as part of MPLAB - it's a free download, but fairly large.

11) Most importantly where can i find a good, cheap programmer. Is it cheaper/ too hard to build my own?

As above, look for P16PRO40, one common low cost kit is the DIY Kit96, from DIY Electronics in Hing Kong, but available worldwide.

If you're in the UK, try Quasar Electronics.
 
Nigel Goodwin said:
Try following my tutorials, I would suggest starting with the 16F628, then the 16F876/7 and 16F819. Once you've got used to those, you could try moving to the high-end PIC's, the 18F series.

The PIC18 is particularly suited for running compiled C. I greatly prefer this to handwritten assembly.

4) Just get the pins you need in one part. Interfacing two microcontrollers is possible, and is done all the time, but you only do it if you have a real need. There are parts in non-DIP pkgs with far greater than 40 pins.
5) There are only a few universally "desirable" parts off of each PIC line. There are some with reduced memory or just plain obsolete that make no sense to get unless you want to work with an old design or save 15 cents. The PIC18F252/PIC18F452 are the popular and well understood ones off the PIC18 line. Be sure to check the errata sheets for the part you're looking at, a few are nasty!
7) The internal oscillator, for the PICs which have them, does not use the full speed of the part that you could get with an external source (usually a crystal). Internal osc also varies a lot in frequency with temp and part to part. But it's handy if you can deal with that and need the pins for other things.
11) I like the Warp13 programmer myself. A bit more cost, but very well featured:
https://www.newfoundelectronics.com/
 
Thank you Nigel and Oz.
That was very informative.
I guess what i meant by input capture, is the capability to count pulses.
IR recievers give off pulses.
Output compare is used mainly as a timer, but it can also be used to create a pulse at any frequency you want up to about 50khz. I am guessing in the PIc i probably have to manually do this by creating a loop with h/L with a small delay in there.
anyways thanks a lot.
Texas here.
 
I'm in Austin, Tx myself.

The PICs have a lot of different input capabilities, which may or may not be present on your model.

It sounds like your IR rcvr is a digital 0-5V input and a comparator has no useful function here.

Possibilities include:
1. The signal can create an interrupt
2. The signal can be used on the capture input, which will get you a copy of a counter value when the edge occurred.
3. You can simply read the signal. Compare it to a hardware counter, number of counter interrupts, or number of delay loops.

Lots of options. One thing about the PIC, you can rarely call it short of features!
 
cubdh23 said:
Thank you Nigel and Oz.
That was very informative.
I guess what i meant by input capture, is the capability to count pulses.
IR recievers give off pulses.
Output compare is used mainly as a timer, but it can also be used to create a pulse at any frequency you want up to about 50khz. I am guessing in the PIc i probably have to manually do this by creating a loop with h/L with a small delay in there.
anyways thanks a lot.
Texas here.

PIC's have internal hardware timers, usually one can be configured to count external pulses (which is how PIC frequency counters work). You can also conigure than as normal timers, and generate a frequency with them - but like all timers, you are restricted to the frequencies you can generate - for example,the highest frequency is twice that of the next one down, so resolution can be very poor. By using software frequency generation you have more control, although it obviously has it's own limitations as well.
 
Hey guys do you see anything wrong with this programmer?
It seems really cheap and do you think this is trustworthy?

**broken link removed**

thanks
 
I have two friends who have recently ordered that exact Olimex PIC programmer. You need to get a serial cable to go with it. I believe that it is also possible to plug the unit straight into the serial port, but you may need to fiddle with it. I'd recommend normally using a serial cable though. It's not exactly a USB dongle... :?

Anyway, onto its operation. Does it work? Yes, yes in fact it does, but there are cases where it does not. The thing is, it's not guaranteed to work, because it does not use an external power supply. It is powered directly from the serial port. It relies on the serial port being above specs in order to achieve sufficient power to program the PIC. Some laptops can't provide enough power through the serial port to function correctly.

My friends and I have used the IC-Prog software and two Olimex programmers on an IBM Thinkpad laptop with Win 98, a Compaq laptop with Win XP, and a Sony Vaio laptop with Win XP. The odd thing is that with the IBM/Win98, the LED comes on while programming, as it should. On the two computers with Win XP, the light does not come on, even though it does program the PICs correctly.

If using Windows NT / 2000 / XP, you have to install an additional driver for the ICPROG program. It's not hard at all, but it took me about half an hour to figure out why it wasnt working. :p

Some upsides: *It's small, *cheap, *and gets the job done.
Some downsides: *It's s-l-o-w. The more program store a chip has, the longer you wait for it to program. *You have to unplug it from the serial port before inserting or removing a chip so the comp's power doesn't fry it.

I think that's a pretty accurate and unbiased write-up about it. Onto my subjective opinion. I don't like it. I have a parallel programmer, with an external power supply, and a nice ZIF socket. It programs fast and reliable every time. It's done in a few seconds. There's no wondering if it programmed. There's no worrying if there's a problem with the code, the programmer, or the PIC. Some people use the Warp 13 programmer. I like the Epic Plus from www.melabs.com. It will set you back some cash. But when I started out, it was acceptable for me, having a programmer I knew would work no matter what.

With this Olimex offering, you don't have any of that. You have a slow slow progress bar that crawls across the screen, and then at the agonizing end of the programming process, you get a generic operation failed box. Yeah, that's about as descriptive as it gets. No clues as to what the problem is.

To sum up this long entry, basically you can either get a more expensive one and know that it works and not worry about it, or you can get this one pretty cheaply, and have a pretty good idea that it will work. But you will have to invest some time into figuring out any quirks that arise, and you will have some arise. :twisted:
 
Thank you, I just bought it.
I was wondering. Now after i program my first chip. When i place the chip on my breadboard with led's or whatever. What else do i need besides a 5 Volts and ground source? I need an external crystal and what else???
Is that all that i need to get started?
 
Depends on what chip you are using. Lots of people say start with a 16F628. I haven't used that one yet, but I plan to tomorrow. :) So assuming you are using a 16F84 or 16F84A, you need a few parts to get it going. You need a pull-up resistor for the master clear, say around 10K ohms. You need some wires to connect the VCC and VSS pins to +V and ground. Also, you should put in a decoupling capacitor. Sometimes you can get by without one, but if you just always put one in, you can save a lot of hair pulling trying to figure out why a program isn't running. Put a 47 microfarad (uF) capacitor across +V and ground. It could be somewhat larger or smaller in value. Just make sure you get the polarity correct so it doesn't asplode. You'll need an LED and a current limiting resistor (use a 330 or 270 ohms resistor), and some kind of clock pulse.

For the clock pulse, there are multiple options. You can use a resistor and capacitor, or a crystal, or a ceramic resonator. If you use RC timing, it won't be very accurate, so go with a crystal or a resonator. If you use a crystal, then you will need two capacitors, around 18 to 22 picofarad (pF) connected to the pins of the crystal and ground. See the PIC datasheet for more info on the timing and connections. A resonator is a bit simpler, as the capacitors are built in. The resonator has 3 pins. Connect one of the outer pins to OSC1, connect the other outer pin to OSC2, and then connect the center pin to ground. I would recommend getting your parts, like the crystal + caps or the resonator (try 4 MHz), from www.glitchbuster.com

Connect your LED and current limiting resistor to one of the PORTA or PORTB pins, and make it do stuff. 8)
 
cubdh23 said:
Thank you, I just bought it.
I was wondering. Now after i program my first chip. When i place the chip on my breadboard with led's or whatever. What else do i need besides a 5 Volts and ground source? I need an external crystal and what else???
Is that all that i need to get started?

As 'bonxer' has already suggested, use the 16F628, you then don't need a crystal - I don't suggest you try the 84 or 84A, these are essentially obselete - the 628 is their modern replacement, higher spec and less money.

I would suggest you look at my tutorials, it will give you everything you need - including veroboard layouts.

I also suggest you DON'T buy the JDM stye programmer you were looking at, they are too unreliable - get a parallel port one, as before I recommend the P16PRO40 which is one of the best, and still nice and cheap. You can run it from my free software, or ICProg which is also free.

Try looking up kit number 3096 at https://www.quasarelectronics.co.uk/ for a suitable kit at only £10.17+VAT.
 
I just bought an assembled P16PRO40 from amazon for 25 dollars. Not bad
and it comes with a 40 pin ZIF. I was wondering, on the amazon site it says for it to use full capabilites you have to register it for $15.00?
Is Nigel's free ICPROG software a replacement for that software that they are asking me to buy?
 
Is Nigel's free ICPROG software a replacement for that software that they are asking me to buy?

the name of Nigel's free programmer software for PICs is WinPicProg http://www.winpicprog.co.uk

ICPROG is a different software. u can use both ICPROG and WinPicProg with the P16PRO40 hardware. but u will have to make a little bit of adjustments on the software side.

yay i got a new avatar!!!!!!!! its cute isnt it :D
 
Hey i was thinking about buying the 16F628 as some people recommended.
but check this out {16F628-20/P 20MHz, 18-DIP, 2K Flash, 4 MHz internal osc. $2.74}
I guess whenever i see internal osc that means it does not need an external one. But this means if i use an external one, It will run the program at 20Mhz instead of 4Mhz? That seems like a big difference. Is it right to assume that PIC instructions for the most part are about 1.5 clock cycles per instruction on avg? The last micro i was using was more like 3 cc/instruction @8Mhz. Since my project will be highly time sensitive. Which processor would be the best one for this. maybe has 2-3 timer interrupts and also maybe the max amount of Mhz @ the cheapest price.

So that means if i want to get the 16F628 just for practice first but i want it at 20Mhz, then just buy any crystal that says 20MHz? and the 2 capacitors?
thanks
 
But this means if i use an external one, It will run the program at 20Mhz instead of 4Mhz? That seems like a big difference.

No, its your choice to use which oscillator or resonator. the "20" in the part number specifies the maximum frequency on which the PIC can be operated. although the PIC can be overclocked above this specification, it shouldnt be done :)

hey i thought PICs needed 4 clocks per instructions and that was a constant value. does this change?????

if u are having trouble in choosing the right microcontroller then go to microchip's website. there u can display a number of PICs with simillar functionality and compare them.

and by the way what are u trying to do????

i hope that helps
 
cubdh23 said:
But this means if i use an external one, It will run the program at 20Mhz instead of 4Mhz? That seems like a big difference. Is it right to assume that PIC instructions for the most part are about 1.5 clock cycles per instruction on avg? The last micro i was using was more like 3 cc/instruction @8Mhz. Since my project will be highly time sensitive. Which processor would be the best one for this. maybe has 2-3 timer interrupts and also maybe the max amount of Mhz @ the cheapest price.

So that means if i want to get the 16F628 just for practice first but i want it at 20Mhz, then just buy any crystal that says 20MHz? and the 2 capacitors?
thanks

I hope I got the terms right:
The internal instruction cycle is 1/4 the oscillator freq, regardless of whether it comes from a crystal or the internal osc. So you'd have a 1 MHz instruction clk versus 5 MHz. In the PIC16 series, all assembly instructions execute in 1 instruction clock except for JUMP, which takes 2. The PIC18 series has a few additional assembly commands which take 2.

The PIC18 has a more confusing case. They can do 40MHz clock, but can't drive a 40MHz crystal! So you set a special config bit for 4xPLL, install a 10MHZ crystal, and it internally multiplies it to make a hidden internal 40MHz clock, making a 10MHz instruction cycle.

Sure, get a 20MHz crystal. I recall seeing some spec on the cut type, but I don't think you're going to find an inappropriate one without looking hard for it. What is it, HC49U for a case? There's a low profile one which makes a lot more sense in a PCB design, the big one would stand above the PIC & socket if mounted upright. The caps should be included, but in all probability your design will work without them. I don't always include them when hand-wiring a prototype and just wait & see what happens. I have yet to have a case where it didn't work fine.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top