PDA

View Full Version : New to 10F220



mikebike
- 15th September 2010, 09:54
Hi.

I'm relatively new to PIC's and I have never used the PICF220 before...

I can't understand how to set the I/Os, TRIS and then?

And since I'm already asking, how to set the port(s) to be ADC?

I read in the manual that the internal clock isn't really calibrated, but measured and a correction factor is programmed into the memory.
How to use it properly? (Without overwriting it when programming the PIC.)

PS. The PBP doesn't list the PIC10F220, but I guess choosing 222 will work?


Best regards from a newbie

George
- 15th September 2010, 10:02
I've not had much luck historically using the 10F series, PBP requires too many background resources . Have a look at the 12F series for small projects with PBP

Acetronics2
- 15th September 2010, 10:08
Hi.

I'm relatively new to PIC's and I have never used the PICF220 before...

Best regards from a newbie

Hi, Mike

No hope to run a PBP program with the 10F220 ... too small a RAM size.

assembler seems the only way with those lilliputian chips ... :o

That's why they won't be listed any day ...

Alain

Kamikaze47
- 15th September 2010, 10:15
Everything you need is in the data sheet.

You can set the port directions using TRISIO.x=y where x is the GPIO bit number and y is 0 out output or 1 for input. Or use the PBP INPUT or OUTPUT commands, for example:
OUTPUT GPIO.0
INPUT GPIO.3

The ADC is set with ADCON0. Page 30 of the data sheet tells you what to set it to for various configurations.

Are you using MPASM as your assembler? MPASM has files for the 10f220, so if are using it you would just have to make your own PBP files for it. Use the 10f222 PBP files as a base and change the CODE_SIZE to 100h and the included MPASM file to P10F220.INC

The internal oscillator is set up in that config file with: _IOFSCS_4MHZ or _IOFSCS_8MHZ

*edit* 2 above replies beat me - havnt tried PBP on this pic, so they may be right.

mikebike
- 15th September 2010, 11:27
Oops, not much use learning how to use the 10F220 then....

Which PIC do you guys recommend then?

I use PBP and Melabs U2 Programmer.
I need 2 x ADC, 4 x I/O, internal clock and small size (low price).


EDIT: Low power is not a drawback. ;)

Kamikaze47
- 15th September 2010, 11:35
The 12F510 would be the cheapest that meets your requirements:

http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en023670

*edit*: as long as you dont need a lot of code space. The code space is 4 times that of the 10F220, but still limited.

mikebike
- 15th September 2010, 11:52
The 12F510 would be the cheapest that meets your requirements.

My local supplier don't have the 12F510 in DIP-package, only in SMD.

The PIC12F629 is slightly more expensive, but in stock in DIP. ??

Acetronics2
- 15th September 2010, 12:18
My local supplier don't have the 12F510 in DIP-package, only in SMD.

The PIC12F629 is slightly more expensive, but in stock in DIP. ??

The 629 has no ADC !!!

Choose 12F675 ... or the 12F683 which is not really more expensive, but offers lots of interesting features and ... 2K program space.

BTW ... could have been an idea to tell us what you intend to do ... don't you think ???

Alain

cncmachineguy
- 15th September 2010, 13:06
BTW ... could have been an idea to tell us what you intend to do ... don't you think ???

Alain

Or even better, define cheaper. After all is a $2-3 part too much? Is there a budget amount in mind? Is board space an issue?

Lots of variables when considering a PIC.

mikebike
- 15th September 2010, 13:15
The 629 has no ADC !!!

Choose 12F675 ... or the 12F683 which is not really more expensive, but offers lots of interesting features and ... 2K program space.

BTW ... could have been an idea to tell us what you intend to do ... don't you think ???

Alain

Thanks for pointing me in the right direction.

My first project is very simple:
A 9 minute timer with a short blink every second to show that it's counting and a low battery indicator. I need 1 x ADC and 2 x output (LEDs) for this project.

Next project is almost as simple:
A temperature regulator with 3 different levels that will be exucuted in a preset sequence, for example start-go to 50C-wait for x minutes-go to 28C-wait z minutes-got to 32C.
A bicolour LED shall indicate the different steps.
A potentiometer shall be able to adjust the temperatures +/- 2C.
I need 2 x ADC and 3 x output (2xLED + TRIAC) for this.

mikebike
- 15th September 2010, 13:19
Or even better, define cheaper. After all is a $2-3 part too much? Is there a budget amount in mind? Is board space an issue?

Lots of variables when considering a PIC.
Well, the 12F683 is about $2 and that's OK. The products will sell for around $80, hopefully.

Instead of small size, I could have stated 8DIP with the possibility to go to 8SOIC in the future.


I will probably be back very soon with more stupid questions about PIC12F683, but that will be a new thread! :D

Acetronics2
- 15th September 2010, 13:24
Thanks for pointing me in the right direction.

My first project is very simple:
...
Next project almost as simple:
...
.

Ok ...

12F675 is nice ... but a bit limited if some PWM or Compare jobs used ...

you can start with the 12F683 ( 8 pins with the more peripherals / SMD available - 12F1822 nice too ( brand new chip ! ), if you do not intend to drive a LCD.

16F886 ( 28p ) or 887 ( 40p ) if you need more pins .... cheap and numerous peripherals.


Alain

mikebike
- 15th September 2010, 13:39
you can start with the 12F683

Got to start somewhere....
My test program with two blinking LEDs worked right away with the 12F683, so I think I will use that for now.
Both my projects will hopefully be products, but probably not in large numbers.

mikebike
- 15th September 2010, 13:46
I'm trying to educate myself using some educational materials that include a LAB X-1 and PIC16F877A, a bit overkill for my needs.


I have been an electronic designer for about 30 years, but I realize that many times a PIC is a better/smaller solution than OP-amps, timers and counters.