PDA

View Full Version : Pic


charles0198
Feb 07, 2005, 02:42 PM
I need a PIC with the following specs

Internal RC oscillator upto 10MHz
Flash memory with adequate data and ram
22 I/Os
SOIC package

which part number has these features?

Comatose
Feb 07, 2005, 05:13 PM
No pic has a 10 mhz internal osc. Some of the pic18s have an 8mhz one that you can run back to the internal 4x PLL and get 32mhz.

Pic you want is probably pic18f2320.

adamdb
Feb 08, 2005, 09:52 AM
Go to www.microchip.com. They have an online tool to help you select the PIC you need.

Adam

stevesey
Feb 09, 2005, 03:41 AM
Comatose

Are you saying you can use the internal oscillator output to feed the external clock input? Could you elaborate a little.

I could do with some more clock speed for my combined receiver decoder/mixer idea and I'm trying to keep the component count down so this sounds interesting.

Meanwhile I'm off to read the data sheet in more detail.

Steve

charles0198
Feb 09, 2005, 02:31 PM
No, I am not interested to use the internal oscillator output to feed the external clock input. I just need enough high speed PIC to decode 8 channels and other features as Bruce Abbott's decoder and low external component count!
The external RC oscillator can also do the job but atleast 10MHz but NO additional Xtal!!!

Comatose
Feb 09, 2005, 08:29 PM
Charles, i think you're asking for something that doesn't exist. The external RC oscillator can't go over about 1mHz. Pic internal oscillators top out at 8 mhz. The RC to PLL hack gets around the need for a crystal. There isn't a pic with a 10 MHz internal oscillator. Your options are 1,2 4 or 8 meg. If you want something else (not counting low freq modes) you have to either use the PLL or an external component. I'd also argue that 8 mhz is plenty to decode and do whatever you want with 8 channels.


Steve, I've got one one better for you. Browsing the microchip site, the new pic18f2420 has more flash and RAM, the ability do connect the PLL to the internal OSC by a software command. The best part is that its actually cheaper somehow. I'm guessing a die shrink was involved, but whatever it was I'm not complaining.

stevesey
Feb 10, 2005, 04:11 PM
Charles

Sounds like you are doing a very similar thing to me. If you havent worked it out already Bruce's design has one main flaw when it comes to more than 4 channels.

That is: the software is a purely polling design and relies on the fact that the sync pulse is more than half of the total frame time (20ms), therefore you can read pulses, check them and then do the outputs during the sync pulse. Any more than 4 channels and this won't work (5 pulses = 2.3ms max *5 >= 10ms) .

Hence you need an interrupt driven state machine solution that can handle the input stream and the outputs at the same time. I've just about cracked this one over the past couple of days (really could do with an 18pin PIC with 2-16 bit timers and 2 CCP modules to make it easier). At 8Mhz I will have to live with 5us of jitter if the edges of the incomming and outgoing pulses occur within 10us of each other (yet to check this out with a scope). This should be within the servo deadbands so shouldn't be noticeable in practice. If I was straight decoding I could phase the outputs to avoid this but I'm mixing as well so the input pulse widths will be radically different from the outputs.

Aside from keeping the the ISR as quick and short as possible (longest path through mine is about 32 cycles - but it can handle both incomming and outgoing edges in that time if they overlap) - clock speed isn't an issue. The rest is spent in the main loop waiting for the ISR to tell us something has happened and I schedule the more complex mixing calculations into the sync pulse.

Although I hadn't seem Bruce's design before I seem to have incorporated most of the same features - storing the current channel values in EEPROM as failsafe values when a jumper is set is tomorrows task.

I just re-checked your post and I see you said 22 I/O's - I guess that means you have room for 28pins so I'd go for an 18F2220 or 2320. I'd like to use one of those, but I'm trying to get mine to fit in the same space as a conventional 4017 decoder chip.

Cheers

Steve

P.S. I think the 2220 series will do the INTOSC -> PLL stuff that comatose mentioned and give you 40MHz! Not sure what that would think of being 5mm away from a 40Mhz RX!!!

charles0198
Feb 11, 2005, 12:28 AM
Steve

I think your idea is good. As far as I understand you mean that whenever there is a positive(negative) pulse detected at PPM input, there should be a jump to ISR to output the respective channel! Have you implemented this and could it be possible with 4MHz (notice that with 4MHz each instruction will take 1 micro sec).
Also is it possible to do some signal conditioning within the two pulese of the PPM frame?

I have another question!
For the PLL frequency synthesized RX, how much noise a microcontroller can add to the supply line or in the rest of the circuit... e.g. the PIC?

dubious
Feb 11, 2005, 01:53 AM
if you are not set on a PIC you might want to take a look at the atmel avr series here is a list of their devices http://www.atmel.com/dyn/products/param_table.asp?family_id=607&OrderBy=part_no&Direction=ASC

these devices are 1 instruction cycle per clock cycle

stevesey
Feb 11, 2005, 05:09 AM
Charles

The ISR must be very short. Mine simply starts/stops timers and sets bit flags. A main loop checks the flags and does the rest of the processing depending what has happended (i.e. reads the stopped timer, checks for a valid pulse width, saves it, zeros timer etc).

At 4Mhz the timing it's very tight and may cause some sevro jitter. At 8Mhz I think it will be OK (especially as I have just found out the p18f1220 has 2 16-bit timers in a 18 pin package). I'm producing a version for this chip at the moment.

Yes code has been implemented and tested on the MPLAB simulator. Next week I plan to try on real hardware.

Cheers

Steve

stevesey
Feb 13, 2005, 12:05 PM
Charles

Another approach is to output the servo pulses all at once - I just found out that Bruce does something like this here http://homepages.paradise.net.nz/bhabbott/decoder/rxdec6.asm (I'd only seen his four channel design before). This does mean you need some rather lengthy code to sort out the order to end the pulses in. Also if the two pulses are the same length one will be inaccurate by a few uS. I suspect both of these many have influenced Bruce's decision to do the outputs in two batches of 3.

Also I have read that some gyros don't like it if the rudder and gain pulses arrive at the same time - outputting them in two batches allows you to get arround this.

Steve

westfw
Feb 13, 2005, 06:03 PM
Internal RC oscillator upto 10MHz
22 I/Os


22 IOs will put you into a 28 pin package anyway, so you shouldn't lose any outputs by having an external
crystal. Crystals (or resonators) aren't THAT big, are they? (although tiny ones are harder to find?)

Chippie
Feb 13, 2005, 06:11 PM
If timing isnt super critical(?) a resonator is probably the way to go as they (if of the 3 legged variety) can have a lower component count.....?