PDA

View Full Version : Getting my arms around 12fxxx's



boroko
- 7th September 2003, 10:23
HI All,

I have been playing with PIC's for a while and even managed a few interesting projects using Parallax programming and reading ap notes in Microchip's language.
I can get my way through, but I'm no wiz. I have played with Jeff's wonder (PBP) on and off for years, but I usually get frustrated and give up. I'm reinvigorated and determined to give it another try. I updated to 2.44 and I have been hitting it hard for a few weeks now.

Coming from Parallax and Microchip thinking, I find it difficult to determine when I need to set all of the registers (ala assembly) and when the compiler does it for me. I think that I need to do it and then read a sample program that has essentially no setup info. Only what EPIC sets. When I try and understand a function from one of the samples that I see, I burn it on a 877a and run it on a Labx1 and play with it. Just when I think I'm starting to understand how PBP handles things, I try and use a 12fxxx part and fall on my face again (not on the Labx1).

I understand the GPIO vs. portx difference, that GPIO.3 is reserved as an input and I think I have a reasonable understanding of the datasheet (it's definitely dog eared).

I now need a real program and am getting my butt kicked trying to use a 12f675.
How do I shorten the learning curve on this?


Some background for those patient enough to continue:

The ap is relatively simple: use the compare inputs and do some filtering, and then generate a pulse over and over. The overall project is to build a PWM stage with a feedback loop to convert a 1-10v @10mA sensor to something more robust. (linear won't work because of heat).

The FET driver and FET itself are worked out and perform well when driven manually. I tried a discrete comparator, but it was too sensitive to capacitive loading. The comparator looked at the sensor signal and compared it to the filtered output of the FET and pulsed when it needed to increase the output. What I need is a smart way to filter and drive it and derive a averaged signal that compensates for differing loads. If I just calculate the PWM without some kind of feedback it will overwhelm the small loads and be to little for the large ones. The "amp" needs to follow the original signal level properly, it just needs to drive some loads at 10mA and others at 500 mA and not loose integrity.

I apologize for getting so verbose, its just that some background might unearth some genie with similar experiences.

For now, I'm going back to the 877a and Labx1 and work out the programming. When I'm happy with it, I'll try again to get it to work on a 12fxxx.

Thanks for letting me rant, and if you have any suggestions, I would welcome them.

Mark

Melanie
- 7th September 2003, 11:49
The 12F’s are pretty simple to use… You basically need to determine which pins will be Analog and which pins will be Digital within your application. Accordingly configure TRISIO, CMCON and ANSEL at the start of your program.

The only other thing to remember is to preserve your Calibration and Bandgap bits when programming. That’s all there is to it. For a sample 12F program go look in the “General” section of this forum and see “Sound Command with 12-bit MCU's.”

Personally, if you’re intending to play with comparators and PWM, then I’d look at the 16F628 which is more suitable, as the little 8-pin PIC’s don’t have any hardware PWM modules which make life so easy.

Melanie

boroko
- 7th September 2003, 13:51
Thanks, Melanie for the reply.

My past experience has been mostly for fun. This one is for real on a product that needs to fit into a very limited space. I have already gotten a SO adapter from Jeff to get smaller.

I may be able to fit the thing using a bit more real estate, but it will be a challenge. Existing enclosure, no way to remove heat, etc.

The things that you mentioned are familiar to me and I have been trying to watch out for them. So far, I have evidently missed something.

I have read numerous times that a hardware PWM is the answer, but darn it, they don't put one in a SO8!

The proto that I built worked fine with the direct feedback and the comparator. It simply drove the FET when it thought the output was too low and backed off when the output was adequate. Simple, I know, but it found it's own frequency and adapted quite nicely. The problem was that it was sensitive to load type. Change the capacitance at all, and you messed up the timing balance. I don't have control over the exact load that will be applied and they will likely kill me in that exact area. The PIC route will allow me to isolate the frequency of operation from the sensing of the output and eliminate the bottleneck.

All of this is probably more information than you wanted to know, but I find that the details help me understand the big picture when someone asks me for help.

I know that this all boils down to lack of experience, and I don't like being in that position, but sometimes you learn best while under fire.

I did try and modify a sample program on a 877a and get the basics working. Darned if it didn't do what I wanted it to.

Oh well, when I can ask more concrete questions, I'll try again. in the mean time, I'll just have to keep hitting my head against the wall until I find the doorway.

BTW, you seem to be the heavy hitter on this list. Great to see a female geek. Do you do this professionally?

Thanks again
Mark

Melanie
- 7th September 2003, 14:09
Careful - Anyone refering to me as a geek usually gets a knee where it hurts!

> Do you do this professionally?

hmmmm... I try... actually you can make a damn good living out of engineering and have a heap of fun in the process... so if anyone is thinking about it - stop thinking and go do it.

Melanie

boroko
- 10th September 2003, 08:48
Mel,

I only mean't it in a complimentary way.
I'm old enough to remember when "hacker" and 'geek" were looked upon as as people to hold in awe. Well at least by people who wanted to understand something.

I enjoy the replys that you give and appreciate the effort in getting the minions up to speed.

Oh, and I agree about "trying to keep the smoke in" for a living, all of these neat things to play with and a check too...

Mark