Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Thread Tools Display Modes
Old 9th January 2008, 04:58 AM   (permalink)
Default A bad design example in almost every way.

The following project (actually a neat idea a Mastermind calculator) is flawed in many ways but is a good example how NOT to design a small microcontroller.
http://www.mystrobl.de/ws/pic/mm47/index.htm

Anyone care to guess what's wrong?
__________________
Bill
Smart Kits build Smart People

http://www.blueroomelectronics.com
blueroomelectronics is offline   Reply With Quote
Old 9th January 2008, 05:13 AM   (permalink)
Default

Switches straight to ground isn't a good idea. They could easily be pulled low via RA4.

Mike.
Pommie is online now   Reply With Quote
Old 9th January 2008, 05:20 AM   (permalink)
Smile Hmmm...

What i can understand from this figure is that - it is combination of lines and boxes with 8 8 8 8 written in them...

I prefer colorful figures...

Regards,

Simran..
__________________
Simran..
8051 Specialist..
simrantogether is offline   Reply With Quote
Old 9th January 2008, 05:33 AM   (permalink)
Default

1. Driving lots of LED displays directly off of the PIC too much current.

2. The buttons are connected to the display. I take it the intention was to also multiplex the buttons with the display by reading it periodically, but if you hold the buttons down it will connect the pins directly to ground either turning on or off the corresponding segments of the display and also possibly sinking lots of current from the output pins. Should have used the unused pin RA4 (see #6).

3. As mentioned earlier, no pull up resistors on the switches.

4. MCLR connected directly to Vcc, I usually at least use a resistor between them.

5. No load caps on the crystal, probably wouldnt even start oscillating.

6. RA4 tied directly to ground, could sink too much current if the pin is incorrectly set in software.

7. No caps on Vdd near the PIC, possible dirty power.


EDIT: Strike number 5, didnt notice ceramic resonator. I've never used those personally, so I dont know if its use was correct or not.

Last edited by Stellarcore; 9th January 2008 at 05:45 AM.
Stellarcore is offline   Reply With Quote
Old 9th January 2008, 05:34 AM   (permalink)
Default

At first I thought it was RA4 to ground, but it's OK because it is an open drain IO. RB6 & RB7 are multiplexed between input and output modes so there really should be some 470hm: resistors in series with the two switches to limit current if the switches initially close during output mode. I guess the worse offenses are that there is no decoupling cap on the supply rails and RA0-3 really should have transistors driving the displays common anodes.
__________________
--- The days of the digital watch are numbered. ---
kchriste is offline   Reply With Quote
Old 9th January 2008, 05:59 AM   (permalink)
Thumbs up

Quote:
Originally Posted by Stellarcore
1. Driving lots of LED displays directly off of the PIC too much current.

2. The buttons are connected to the display. I take it the intention was to also multiplex the buttons with the display by reading it periodically, but if you hold the buttons down it will connect the pins directly to ground either turning on or off the corresponding segments of the display and also possibly sinking lots of current from the output pins. Should have used the unused pin RA4 (see #6).

3. As mentioned earlier, no pull up resistors on the switches.

4. MCLR connected directly to Vcc, I usually at least use a resistor between them.

5. No load caps on the crystal, probably wouldnt even start oscillating.

6. RA4 tied directly to ground, could sink too much current if the pin is incorrectly set in software.

7. No caps on Vdd near the PIC, possible dirty power.


EDIT: Strike number 5, didnt notice ceramic resonator. I've never used those personally, so I dont know if its use was correct or not.
  1. Correct, no current limiting resistors on the segments and no transistors to drive the anodes. Displays may work with fancy software tricks but is very poor design practice.
  2. Right, a couple of diodes and a single resistor could fix this, RA4 was availabe. Note: I would have put them on the Anode drivers, you get a free time delay for debouncing while switching digits
  3. ditto
  4. Tell that to Nigel
  5. Correct in the edit
  6. RA4 is the notorious open collector pin on many 16 & some 18 series PICs, no need to tie it to ground, simply make it an output.
  7. Ah yes, decoupling caps seem to always be ignored, same with filter caps.
I think you got them all, go to the head of the class
__________________
Bill
Smart Kits build Smart People

http://www.blueroomelectronics.com
blueroomelectronics is offline   Reply With Quote
Old 9th January 2008, 06:57 AM   (permalink)
Default

Quote:
Originally Posted by Stellarcore
3. As mentioned earlier, no pull up resistors on the switches.
Can use internal weak pullups.

Here in my area PIC 16F84As price is expensive than PIC 16F88
__________________
Gayan

My Website
http://gsmicro.blogspot.com/
Gayan Soyza is offline   Reply With Quote
Old 9th January 2008, 07:34 AM   (permalink)
Default

Quote:
Originally Posted by Gayan Soyza
Can use internal weak pullups.

Here in my area PIC 16F84As price is expensive than PIC 16F88
Yes but since the switches are tied to gnd the segments will light up when the buttons are pressed, bad design

16F88 are the best of the 18pin 16F series, they've got the works. The 18F84A is expensive and pretty old.

Edit one more error in the schematic, the busses are not labeled. How do you know which segment goes to which I/O pin?
__________________
Bill
Smart Kits build Smart People

http://www.blueroomelectronics.com
blueroomelectronics is offline   Reply With Quote
Old 9th January 2008, 07:37 AM   (permalink)
Smile

Quote:
Originally Posted by blueroomelectronics
The 18F84A is expensive and pretty old.
You mean 16f84...

Regards,

Simran..
__________________
Simran..
8051 Specialist..
simrantogether is offline   Reply With Quote
Old 9th January 2008, 07:37 AM   (permalink)
Default

Quote:
Originally Posted by blueroomelectronics
Yes but since the switches are tied to gnd the segments will light up when the buttons are pressed, bad design
Of course it needs the two resistors.
__________________
Gayan

My Website
http://gsmicro.blogspot.com/
Gayan Soyza is offline   Reply With Quote
Old 9th January 2008, 07:41 AM   (permalink)
Default

Both the 16F84 and 84A are relics. Use the 16F628A instead, cheaper too.

And yes it would need the pullups normally to read those switches.
__________________
Bill
Smart Kits build Smart People

http://www.blueroomelectronics.com
blueroomelectronics is offline   Reply With Quote
Old 9th January 2008, 09:10 AM   (permalink)
Default

Quote:
5. No load caps on the crystal, probably wouldnt even start oscillating.
The schematic doesn't show a crystal it shows a three terminal ceramic resonator which will have internal load capacitors.


Quote:
Edit one more error in the schematic, the busses are not labeled. How do you know which segment goes to which I/O pin?
Not shown on the schematic, but on the original web site the schematic was ripped from there is more detail on which I/O pins go to which segments.

I guess he's not a hardware guy since the switches are a very bad implementation. He even recognised the problem and kludged the software. I quote from the original web site (http://www.mystrobl.de/ws/pic/mm47/index.htm)

Quote:
For example, during the multiplexing, those two port B pins which are connected to the switches too, are made input frequently, in order to enable the pull-ups and to check the switch state. As soon and as long as a closed switch is detected, all pins are held in input state, in order to avoid short-circuiting a driving pin for more than a few ms. This method worked remarkably well. There is one drawback - the display is dark as long as a button is pressed.
One final point, the web page is dated 1998, that's ten years ago. The 16F84 might not be the PIC of choice today but back then it was so there is nothing wrong with the choice of PIC when taken in context.
__________________
Pete
picprojects.org.uk

Last edited by geko; 9th January 2008 at 09:22 AM.
geko is offline   Reply With Quote
Old 9th January 2008, 09:40 AM   (permalink)
Default

The tyeing of MCLR to Vdd was recommended for the 16F84/A. It is only on later chips this is inadvisable.

Mike.
Pommie is online now   Reply With Quote
Old 9th January 2008, 10:06 AM   (permalink)
Default

Quote:
Originally Posted by geko
One final point, the web page is dated 1998, that's ten years ago. The 16F84 might not be the PIC of choice today but back then it was so there is nothing wrong with the choice of PIC when taken in context.
Even back then the 84 was probably already obselete?, and replaced by the 16F628 - and back then there was even a migration document telling you of the few tiny changes required to use it!.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is online now   Reply With Quote
Old 9th January 2008, 10:44 AM   (permalink)
Default

I don't think the 628 was released until 99. I have the 1996 Microchip Microcontroller databook and even the 16F84 isn't mentioned, just the 16c84. I still have my UV eraser that I used to erase them. No ICSP then.

Quote:
Originally Posted by Nigel Goodwin
and back then there was even a migration document telling you of the few tiny changes required to use it!.


Mike.
Pommie is online now   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Latest
MP Lab Program Help bamafan54 Micro Controllers 3 19th October 2007 02:53 AM
help understanding this hbridge design.... jaydag71 Electronic Projects Design/Ideas/Reviews 2 5th June 2007 10:37 PM
Texas Instruments New Design Center. chemelec General Electronics Chat 0 18th May 2006 10:33 PM
Analog design: Some things to remember Roff General Electronics Chat 18 8th November 2005 01:38 PM
anybody knows how to design a calculator??? eleanor Electronic Projects Design/Ideas/Reviews 4 12th August 2005 05:44 PM



All times are GMT. The time now is 02:53 PM.


Electronic Circuits  |  Electronics Wiki
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.