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.

Which PIC

Status
Not open for further replies.

Carnivore

New Member
Hey All.

Im sure you have heard this question so many times by now that your sick of hearing it but here it goes.

<Insert standard "im a newb" heading here/>

I would like to start programming PICs and the READ THIS post in this section recomends the 16F628a. (sounds fine) but i go to MicroChip web site to buy the PIC and i see there are multiple ones listed with the same number but they are followed by a prefix (such as 16F628a-E/FL or 16F628a-E-SO). being new i have no idea what i need. can someone help me out here. i know they are cheap but i would not like to order the wrong parts and then have to wait for shipping then reorder again.

One more thing. the reason i am wanting to lear to program a PIC is so that i can manage Serial Data Bits. (for example, is it possible to input serial, pull out the 3rd data bit and replace it with something else then forward it on?) and if so, is this something that can be accomplished with the 16F628a PIC?
 
Most any PIC is good I would think- just don't get a one-time programmable (OTP) version. Preferably a EEPROM or FLASH version. And probably one in a DIP package and enough pins so you can leave the pins just for programming and debugging to do just that (and only that) to make things easier.

I don't see why you wouldn't be able to insert something into a serial bistream before passing it on. But it would be more like a receiver/transmitter that sat in the middle a serial bus. It would receive the information, modify it in some way, and then send it out again on a different (separate) bus.

Instead of looking at the PIC model numbers, go to www.microchip.com and use their parametric search for 8-bit PICs or 16-bit PICs/dsPICs (if that's what you want). Look over the comparison tables for the ADCs, serial protocals you want, and number of I/O pins, and packaging that you want. If you are confused by model numbers variations, they represent one of three things:

-different packaging (DIP, SOIC, PLCC, QFN, etc.)
-different temperature ranges
-different maximum speeds (usually related to temperature range - the higher the temperature range, the less the maximum speed)

TO find out exactly what it is, you must open up the datasheet, go to the near the end and look for the table of all the PIC variations. If you are just starting, I'm sure Microchip wouldn't mind sending you some samples. I asked them to send me one dsPIC401130F, and they ended sending me 5...must have been a mistake, but I guess not I got some dsPICs to make prototype circuits with before I make the final versions.

Off the top of my head the E/FL and E/SO seem to say that both have the extended temperature range (-20C/40C to 125C, I forget the temperature for the lower limit). The SO is probably an SOIC (large rectangular) surface mount package and the FL is maybe a smaller square surface mount package. You probably want a DIP one (suffix P I think), and maybe industrial (I) making the suffic I/P, since industrial devices only operate up to 85C but tend to be able to run faster. The high temperature versions are limited in their speed.
 
Last edited:
You should be able to manipulate the bits with a 16F628A without any problems. As for type, you probably want the 16F628A-I/P as this is the through hole version (I'm assuming you don't want surface mount).

Mike.
 
Thanks DK.

I followed your advice on microchips website and I did order samples of 4 different PICS. It appears as if you can make up to 2 orders (4 chips each) every 40 days from their sample site. (VERY nice of them!!!)

Also, would you happen to know of a good site where I can find information on working with Serial Bits. Like replacing bits or even removing bits? I’m looking to do something like the following:

If DataBit8 = 0 Then
"Do Nothing"
Else If DataBit8 = 1 Then
"Make DataBit8 = 0
End IF


Please forgive my elementary like IF STATEMENT but i think it gets what I’m trying to do across. :D

i have done some searching and haven’t turned up much.
 
Last edited:
Pommie said:
You should be able to manipulate the bits with a 16F628A without any problems. As for type, you probably want the 16F628A-I/P as this is the through hole version (I'm assuming you don't want surface mount).

Mike.

Thanks Mike,

I would have kicked myself if i recieved my order and they were surface mount. :eek:
 
Mike,

you mentioned the I/P was not surface mount. and thats great, but they are not available to ship until after Jan. 29th :mad:

how do you tell which ones are surface mount and which ones are not. and do you have any other recomendations?
 
Maybe pick another PIC very close to the one you wanted? I don't think they are all that different from one another. Basically the only PICs that are not surface mount are the ones that are in DIP packages, be it 8, 14, 16, 28, or 40 pin. On the rightmost column in the comparison tables it tells you what packages the PICs can come in. From there you can use the datasheet to find the model number (and corresponding packaging, temperature, speed you want), or you can also go through the online store, MicrochipDIRECT to see the packagings and numbers (cumbersome). The easiest way is to use the samples page. EVerything is listed very clearly after you select the part you want from the pull-down lists.

http://sample.microchip.com/

You can also buy from MicrochipDIRECT, Mouser, Digikey, your local elecctronic store, wherever.

=======================================

You can do bit-masking with logical operators (like AND/OR) to keep/replace/toggle bits within a bit stream. No need for IFs.

**broken link removed**
One operator allows you to toggle bits, another lets you set them based on the input bit stream. For example:

INPUT:------1010
BIT-MASK:--0011
________________________
XOR---------1001

Each bit in the two streams is paired up sequentially to the bit in the other stream (the two bits that appear in the same order in both streams are paired). If you XOR the input and mask, wherever there is a zero in the mask, the input bit will be retained on the output. Wherever the mask is 1, that bit will be toggled. So XOR lets you toggle bits.

Different operators wil [ N = NOT, X = exclusive ]l:
-toggle the bits (XOR)
-set particular bits
-put a 1 in the output whenever the input and mask bits match (XAND?)
-put a 0 in the output whenever the input and mask bits match (NXAND?)
-put a 1 in the output whenever the input and mask bits differ (XOR?)
-put a 0 in the output whenever the input and mask bits differ (NXOR?)
-other things like this

I think there is also a "null" digit that is neither a 1 nor 0, like # and whenenver an it appears in the mask and is paired up with an input bit, that bit remains unaffected at the output (the same way using a mask-bit 0 with XOR will maintain the input bit at the output). Sorry, it's been a while and I forget what these operators are. Everything I Just said about bit-masking is probably wrong (except that you can use it for what you want to do ).

Use this table to figure out which operators you need.
**broken link removed**

It will make more sense when you have the PIC- the important thing is it can be done.
 
Last edited:
Carnivore said:
Mike,

you mentioned the I/P was not surface mount. and thats great, but they are not available to ship until after Jan. 29th :mad:

how do you tell which ones are surface mount and which ones are not. and do you have any other recomendations?

The 16F648A-I/P is identical except it has twice the memory of the 628 and they appear to have 51,526 in stock. You would probably manage with the 16F627 as well. This is also identical except it has half the memory. Actually, the newer 16F88 would probably be the better option as it's got more memory, has a faster internal clock but is slightly dearer.

Mike.
P.S. What baud rate is the serial data at?
 
Last edited:
A pic can easily juggle serial data as you describe. The only difficult part is selecting a clock source because you generally need a nice stable clock preferably a multiple of the baudrate you're using.
 
Sceadwian said:
A pic can easily juggle serial data as you describe. The only difficult part is selecting a clock source because you generally need a nice stable clock preferably a multiple of the baudrate you're using.

PICs are pretty flexible in this respect. A 16F88 with the internal 8Meg clock will handle baud rates from 1200 to 38400 without any problem.

Mike.
 
Pommie said:
PICs are pretty flexible in this respect. A 16F88 with the internal 8Meg clock will handle baud rates from 1200 to 38400 without any problem.


Yes, there's no need at all for clocks to be a multiple of the baud rate, the 16F628's internal 4MHz oscillator is perfectly fine at reasonable speeds - I always use 9600 baud.

As this project requires two UART's, I would suggest receiving using a software UART, modifying the bit required (VERY easy with a PIC - no need for logical operations, you can manipulate bits directly), and using the hardware UART to send the data out - this makes the 628/627 a good choice as it has a hardware UART (as many others do as well).
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top