PIC Selection and Setup Help

Thread Starter

eckcotech

Joined Jan 17, 2012
28
Hey all,

I could use some help deciding how to setup a new project I am working on. Any input on the selection of a PIC would be great also.

Requirements:

4 x button inputs (accept user input)
1 x LCD datasheet (display data)
2 x ADC Inputs (read sensors)
1 x Pulse counter (hardware interrupt on T1OSI) (count RPM)
2 x PWM output (control proportional valves. Flow data monitored by ADC Inputs above)
1 x USART (Tx & Rx)
2 x LEDs (Indicator lights)

Problems:

No PICs I have used will have enough IO to handle all this. With that in mind, I have decided to use multiple PICS via SPI. My question is, what would be the best configuration for this setup? How would you split up these tasks to different PICS and what PICS would you use?

Also, the space where the LCD goes has limited space. A large circuit board will not fit. I may need to split the circuit up in a way that allows a smaller circuit to connect back to the main control circuit for the buttons/LCD screen. Would SPI be the correct way to do this?
Thanks for any input.
 

Thread Starter

eckcotech

Joined Jan 17, 2012
28
Thanks t06afre. I have that link on bookmark :)

That unfortunately only addresses a small portion of the issue. I have PICs here that are capable of handling each and every task in the requirements section, just not all at once.

Also, I will need to split the circuit into two locations as stated above so I will need to communicate with the buttons and LCD from about 6-8 feet away from the main board.

And finally, if I did select one PIC that would handle ALL the requirements on a single chip, it would have to be a dsPic. I have no development or chip programming environment for these pics and have never used one before.

Currently, I use MikroC Pro for PICS and a PICKIT2 programmer. That said, I am not against upgrading my current lab to accommodate this project, I'm just not sure it's necessary given that I have to split up the circuit into multiple locations anyway.

Any thoughts?
 

thatoneguy

Joined Feb 19, 2009
6,359
You could read the 4 buttons on one ADC pin. Have button 1 go to ground, button 2 give a 1.25 V level, button 3 giving a 2.50V value, and button 4 giving a 2.75V value.

That leaves room for more buttons.

You can also drive the LCD using 1 pin and a shift register, see Roman Blacks page on the 1pin bit shifter. You could also use a serial LCD to save pins as well.

With those added, it should fit on a 16F690

Otherwise, something like the 18F25k22 which is a 28 pin would work fine with "standard" coding for LCD and buttons.
 

Thread Starter

eckcotech

Joined Jan 17, 2012
28
You could read the 4 buttons on one ADC pin. Have button 1 go to ground, button 2 give a 1.25 V level, button 3 giving a 2.50V value, and button 4 giving a 2.75V value.

That leaves room for more buttons.

You can also drive the LCD using 1 pin and a shift register, see Roman Blacks page on the 1pin bit shifter. You could also use a serial LCD to save pins as well.

With those added, it should fit on a 16F690

Otherwise, something like the 18F25k22 which is a 28 pin would work fine with "standard" coding for LCD and buttons.
Wow, great idea on the buttons! Can't believe I never thought of that before.

I will also check into the LCD 1 pin method you talked about. Reducing the LCD from 11 pins to 1 pin would pretty much solve most of me issues here.
 

t06afre

Joined May 11, 2009
5,934
Another tip is that in 4 bit mode. The LCD only need 6 pins. What kind of IC package can you use. A 44 pin SMD package take up very little space. Often more practical than adding extra support chips
Also be sure that PWM channels do not come in conflict with the chip onboard timers you plan to use.
 

ErnieM

Joined Apr 24, 2011
8,377
I stole this idea years ago from the Parallax people.

The LCD needs 4 data lines as outputs it only looks at when the control line says to. 4 buttons could work on 4 direct lines as inputs. 8 resistors can keep them separate.

So you only need 6 lines to both drive the LCD and sense 4 buttons.
 

ErnieM

Joined Apr 24, 2011
8,377
As stated, this could be done with a few of the PIC18 devices, and the compiler is free for those. They may need a PICkit 3, I have not checked.

What is unstated is how the project will divide up into two segments, and how those segments will communicate.
 

colinb

Joined Jun 15, 2011
351
Although, you might just find a microcontroller with more pins and save yourself a lot of effort and complexity, and potentially make a smaller, more robust product.
 

Thread Starter

eckcotech

Joined Jan 17, 2012
28
Although, you might just find a microcontroller with more pins and save yourself a lot of effort and complexity, and potentially make a smaller, more robust product.
I am actually looking at the PIC18F6723 datasheet right now. It's surface mounted, 64pins and I would need to find a programmer for it, but I think this will give me everything I need.

That being said, I will still need to address the separation issue that has not been addressed.

Remember, I need to have the LCD and buttons where the user can access them but I have a VERY limited amount of room. Because of this, I need to make one board to run the LCD and Buttons that communicates back to the master that is controlling EVERYTHING else.

The two boards will be about 6 feet apart in a pretty noisy environment (within 2 feet of a 15HP lawnmower engine) :eek:
 

colinb

Joined Jun 15, 2011
351
Remember, I need to have the LCD and buttons where the user can access them but I have a VERY limited amount of room. Because of this, I need to make one board to run the LCD and Buttons that communicates back to the master that is controlling EVERYTHING else.

The two boards will be about 6 feet apart in a pretty noisy environment (within 2 feet of a 15HP lawnmower engine) :eek:
Sounds like a job for an RS-485 communication link. Put a simple user interface controller in the LCD+button module: a microcontroller with a UART and enough pins to control the LCD and read buttons. Add an RS-485 transceiver IC. Then run CAT5 UTP cable from the “master” to the “UI module”. The master can command the display module to show something on the LCD and can poll to get button events.
 

spinnaker

Joined Oct 29, 2009
7,830
I am actually looking at the PIC18F6723 datasheet right now. It's surface mounted, 64pins and I would need to find a programmer for it, but I think this will give me everything I need.

/QUOTE]

Just buy a PicKit III. Don't even thing of anything else except maybe a PiCKit II. But be sure the II supports that chip because it does not support newer chips.

The II comes with a logic analyzer a a few other features not found in the III.
 

PaulEE

Joined Dec 23, 2011
474
I am actually looking at the PIC18F6723 datasheet right now. It's surface mounted, 64pins and I would need to find a programmer for it, but I think this will give me everything I need.

That being said, I will still need to address the separation issue that has not been addressed.

Remember, I need to have the LCD and buttons where the user can access them but I have a VERY limited amount of room. Because of this, I need to make one board to run the LCD and Buttons that communicates back to the master that is controlling EVERYTHING else.

The two boards will be about 6 feet apart in a pretty noisy environment (within 2 feet of a 15HP lawnmower engine) :eek:
Have you considered an 18F4550? Or, 16F877A? 40-pin DIP packages with a ton of I/O.

Don't forget - a simple multiplexer can allow you to address multiple devices (especially SPI or single-bit data lines) from the same PORT pins. A chip I've used quite happily lately is the 74HC4066 quad bilateral switches.

You can squeeze what you want on the 18F4550 if you can see the moderately complex code through to the end. Go for it! :D
 

John P

Joined Oct 14, 2008
2,025
Gosh durn it, I was just about to say "PIC16F877A" and in the last posting, someone beat me to it. Yes, that's the one to use. Has all the features you want. You could almost do it with a PIC16F690, but it only has 1 PWM--though you could make a second one in software, if you don't need very fast operation.
 
The O.P. mentioned a hardware counter input, plus two PWM's, so that would suggest 3 ccp modules.

A very capable 18f chip would be the 18f26k22 (28 pin), or perhaps the 18f46k22 (40 pin). Loads of timers and ccp modules. Should handle everything in hardware. As mentioned earlier, always check with programmer and compiler capability.
 
Top