PIC interface with...?

Discussion about projects that used PIC Microcontroller, Hardware Interface, Programming Algorithm and etc......

PIC interface with...?

Postby syntium87 » Mon May 16, 2011 7:29 am

hi guys...

i want to ask about this matters..i have a 12V switch..and i would like to interface it to a pin from any port of PIC16f877a..
inside the switch have the 12V led..so the switch is a (push button + 12V led)..i dont know why in the catalog i buy from it said switch :? ..

anyway..whenever the PIC gives an output it means that 5V output right?so how i'm going to connect this switch so that it can be turn on the led (output) and i can press the switch(to give input) to the pic...can it be done on a single PIC pin??
what are the device i need to connect between the PIC and the switch??
syntium87
Novice
 
Posts: 27
Joined: Sun Apr 03, 2011 12:51 am

Re: PIC interface with...?

Postby Brian Griffin » Mon May 16, 2011 12:38 pm

You need isolation between the port pins and the high voltage device. Failing to do so may destroy your microcontroller.

Read up about relays and isolations in the 'net. There is plenty of information about that online.
PIC - UIC00B from Cytron (replacement for my broken PICKit 2), Pickit 3, MikroC for PIC
dsPIC - MikroC for dsPIC, mikromedia board (dsPIC33)
AVR - AVR Dragon
Parallax - Prop tool
User avatar
Brian Griffin
Enthusiast
 
Posts: 403
Joined: Mon Jan 17, 2011 9:36 am

Re: PIC interface with...?

Postby robosang » Sun May 22, 2011 5:34 pm

Not really sure what is the switch look like. But if the LED is mechanically switch on, you can have a voltage divider to read 5V from 12V.
robosang
Expert
 
Posts: 1239
Joined: Wed Jun 10, 2009 5:37 pm

Re: PIC interface with...?

Postby shahrul » Sun May 22, 2011 10:42 pm

I don't get what the device? Is that a switch with LED indicator?
You may test how much current flow to light-up the LED, I think it's not necessary 12V.
User avatar
shahrul
Professional
 
Posts: 812
Joined: Sat May 16, 2009 9:54 pm
Location: Selangor

Re: PIC interface with...?

Postby syntium87 » Tue May 24, 2011 9:13 am

the switch / push button i want to use is the illuminated push button which used in factory or industrial area..the one with red and green light (on and off machine)..inside the push button is... [push button + led 12V + contact block(like a relay) ]...

this illuminated push button have a maintained function (which is the when the button is pressed it maintain...and press again to release the button)..

how to interface the pic with this illuminated push button..?help me plzz...
syntium87
Novice
 
Posts: 27
Joined: Sun Apr 03, 2011 12:51 am


Re: PIC interface with...?

Postby syntium87 » Fri May 27, 2011 3:51 pm

if im using optocoupler..how to interface it with the PIC...?n can the cct have the feedback signal to the PIC??
still not really know how to program the optocoupler...

help.... :?
syntium87
Novice
 
Posts: 27
Joined: Sun Apr 03, 2011 12:51 am

Re: PIC interface with...?

Postby robosang » Sat May 28, 2011 12:07 pm

We do not know which switch you are talking about, if you look at the reply from other, it is assumption you are using this and that switch, if you really want us to help you, capture a picture or datasheet, show it to us.
robosang
Expert
 
Posts: 1239
Joined: Wed Jun 10, 2009 5:37 pm

Re: PIC interface with...?

Postby syntium87 » Mon May 30, 2011 12:35 pm

sory everyone..this is the switch that im talking about..
link --- > http://www.apem.co.uk/pdf/UKS%20PDFs%202009/6-12.pdf

i really dont know how to program n interface it with mcu
syntium87
Novice
 
Posts: 27
Joined: Sun Apr 03, 2011 12:51 am

Re: PIC interface with...?

Postby ober » Mon May 30, 2011 9:14 pm

Assuming you are using A01 series. The datasheet show pin 1 is connected to pin 3 by default, when the button is press pin 1 is connected to pin 2.

Just take pin 1 and pin 2 as your switch terminal, like normal small push button. Look at the the sample schematic from Cytron DIY project. There are tons of sample using push button. As for the LED, you will need to test for the correct terminal. Try to connect 12V (=) from power supply to pin 1, and the gnd to pin 3. Press the button and look at the LED, if is is not illuminated, try reversing the terminal, + to pin 3, Gnd to pin 1.

Since it has 2 poles, the LED should have separated connection with Push button you are going to you. You will need to get it right first.
Ober Choo
Cytron Technologies Sdn Bhd
www.cytron.com.my
User avatar
ober
Moderator
 
Posts: 1486
Joined: Wed Apr 15, 2009 1:03 pm

Next

Return to PIC Microcontroller

Who is online

Users browsing this forum: No registered users and 4 guests