Author Topic: Do inputs in a PIC have to be grounded?  (Read 5476 times)

0 Members and 1 Guest are viewing this topic.

Offline little_carlosTopic starter

  • Regular Contributor
  • *
  • Posts: 133
Do inputs in a PIC have to be grounded?
« on: November 17, 2014, 02:04:59 am »
Hey guys, im here with a new question
im designing a plc with a 16f628A, and im here to see if i did something wrong
the thing is, ive seen some designs at internet and some of them have their inputs with a 10k resistor from 5v, and then they go to ground via the optoisolator
something like this:


and in my design, i have the inputs with a 5v input, and then trough a optoisolator and a 1k resistor
is there something wrong with my design?
this is by the way
 

Offline David_AVD

  • Super Contributor
  • ***
  • Posts: 2806
  • Country: au
Re: Do inputs in a PIC have to be grounded?
« Reply #1 on: November 17, 2014, 02:10:26 am »
In your circuit the opto is pulling the PIC input up to +5V via a 100K resistor when the opto turns on, but there is nothing to make the PIC input go back to logic zero when the opto turns off.

The circuit you found is a correct way of doing it.  The logic will be upside down, but that's easily handled in code.
 

Offline little_carlosTopic starter

  • Regular Contributor
  • *
  • Posts: 133
Re: Do inputs in a PIC have to be grounded?
« Reply #2 on: November 17, 2014, 02:12:45 am »
So im doing it wrong then?
in proteus works as how i want, but im not pretty sure it will on physical
 

Offline David_AVD

  • Super Contributor
  • ***
  • Posts: 2806
  • Country: au
Re: Do inputs in a PIC have to be grounded?
« Reply #3 on: November 17, 2014, 02:14:50 am »
Yes, your circuit is not good.  Do it the way the other diagram shows.

You're also missing the current limiting resistors for the opto inputs.
 

Offline little_carlosTopic starter

  • Regular Contributor
  • *
  • Posts: 133
Re: Do inputs in a PIC have to be grounded?
« Reply #4 on: November 17, 2014, 02:30:34 am »

is this a correct way?
 

Offline David_AVD

  • Super Contributor
  • ***
  • Posts: 2806
  • Country: au
Re: Do inputs in a PIC have to be grounded?
« Reply #5 on: November 17, 2014, 02:35:58 am »
Just do it the way the other schematic did;

Emitter of the opto to 0V
Collector of the opto to PIC input
10K "pull-up" resistor from opto collector to +5V

When the opto LED is off, the 10K "pull-up" resistor pulls the PIC input to +5V.  When the opto LED is on, the PIC input will be pulled down to 0V.
 

Offline David_AVD

  • Super Contributor
  • ***
  • Posts: 2806
  • Country: au
Re: Do inputs in a PIC have to be grounded?
« Reply #6 on: November 17, 2014, 02:38:23 am »
If you really want the use the opto to pull the PIC input to +5v:

Collector of the opto to +5V
Emitter of the opto to PIC input
10K "pull-down" resistor from opto emitter to 0V

When the opto LED is off, the 10K "pull-down" resistor pulls the PIC input to 0V.  When the opto LED is on, the PIC input will be pulled up to +5V.
 

Offline ludzinc

  • Supporter
  • ****
  • Posts: 506
  • Country: au
    • My Misadventures In Engineering
Re: Do inputs in a PIC have to be grounded?
« Reply #7 on: November 17, 2014, 06:17:07 am »




Oh man, there is so much wrong with this schematic!

VDD and VSS is mixed up, inputs should be on the left, outputs to the right, not that arsed about regulator arrangement.

This is a really, really bad schematic to learn from.
 

Offline miguelvp

  • Super Contributor
  • ***
  • Posts: 5550
  • Country: us
Re: Do inputs in a PIC have to be grounded?
« Reply #8 on: November 17, 2014, 06:58:34 am »
Not to mention that it shows 20 pins instead of 18 and there is only one VSS and one VDD and the VDD is in the wrong pin, of course the other extra VDD and VSS are on other pins that they don't have to be at, because the extra 2 VDD and VSS are bumping the pin index making it a bigger mess.

« Last Edit: November 17, 2014, 07:01:30 am by miguelvp »
 

Offline macboy

  • Super Contributor
  • ***
  • Posts: 2254
  • Country: ca
Re: Do inputs in a PIC have to be grounded?
« Reply #9 on: November 17, 2014, 02:45:27 pm »
Not to mention that it shows 20 pins instead of 18 and there is only one VSS and one VDD and the VDD is in the wrong pin, of course the other extra VDD and VSS are on other pins that they don't have to be at, because the extra 2 VDD and VSS are bumping the pin index making it a bigger mess.


The pinout on the schematic is correct for the SSOP package of PIC16F84A (but not correct for DIP/SO). The connection of Vdd and Vss is wrong as already pointed out: Vdd is + power, and Vss is ground.
 

Offline ivan747

  • Super Contributor
  • ***
  • Posts: 2045
  • Country: us
Re: Do inputs in a PIC have to be grounded?
« Reply #10 on: November 17, 2014, 02:55:12 pm »
ALso, the wires are bent to an angle and the pull up resistors arent clear enough.
 

Offline David_AVD

  • Super Contributor
  • ***
  • Posts: 2806
  • Country: au
Re: Do inputs in a PIC have to be grounded?
« Reply #11 on: November 17, 2014, 08:47:39 pm »
...inputs should be on the left, outputs to the right, not that arsed about regulator arrangement.

In general I like the flow to go from left to right, but having it any other way doesn't make it a bad diagram.  Sometimes the grouping of connectors is more important.

ALso, the wires are bent to an angle and the pull up resistors arent clear enough.

Seriously?  You guys must have so much trouble reading a lot of schematics.
 

Offline WarSim

  • Frequent Contributor
  • **
  • Posts: 514
Re: Do inputs in a PIC have to be grounded?
« Reply #12 on: November 19, 2014, 08:36:09 pm »
8th post before Vdd and Vss was mentioned!  Good grief :).
Kudos to macboy for catching the package error. 

Just to set off the USA zealots.  Different countries have different schematic layout conventions.  Note that they are conventions not rules. 
No I didn't check the OPs location.  I dosnt matter, unless the schematic is published in a journal, and then they will define the accepted format. 

The OP asked for help on function not format.  Why not fully answer the question asked instead of the opinion you want to give.


Sent from my iPad using Tapatalk
 

Offline ivan747

  • Super Contributor
  • ***
  • Posts: 2045
  • Country: us
Re: Do inputs in a PIC have to be grounded?
« Reply #13 on: November 24, 2014, 08:07:17 pm »

ALso, the wires are bent to an angle and the pull up resistors arent clear enough.

Seriously?  You guys must have so much trouble reading a lot of schematics.
[/quote]

Most people including me can read it, but its not as easy as if you made it look like everyone else's. In this case I find the odd arrangement unnecessary.
 

Offline Macbeth

  • Super Contributor
  • ***
  • Posts: 2571
  • Country: gb
Re: Do inputs in a PIC have to be grounded?
« Reply #14 on: November 24, 2014, 09:58:15 pm »
I had no trouble reading the schematic. But, yeah, some things are irritating. Like the supply rail drops down a step for no reason. Also the lack of labeling supply and ground. However, schematic layout software can be this irritating too - and as a draft, ready to netlist for PCB layout, rather than a published nicely presented schema I don't have a problem at all.

ETA: Is there anything in the electronics schematic capture world similar to the code obfuscation competitions, especially beloved of C programmers?  >:D

ETA2: Don't PICs have programmable pull/up/downs? Like Atmel AVRs? I've never used a PIC in my own designs before.
« Last Edit: November 24, 2014, 10:34:35 pm by Macbeth »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf