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.

low battery detection

Status
Not open for further replies.

faraz101

Full Member level 1
Joined
Mar 7, 2007
Messages
96
Helped
7
Reputation
14
Reaction score
5
Trophy points
1,288
Activity points
1,872
i want to use pic16f628 in my ups project for low battery detection.i wanna use its internal comparator in ccs.please give me examples in ccs compiler or any tutorials for this.
thanx n advance
 

Hi,

Do you want to know the battery voltage or do you want to know
when the battery is low,because I have the code for if you
want to know the battery voltage.
I am using a LCD.

here is the code (in pic C).

// To read analog i/p and writes battery voltage to LCD when "reset" (inputB7) is pressed
// force ADC to 8-bit in wizard ************************* NB ! ! *******
set_adc_channel(0);
delay_ms(40);
value = read_adc();
delay_ms(20);
dec();
a1 = hund;
b = tens;
c = ones;
ASCII();
ana1 = a1;
ana2 = b;
ana3 = c;
LCD_FunctionMode();
LCD_Write_4_Bit(clear_lcd);
LCD_Write_4_Bit(0xd4); // Goto line 4 positoin 1
LCD_DataMode();
LCD_Write_4_Bit('B');
LCD_Write_4_Bit('a');
LCD_Write_4_Bit('t');
LCD_Write_4_Bit('t');
LCD_Write_4_Bit('.');
LCD_Write_4_Bit('V');
// LCD_Write_4_Bit('o');
// LCD_Write_4_Bit('l');
// LCD_Write_4_Bit('t');
LCD_Write_4_Bit('=');
// LCD_Write_4_Bit(' ');
LCD_FunctionMode();
LCD_Write_4_Bit(0xdc); // Goto line 4 positoin 7
LCD_DataMode();
LCD_Write_4_Bit(ana1);
LCD_Write_4_Bit(ana2);
LCD_Write_4_Bit(',');
LCD_Write_4_Bit(ana3);
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top