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.

LDR design to use analog ports A and E 1(6F877)

Status
Not open for further replies.

lythanhthuan

Member level 3
Joined
May 18, 2006
Messages
67
Helped
6
Reputation
14
Reaction score
3
Trophy points
1,288
Location
M.T.A-VN
Activity points
1,718
I have Pbp. I use 16F877. I want to use analog ports A and E. get output from B channels. (for example channel 0). I know how to connect the channels and other circuit elements. All I want to learn is how can I get the 0 and 1 from analog channels. As far as I understand A/D conversion gives too much bits, I only want to take 0 and 1. For example when the LDR voltage is above 3 I want to light the led when it is below turn off the led. i think the program is so simple, please send me one, i need this for my term project

thanks !
 

Re: LDR 16F877

What do you need is a Voltage Comparator, not an ADC
 

Re: LDR 16F877

Hi,
For ur application 16F877A is more suitable than 16F877 because it has in-built Comparator Module. From Comparator u will get a 0 or 1 and also it has internal voltage reference so that u can set ur voltage as required.
In 16F877
Connect LDR to any analog channels and perform AD conversion. ADRESH and ADRESL will hav the conversion result. So for ur application check the bit 1 of ADRESH register. If it is 0 the voltage is less than 2.5V. Else voltage is greater.

Let me know the result
Thanks
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top