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
Joined
Jan 1, 2015
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
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
 

Debasis Swain

Member level 2
Joined
Feb 2, 2013
Messages
52
Helped
10
Reputation
20
Reaction score
10
Trophy points
1,288
Activity points
1,606
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

betwixt

Super Moderator
Staff member
Joined
Jul 4, 2009
Messages
15,156
Helped
4,945
Reputation
9,911
Reaction score
4,757
Trophy points
1,393
Location
Aberdyfi, West Wales, UK
Activity points
128,729
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

Top