Anybody here know C programming language?

Associate
Joined
5 Apr 2008
Posts
1,526
Hey guys,
Trying to learn embedded C.

I have a microcontroller (Microchip PIC18F4331) and have an LDR in the A/D converter pin.

Im trying to use interrupts and timers right now.

My task is to turn an LED off either at a certain light level or at a given time.

My question is about interrupts.. I understand how to use interrupt flags that are simple on or offs (like an interrupt at the press of a button)... but can an interrupt also be used for a certain light level being reached or would it have to be constantly checking the LDR light level in a while loop?
 
I think that would depend a lot on the PIC and if it has that functionality.

You could build an external circuit that triggers a pin when the light reaches a certain level. That what you could use the pin level interrupt.
 
Back
Top Bottom