Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

need advice on choosing a PIC

Status
Not open for further replies.

T3STY

Full Member level 4
Full Member level 4
Joined
Apr 17, 2012
Messages
239
Helped
24
Reputation
48
Reaction score
24
Trophy points
1,308
Visit site
Activity points
3,715
I have a project that I'm still figuring out the specifications, but a few base ones have been set.
I need a PIC that can receive a lot of external interrupts to control the status change of at least 7 rotary encoders with push button, which makes it 3x7=21 pins - so 21 external interrupts. In addition to this, the rotary encoders will have a bi-color LED (14 more pins) that should be controlled directly from the PIC. Probably bi-color encoders will cost a lot so I may give up and use single colored LEDs, but that's not the original idea. LEDs will be controlled only in their on/off status (digital) so analog control is totally optional. But I'm planning on using analog output if the rotary encoders will have single color LEDs.
Most important part, I need the PIC to communicate with a PC via USB, I'm still getting info on that (if you have some interesting links you may post them too, thanks), but that makes it another 2 pins. So, for now, a minimum of 36 separated I/O pins is required.

I have done some research on Microchip's PIC16 list and I found these the most interesting because of integrated osclillator and/or high speed operation (8MHz to 32MHz) and because of the number of I/O pins. Which one would you suggest me, and why?

**broken link removed**
**broken link removed**
**broken link removed**
**broken link removed**
**broken link removed**

Another question is about reducing the number of pins used on the PIC. I may use a LED driver to reduce the 14 bi-color LED pins to only 2 (serial communication). But can I somehow reduce the number of pins used on the rotary encoders and their push button? I'm thinking about some very small IC with 6 I/O pins that would read the pins statuses and then send them all-in-one with a serial communication to the PIC, and receive some info and turn on/off the LEDs. A part some PIC10/12 devices, do you have some very very cheap IC to suggest?
 

In PIC10/12 PIC12F675 is good.

I can't understand rotary encoder exactly. So please share datasheet so that i can help u
 

Most important part, I need the PIC to communicate with a PC via USB, I'm still getting info on that (if you have some interesting links you may post them too, thanks), but that makes it another 2 pins. So, for now, a minimum of 36 separated I/O pins is required.

16F727
16F887
16F917
16F946
16F777

If a USB module is required, then none of above as they do not offer a USB module.

There are a few PIC16 series, however I would recommend considering either PIC18 or PIC24 series.

Unless of course, you plan on using a low-speed software implementation of USB like 16FUSB.


If a DIP package is required over a Quad package, this would reduce the possible options even further.


Another question is about reducing the number of pins used on the PIC. I may use a LED driver to reduce the 14 bi-color LED pins to only 2 (serial communication). But can I somehow reduce the number of pins used on the rotary encoders and their push button? I'm thinking about some very small IC with 6 I/O pins that would read the pins statuses and then send them all-in-one with a serial communication to the PIC, and receive some info and turn on/off the LEDs. A part some PIC10/12 devices, do you have some very very cheap IC to suggest?

You could use a combination of parallel in/serial out (74HC165) and serial in/parallel out shift registers (74HC595) to act as inputs from the encoders and outputs for the LEDs.

Another option is to use port expanders (MCP23S17) which are typically available in either SPI or I2C interface, bidirectional and many offer hardware interrupts.

Either of the above options would greatly reduce the necessary pin counts for I/O.


You might want to checkout the PIC18F45K50, available in 40-pin DIP, internal 48MHz oscillator, 32kB of Flash, 2kB of RAM, for $2.50 or volume less $2.00.



BigDog
 

One thing no one's addressed is that no PIC supports 21 external interrupts, so you can't set it up exactly like that.

You could however:

1) Poll 21 pins at a fast enough rate that there will be no missed rotary encoder actuations.
2) Use one or more MCP23017 16-bit I/O expanders (to name one example part). One will let you configure and control 16 pins for read or write, including raising a shared interrupt when monitored pins of your choice change, using just 4 pins on the MCU. Very versatile part. They will also drive LEDs at up to 20mA per pin. Each additional expander requires only two more MCU pins, which makes MCU pin count less of an issue.

Or use shift registers, 8-to-3 line priority encoders (74HC148), etc etc..
 

@Golden Electronics: A rotary encoder like the ones I'd like to use looks like this:
http://www.alpha-crucis.com/3076-4464-large/rotary-encoder-illuminated-rgb.jpg
@Darkcobra: yes, that's one of the issues I was trying to solve. I guess a checklist at 32MHz (8MHz real speed) is fast enough to detect all changes in the encoders at very fast rate. But it would be easier to manage the interrupts than a checklist, so I'll try to avoid that as much as possible.

If a USB module is required, then none of above as they do not offer a USB module.
how couldn't I see that? I totally forgot to check the USB modules... thanks for the heads up!

At this point I'm really thinking at using port expanders, some that would offer at least 3 HW interrupts over 5 I/O pins. This way I can use one IC per rot. encoder and have very neat control over each. Do you have any cheap expanders to suggest? I never had to deal with these so I'm a bit lost in finding a good and cheap one, but I'll make some research ASAP :)
I wasn't able to find the 16FUSB datasheet on Microchip's website, maybe it's not being produced anymore. Now, I'm looking for some PIC 16 with USB support, but I found none. I don't want to buy a PIC18 C compiler, HiTech's C compiler only allows free compiling for PIC 10/12/16 MCUs... I have to look for some C compiler too.
 
Last edited:


That is complex project,
you need more powerfull mcu than PIC16 series,
try with 18F4553
regards
 

For the expander, try the MCP23017:

https://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en023499

Which you can buy direct from Microchip, or from many major suppliers like Newark and Mouser. $1.20 from Newark in single quantity DIP28. You can do it a bit cheaper, even just using pins on a high pin count MCU, but as you surmised it will involve some extra cleverness and effort on your part. (Not to mention driving all those LEDs directly from the MCU, you'll need to verify you're within the chip's maximum current rating, and not just that of the individual pins.)

You might also consider using a USB-to-serial module, instead of the MCU's on-board USB. If you're unlucky, it may take a while to get Microchip's USB stack working properly. Took me a week, including tracking down what seems to be a bug in their stack; not fun for a USB newbie.
 

I read about troubles with microchip's USB module, it looks like I'll have a bad time figuring out what's wrong in case it's not working. Moreover, I don't think I'll be able to simulate the USB function in some simulation program like Proteus ISIS, and that makes it hard even to make the first moves. But I'll be avoiding using a USB-to-serial module if possible, it just adds some more chaos to the thing and I may end up spreading PIC clocks on properly managing these devices instead of actually working with them.
@pasicr: Yeah, looks like some serious performance is needed so I may consider 18Fxx PIC series now that wp100 shot me with the free version of Microchip's C compiler for PIC18 series.

Thank you for your suggestions guys! I'll be consider each one of them and properly plan this project's development requirements and bases.
I hope to get back soon with good news ;)
 

LEDs can be driven by few number of pins using the technique of charliplexing, look it up on google it is pretty easy if the MCU provides high impedance pins. I have implemented it on atmega devices.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top