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.

[SOLVED] LDR+pic16f877+ADC+assembly

Status
Not open for further replies.

rb13

Newbie level 3
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
 
  • Like
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.
 
  • Like
Reactions: rb13

    rb13

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

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top