Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

detecting 2switchs and sending output to 2LEDs ona PIC

Status
Not open for further replies.

BD

Member level 1
Joined
Oct 14, 2004
Messages
38
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
321
Hi, I am new to pic programming and need help. I have to detect the status of two switchs attached to portb and send the output to two leds
on portc of the PIC.Effictively I have to generate a truth table of results
i.e. when both switches are 0 then both leds are on.and when both switchs are 1 then both leds are off.
any help greatly appreciated.
 

Do you want help about hardware and/or software for do this?

Try to find some PIC's books on the EDAbooks section, or by a search on Google.

Or you should specify your question.
 

It's a Software explaination I need. After I set up one port for the inputs and one port for the outputs should i use a Bit test command and how do i get this answer to output a 1 to the led or a 0 if there was no switch pressed.Thanks
 

Sure You can use Bit test, and then bit clear or bit set.
But I think more easier is just to copy portb status to portc in this situation. This will work only if switch 1 is on the first portb pin and led 1 is on the first portc pin, and so on. Sure, maybe you will need to reverse bits, all depends on switch and leds connection.

Cheerz.
 

will i be able to just mov the value of the switch press to the o/p port
for the two switches.
 

BD said:
will i be able to just mov the value of the switch press to the o/p port
for the two switches.
Yes!
By this You will just copy status from input port ot output port. Remember about possibility of bit reverse (or xor - how You like).
 

Another option is to got to the Microchip website.
They got tons of examples and application notes about PIC.

Enjoy
:twisted:
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top