richardlaishram
Member level 4
- Joined
- Jan 6, 2013
- Messages
- 77
- Helped
- 6
- Reputation
- 12
- Reaction score
- 6
- Trophy points
- 1,298
- Location
- Planet Earth
- Activity points
- 1,804
I have to design a circuit which needs to automatically switch between 12V and 24V inputs, basically a battery level indicator using PIC16F716A µC. Let's say the range of 12V is 8V(Low)-14V(High) and that of 24V is 20V(Low)-26V(High). If I use a common voltage divider for both inputs with maximum output level up to 5V, I'm hoping to be able to differentiate the battery input.
Pseudocode:
Please suggest me if I can continue with this or is there any better way to acomplish this. Also If I want to add 48V input what can be done?
Thanks in advance.
Pseudocode:
Code:
if(voltage < 15)
{
display 12V battery detected && indicate battery Level
}
if(voltage < 28 && voltage > 18)
{
display 24V battery detected && indicate battery level
}
Thanks in advance.