[SOLVED] LDR+pic16f877+ADC+assembly

Status
Not open for further replies.

rb13

Newbie level 3
Joined
Jan 1, 2015
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
20
hello
i need to compare 3 ldr and determine which one is exposed to more light. I cant seem to understand anything about ADC can u provide me with a code
I use assembly

I need it urgently plzz

thank you
 

1st You should hv knowledge in ldr and adc.
we know that ldr is inverse to light. So, that if light wiil increase then resistance of ldr will be decrease, according to that concept now we can use the ldr to adc and then adc to mcu, the output of adc now connected to mcu and now u can getting ur data
 
Reactions: rb13

    rb13

    Points: 2
    Helpful Answer Positive Rating
Referring to the OP, it depends on how you have the LDR devices connected to the PIC. Do you have three LDRs connected to three ADC inputs or is there some external switch that connects one at a time to a single ADC input?

True, the resistance of an LDR drops when exposed to light but that alone will not work. The ADC measures voltage so you need to make the LDR part of a potential divider in order to convert the light level so it can be measured. At the 'high' side of a potential diver the voltage will increase with light level, at the 'low' side it will decrease.

As far as the actual comparison works, all you have to do is decide which of the three measurments is largest. If you are using the ADC in 8-bit mode you only have to compare the ADRESH register values, if you want higher resolution you may have to compare ADRESL values as well.

Brian.
 
Reactions: rb13

    rb13

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…