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.

General Pic Question

Status
Not open for further replies.

richb

New Member
Hi

Before I start I must point out that I come from a CS background and electronics is very new to me. Hopefully this question isn't too stupid, but I have google’d, and the results haven’t satisfied me.

I'm looking at using a PIC16F84 chip to activate an opto-isolator to switch an external device, don't want to use a relay.

My question is, when I set for example port RA0 to Ouput and I send '1' the port is driven high, does this mean i'm outputting the 'VDD' voltage on the RA0 line. Same for when I send '0', am I just grounding the Pin.

If someone could explain the Input/Output concept or point me to some information it would be greatly appreciated.

Thanks

Rich
 
When the output of the port is high, the voltage is not exactly Vdd; it is
Vdd-0.7 V (min). When the output is low, the voltage is 0.6 (max). This parameters are named Voh and Vol in the data sheet.
 
That isn't a PIC, so it's not a very good example - but assuming it was, P0 and P1 would be set as outputs, set high to turn the LED's (and opto-couplers) OFF, and set low to turn then both ON.
 
Thanks.

So I assume then that for this circuit attached, set HIGH would turn the LED's and opto-couplers on and set LOW would turn them off ?

I'm just checking just encase it doesn't work like this :)

Sorry for the visio diagram, really need some other software.

Thanks
 

Attachments

  • circuit.png
    circuit.png
    12.9 KB · Views: 175
That should work with a couple qualifiers;

(1) You probably should have current limiting resistors in series with each LED and optocoupler.
(2) PIC I/O pins can sink a little more current than they can source and I suspect that's one of the reasons 'sink' switching to ground is used more often than 'source' switching.

Good luck. Mike
 
Yes, but you need those current limiting resistors so that you do not exceed the PIC's max current out per pin/port spec and so you don't blow the LEDs.

FWIW - A lot of circuits work 'backwards' and use their I/O to ground the circuit (sink) rather than use their I/O to provide the +V (source) because a lot of devices can sink more current than they can source. That PCF8574, for example, can only source (at max) 300uA, while it can sink (typ) 25mA.

Rick
 
If you use the PIC16F84, as you said in your first message, then you can't use a 3.3V power supply. You need 5 V.
 
eng1 said:
If you use the PIC16F84, as you said in your first message, then you can't use a 3.3V power supply. You need 5 V.

Nobody should be looking at using a 16F84 in the 21st century!, it's long time replacement the 16F628 is available in an LF version!.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top