Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

A bad design example in almost every way.

Status
Not open for further replies.
Switches straight to ground isn't a good idea. They could easily be pulled low via RA4.

Mike.
 
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..:)
 
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:
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 470:eek:hm: 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.
 
Stellarcore said:
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 ;)
 
Gayan Soyza said:
Can use internal weak pullups.

Here in my area PIC 16F84As price is expensive than PIC 16F88 :D
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?
 
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.
 
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.


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 (https://www.mystrobl.de/ws/pic/mm47/index.htm)

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.
 
Last edited:
The tyeing of MCLR to Vdd was recommended for the 16F84/A. It is only on later chips this is inadvisable.

Mike.
 
geko said:
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!.
 
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.:eek: No ICSP then.

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

Mike.
 
Pommie said:
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.:eek: No ICSP then.

Why would you have a UV eraser for a 16C84?, it's an EEPROM chip (the first MicroChip one), it was replaced by the 16F84 because of security issues over the code protection - basically the F84 was the same chip, with the flaw solved. Not long afterwards the F84A replaced that, just a later silicon revision, no significant changes really.
 
Your right, I didn't need a UV eraser for the 16c84, however, there were some pic chip that I had to use it for. I also had to dig it out about 2 years ago to erase the 16c745.

Mike.
 
Pommie said:
Your right, I didn't need a UV eraser for the 16c84, however, there were some pic chip that I had to use it for. I also had to dig it out about 2 years ago to erase the 16c745.

As the 16C84 was the first (and only for quite some time!) EEPROM PIC they carried on using the C designation (which I don't thing actually signified anything) - but once they saw how popular it was, and had to redesign the flawed 16C84, they took the opportunity to alter the designation to F rather than C. Note that the 'F' doesn't signify 'FLASH' as many appear to think, it was just a different letter to 'C', and most F series PIC's are EEPROm rather than FLASH.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top