Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

Register Log in

USE PIC16F819 comparators like lm339?

Status
Not open for further replies.

d@nny

Full Member level 5
Joined
May 28, 2011
Messages
246
Helped
11
Reputation
22
Reaction score
11
Trophy points
1,298
Activity points
3,238
Please i want some notes or tutorial which defines how to use pic16f819 comparator like lm339 to compare volatages?
 

bjuric

Advanced Member level 4
Joined
May 4, 2011
Messages
115
Helped
32
Reputation
64
Reaction score
30
Trophy points
1,308
Location
Serbia
Activity points
1,980
I can't seem to find an analog comparator on 16F819.
 

d@nny

Full Member level 5
Joined
May 28, 2011
Messages
246
Helped
11
Reputation
22
Reaction score
11
Trophy points
1,298
Activity points
3,238
u mean i cant use 16f819 comparator like lm339 to monitor battery voltages with hysteries?
 

bjuric

Advanced Member level 4
Joined
May 4, 2011
Messages
115
Helped
32
Reputation
64
Reaction score
30
Trophy points
1,308
Location
Serbia
Activity points
1,980
There is no analog comparator (like lm339 or similar) in 16F819, like on some PICs.
All you get in analog is an A/D converter, but You'd have to sample manually to get the value and determine what to do from there.

You might(?) get by if you use an input like RB0 with interrupt on falling edge, and use an resistor divider to trigger the interrupt when battery voltage falls below some value. This is highly NOT recommended, and NOT very reliable solution, but it might work. It would be better to use an schmitt input for something like that. Like RA4 or RA5 (they are Schmitt), but again You'll need to poll the pin.

The comparator You saw in datasheet is part of the CCP module. It compares binary values of Timer1 with predefined limit (so it doesn't go all the way to 0xFFFF).
Another solution would be to use said CCP module to start ADC on overflow (check “special event trigger" in datasheet). And use the ADC interrupt to check periodically.

For reliable operation, a PIC with a comparator or some external circuitry would be best solution. If not possible, I think ADC polling gives better reliability over simple resistor divider and hoping it works.
 

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top