Help with 12C509 program

Jan 06, 2004 5 Replies

Hi all,



Would anyone be able to help a relative newbie to PIC's?



I have built and have working the following circuit:



formatting link



My question is that I need to disable the PIC i.e. no output when there is a high logic signal to the chip. Would it be best to use SLEEP or what? I apologise for being thick, but after a few days messing about, I am still unable to find a satisfactory conclusion.



TIA


--dave news001@nospam.org.uk

Sleep does not disable any outputs. They will remain just as they were when the Sleep instruction was executed. I'm not sure what you mean by "no output". An pin is either output-low, output-high, or high-impedance (input). In some cases the high-impedance state can be configured with weak pull-ups, so it won't be quite as high an impedance.

-Robert Scott Ypsilanti, Michigan (Reply through this forum, not by direct e-mail to me, as automatic reply address is fake.)

I'm sorry I was vague. I need to turn the LED off when a logic '1' is applied to one of the other i/p pins, and enabling the output when that i/p goes to '0'. I've so far been unable to implement this due to being at the bottom of the learning curve with PIC's. I have very little idea (as yet) what asm code to put in and where to put it :(

--dave news001@nospam.org.uk

You might show the assembly code you have tried so far here. Add comments to the code to describe the intent.

-Hul

Dave wrote: : Hi all, : : Would anyone be able to help a relative newbie to PIC's? : : I have built and have working the following circuit: : :

formatting link
: : My question is that I need to disable the PIC i.e. no output when there : is a high logic signal to the chip. Would it be best to use SLEEP or : what? : I apologise for being thick, but after a few days messing about, I am : still unable to find a satisfactory conclusion. : : TIA

- for email, put the word "keep" in subject line -

Hi, put a pnp transistor in the power supply to the pic. Apply your signal to the base (via a resistor).

Read the input pin in a loop, and when you detect that it goes low, turn on the LED. As to how to turn on an LED, that depends on your circuit. Drive the base of a NPN through a 4.7K resistor, and let the NPN sink current from the LED. Use another resistor in series with the LED to limit the current to a safe value.

-Robert Scott Ypsilanti, Michigan (Reply through this forum, not by direct e-mail to me, as automatic reply address is fake.)

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required