View previous topic :: View next topic |
Author |
Message |
tkidder
Joined: 19 Feb 2005 Posts: 11 Location: new york usa
|
18f452 low voltage interrupt |
Posted: Wed Sep 27, 2006 9:21 am |
|
|
I cant get the low voltage interrupt to work. I have a 5volt pot wiper to LVDIN pin A5. I used the wizard to make my project.
#include "C:\CCS Programs\New lowv3\lowv.h"
#include <LCD>
#int_LOWVOLT
LOWVOLT_isr()
{
printf(lcd_putc,"in int" );
}
void main()
{
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_psp(PSP_DISABLED);
setup_spi(FALSE);
setup_wdt(WDT_OFF);
setup_timer_0(RTCC_INTERNAL);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
lcd_init();
enable_interrupts(INT_LOWVOLT);
enable_interrupts(GLOBAL);
loop:
goto loop;
}
header:
#include <18F452.h>
#device adc=8
#use delay(clock=20000000)
#fuses NOWDT,WDT128,HS, NOPROTECT, NOOSCSEN, NOBROWNOUT, BORV45, NOPUT, NOSTVREN, NODEBUG, NOLVP, NOWRT, NOWRTD, NOWRTB, NOWRTC, NOCPD, NOCPB, NOEBTR, NOEBTRB |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
tkidder
Joined: 19 Feb 2005 Posts: 11 Location: new york usa
|
low voltage detect |
Posted: Wed Sep 27, 2006 11:34 am |
|
|
I tried suggested program. I get an error "setup_low_volt_detect ( )
is undefined. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Sep 27, 2006 11:56 am |
|
|
Quote: | I tried suggested program. I get an error "setup_low_volt_detect ( )
is undefined. |
What's your compiler version ? That post was made on Sept. 29, 2005
so I probably used PCH vs. 3.235 to test it.
If you have an older version, you might not have support for that
function. |
|
|
tkidder
Joined: 19 Feb 2005 Posts: 11 Location: new york usa
|
low voltage interrupt |
Posted: Tue Oct 03, 2006 11:48 am |
|
|
I bought the latest compiler. Still cant get interrupt to occur.
Used the posted program as well as wizard generated project. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Oct 03, 2006 12:35 pm |
|
|
Do you mean that bought vs. 4.011 ? That's a beta version.
Most people would say, don't use it. Go to the download page
and get vs. 3.249. Then try your program again.
http://www.ccsinfo.com/compilerupdates.php
If, after doing that, it still doesn't work for you, then I'll test it
on a PicDem2-Plus board with an 18F452 and vs. 3.249. |
|
|
tkidder
Joined: 19 Feb 2005 Posts: 11 Location: new york usa
|
low voltage interrupt |
Posted: Thu Oct 05, 2006 6:02 am |
|
|
sorry my fault. I thought the interrupt would be triggered by an external voltage on the LVDIN pin. The int is actually caused by the voltage falling on the VDD to the chip. |
|
|
|