EmbeddedRelated.com
Forums

alex i donot want u learn me programing i jstt need for this program

Started by preethamreddy1989 October 5, 2012
alex i donot want u learn me programing i jstt need for this program becoz i m new to real time clock programing and i didnot use interrupt handling programs in the past i used 8051 and now i want to learn arm i have start automatic meter reading project with lpc2148
and keiluvision
#include

__isr void RTC_isr(void)
{
/* write code here */
if(ILR&0x01)
{
IOSET1=0xf0000000;
IOCLR1=0xf0000000;
}
if(ILR&0x03)
{
IOSET1=0x0f000000;
}
/* list of all available flags, select which to use */
ILR = (1UL<<0); /* Clear RTC counter increment interrupt flag */
ILR = (1UL<<1); /* Clear RTC alarm interrupt flag */
VICVectAddr = 0; /* Acknowledge Interrupt */
}

/* Default Interrupt Function: may be called when ISR is disabled */
void DefISR (void) {
}

int main()
{
VPBDIV=0x02;
IODIR1 = 0xFFFF0000;
// Set LED ports to output
IOSET1 = 0x00020000;
PREINT = 0x00000392;
// Set RTC prescaler for 12.000Mhz Xtal
PREFRAC = 0x00004380;
CCR = 0x01;
SEC = 0;
MIN = 0;
HOUR= 0;
CIIR = 0x02;
MAMCR=0x02;
MAMTIM=0x04;

ALSEC=0x03;
AMR=0x0FE;
ILR=0x01; // Interupt every second

VICVectAddr1 = (unsigned ) RTC_isr; /* set interrupt vector 1 */
VICVectCntl1 = ( 0x20 | 13 ); /* enable slot & use it for RTC Interrupt */
VICIntEnable |= (1UL<<13); /* Enable RTC Interrupt */

VICDefVectAddr = (unsigned ) DefISR; /* un-assigned VIC interrupts */

while(1)
{

}
}
the error i m getting are
Build target 'Target 1'
compiling rtcex1.c...
rtcex1.c(3): error: #77-D: this declaration has no storage class or type specifier
rtcex1.c(3): error: #65: expected a ";"
rtcex1.c(47): warning: #12-D: parsing restarts here after previous syntax error
rtcex1.c(48): error: #40: expected an identifier
rtcex1.c(48): error: #18: expected a ")"
rtcex1.c(48): error: #65: expected a ";"
rtcex1.c(50): error: #40: expected an identifier
rtcex1.c(50): error: #18: expected a ")"
rtcex1.c(50): error: #20: identifier "DefISR" is undefined
rtcex1.c(52): error: #169: expected a declaration
rtcex1.c(57): warning: At end of source: #12-D: parsing restarts here after previous syntax error
Target not created

An Engineer's Guide to the LPC2100 Series

alex i donot want u learn me programing i jstt need for this program becoz i m new to real time clock programing and i didnot use interrupt handling programs in the past i used 8051 and now i want to learn arm i have start automatic meter reading project with lpc2148
and keiluvision
#include

__isr void RTC_isr(void)
{
/* write code here */
if(ILR&0x01)
{
IOSET1=0xf0000000;
IOCLR1=0xf0000000;
}
if(ILR&0x03)
{
IOSET1=0x0f000000;
}
/* list of all available flags, select which to use */
ILR = (1UL<<0); /* Clear RTC counter increment interrupt flag */
ILR = (1UL<<1); /* Clear RTC alarm interrupt flag */
VICVectAddr = 0; /* Acknowledge Interrupt */
}

/* Default Interrupt Function: may be called when ISR is disabled */
void DefISR (void) {
}

int main()
{
VPBDIV=0x02;
IODIR1 = 0xFFFF0000;
// Set LED ports to output
IOSET1 = 0x00020000;
PREINT = 0x00000392;
// Set RTC prescaler for 12.000Mhz Xtal
PREFRAC = 0x00004380;
CCR = 0x01;
SEC = 0;
MIN = 0;
HOUR= 0;
CIIR = 0x02;
MAMCR=0x02;
MAMTIM=0x04;

ALSEC=0x03;
AMR=0x0FE;
ILR=0x01; // Interupt every second

VICVectAddr1 = (unsigned ) RTC_isr; /* set interrupt vector 1 */
VICVectCntl1 = ( 0x20 | 13 ); /* enable slot & use it for RTC Interrupt */
VICIntEnable |= (1UL<<13); /* Enable RTC Interrupt */

VICDefVectAddr = (unsigned ) DefISR; /* un-assigned VIC interrupts */

while(1)
{
}
}

the error i m getting are

Build target 'Target 1'
compiling rtcex1.c...
rtcex1.c(3): error: #77-D: this declaration has no storage class or type specifier
rtcex1.c(3): error: #65: expected a ";"
rtcex1.c(47): warning: #12-D: parsing restarts here after previous syntax error
rtcex1.c(48): error: #40: expected an identifier
rtcex1.c(48): error: #18: expected a ")"
rtcex1.c(48): error: #65: expected a ";"
rtcex1.c(50): error: #40: expected an identifier
rtcex1.c(50): error: #18: expected a ")"
rtcex1.c(50): error: #20: identifier "DefISR" is undefined
rtcex1.c(52): error: #169: expected a declaration
rtcex1.c(57): warning: At end of source: #12-D: parsing restarts here after previous syntax error
Target not created

On 5/10/2012 23:17, preethamreddy1989 wrote:
> #include __isr void RTC_isr(void)
> {
> /* write code here */
> if(ILR&0x01)
> {
> IOSET1=0xf0000000;
> IOCLR1=0xf0000000;
> }
> if(ILR&0x03)
> {
> IOSET1=0x0f000000;
> }
> /* list of all available flags, select which to use */
> ILR = (1UL<<0); /* Clear RTC counter increment interrupt flag */
> ILR = (1UL<<1); /* Clear RTC alarm interrupt flag */
> VICVectAddr = 0; /* Acknowledge Interrupt */
> }
>
> /* Default Interrupt Function: may be called when ISR is disabled */
> void DefISR (void) {
> }
>
> int main()
> {
> VPBDIV=0x02;
> IODIR1 = 0xFFFF0000;
> // Set LED ports to output
> IOSET1 = 0x00020000;
> PREINT = 0x00000392;
> // Set RTC prescaler for 12.000Mhz Xtal
> PREFRAC = 0x00004380;
> CCR = 0x01;
> SEC = 0;
> MIN = 0;
> HOUR= 0;
> CIIR = 0x02;
> MAMCR=0x02;
> MAMTIM=0x04;
>
> ALSEC=0x03;
> AMR=0x0FE;
> ILR=0x01; // Interupt every second
>
> VICVectAddr1 = (unsigned ) RTC_isr; /* set interrupt vector 1 */
> VICVectCntl1 = ( 0x20 | 13 ); /* enable slot & use it for RTC Interrupt */
> VICIntEnable |= (1UL<<13); /* Enable RTC Interrupt */
>
> VICDefVectAddr = (unsigned ) DefISR; /* un-assigned VIC interrupts */
>
> while(1)
> {
> }
> }
Judging from your code you have used ARMwizard which did much of the needed work for you, I wonder why you have replaced the
correct header for LPC2148 which is #include with the header for another mcu.
I also wonder why you have decided to remove the __irq prefix (I wrongly wrote __isr in the previous email) from the interrupt
function initializations of the generated code.

If you fix these then your code will work fine

Also decide the interrupt event that you are interested in , in your original code you had CIIR set for seconds and in this code
it is set for minutes.

--
Alex
---------------------
http://alexan.edaboard.eu/ (Home of ARMwizard, a free tool for peripheral initialization of LPC2xxx/17xx/13xx/11xx/122x microcontrollers )

I think your post is quite rude. You are obviously have no idea of what you are doing, and still shouting at people who help you that you don't need him to teach you how to program.

If you don't know how to ask nicely, or even care enough to giving people what they need to solve your problem, don't expect too much in this forum (or even in the real life).

Your C compiler is complaining about symbols that it cannot understand, and it just showed you where exactly is that symbol. Your job is to make your compiler understand what kind of symbol is that.

-daniel
----- Original Message -----
From: preethamreddy1989
To: l...
Cc:
Sent: Saturday, October 6, 2012 4:24 AM
Subject: [lpc2000] alex i donot want u learn me programing i jstt need for this program

alex i donot want u learn me programing i jstt need for this program becoz i m new to real time clock programing and i didnot use interrupt handling programs in the past i used 8051 and now i want to learn arm i have start automatic meter reading project with lpc2148
and keiluvision
#include

__isr void RTC_isr(void)
{
/* write code here */
if(ILR&0x01)
{
IOSET1=0xf0000000;
IOCLR1=0xf0000000;
}
if(ILR&0x03)
{
IOSET1=0x0f000000;
}
/* list of all available flags, select which to use */
ILR = (1UL<<0); /* Clear RTC counter increment interrupt flag */
ILR = (1UL<<1); /* Clear RTC alarm interrupt flag */
VICVectAddr = 0; /* Acknowledge Interrupt */
}

/* Default Interrupt Function: may be called when ISR is disabled */
void DefISR (void) {
}

int main()
{
VPBDIV=0x02;
IODIR1 = 0xFFFF0000;
// Set LED ports to output
IOSET1 = 0x00020000;
PREINT = 0x00000392;
// Set RTC prescaler for 12.000Mhz Xtal
PREFRAC = 0x00004380;
CCR = 0x01;
SEC = 0;
MIN = 0;
HOUR= 0;
CIIR = 0x02;
MAMCR=0x02;
MAMTIM=0x04;

ALSEC=0x03;
AMR=0x0FE;
ILR=0x01; // Interupt every second

VICVectAddr1 = (unsigned ) RTC_isr; /* set interrupt vector 1 */
VICVectCntl1 = ( 0x20 | 13 ); /* enable slot & use it for RTC Interrupt */
VICIntEnable |= (1UL<<13); /* Enable RTC Interrupt */

VICDefVectAddr = (unsigned ) DefISR; /* un-assigned VIC interrupts */

while(1)
{
}
}

the error i m getting are

Build target 'Target 1'
compiling rtcex1.c...
rtcex1.c(3): error: #77-D: this declaration has no storage class or type specifier
rtcex1.c(3): error: #65: expected a ";"
rtcex1.c(47): warning: #12-D: parsing restarts here after previous syntax error
rtcex1.c(48): error: #40: expected an identifier
rtcex1.c(48): error: #18: expected a ")"
rtcex1.c(48): error: #65: expected a ";"
rtcex1.c(50): error: #40: expected an identifier
rtcex1.c(50): error: #18: expected a ")"
rtcex1.c(50): error: #20: identifier "DefISR" is undefined
rtcex1.c(52): error: #169: expected a declaration
rtcex1.c(57): warning: At end of source: #12-D: parsing restarts here after previous syntax error
Target not created
--- In l..., Alexan_e wrote:
>
> On 5/10/2012 23:17, preethamreddy1989 wrote:
> > #include
> >
> > __isr void RTC_isr(void)
> > {
> > /* write code here */
> > if(ILR&0x01)
> > {
> > IOSET1=0xf0000000;
> > IOCLR1=0xf0000000;
> > }
> > if(ILR&0x03)
> > {
> > IOSET1=0x0f000000;
> > }
> > /* list of all available flags, select which to use */
> > ILR = (1UL<<0); /* Clear RTC counter increment interrupt flag */
> > ILR = (1UL<<1); /* Clear RTC alarm interrupt flag */
> > VICVectAddr = 0; /* Acknowledge Interrupt */
> > }
> >
> > /* Default Interrupt Function: may be called when ISR is disabled */
> > void DefISR (void) {
> > }
> >
> > int main()
> > {
> > VPBDIV=0x02;
> > IODIR1 = 0xFFFF0000;
> > // Set LED ports to output
> > IOSET1 = 0x00020000;
> > PREINT = 0x00000392;
> > // Set RTC prescaler for 12.000Mhz Xtal
> > PREFRAC = 0x00004380;
> > CCR = 0x01;
> > SEC = 0;
> > MIN = 0;
> > HOUR= 0;
> > CIIR = 0x02;
> > MAMCR=0x02;
> > MAMTIM=0x04;
> >
> > ALSEC=0x03;
> > AMR=0x0FE;
> > ILR=0x01; // Interupt every second
> >
> > VICVectAddr1 = (unsigned ) RTC_isr; /* set interrupt vector 1 */
> > VICVectCntl1 = ( 0x20 | 13 ); /* enable slot & use it for RTC Interrupt */
> > VICIntEnable |= (1UL<<13); /* Enable RTC Interrupt */
> >
> > VICDefVectAddr = (unsigned ) DefISR; /* un-assigned VIC interrupts */
> >
> > while(1)
> > {
> >
> >
> > }
> > }
> Judging from your code you have used ARMwizard which did much of the needed work for you, I wonder why you have replaced the
> correct header for LPC2148 which is #include with the header for another mcu.
> I also wonder why you have decided to remove the __irq prefix (I wrongly wrote __isr in the previous email) from the interrupt
> function initializations of the generated code.
>
> If you fix these then your code will work fine
>
> Also decide the interrupt event that you are interested in , in your original code you had CIIR set for seconds and in this code
> it is set for minutes.
>
> --
> Alex
> ---------------------
> http://alexan.edaboard.eu/ (Home of ARMwizard, a free tool for peripheral initialization of LPC2xxx/17xx/13xx/11xx/122x microcontrollers )
>
k i m unable check how the interrupt is generated i cannot find the ports bits setting and clearing i m using peripherals to check the output is there any other way to check the output

On 10/06/2012 08:00 AM, preethamreddy1989 wrote:
> k i m unable check how the interrupt is generated i cannot find the
> ports bits setting and clearing i m using peripherals to check the
> output is there any other way to check the output

I'm not sure what you refer to, do you use a software simulator, a
hardware debugger or the hardware is normal operation (no debug)?

The outputs can be checked with a debugger, voltmeter, logic analyzer,
oscilloscope etc
The registers related to the pin operation are described in the user
manual section 8.4, have you read it?

I would also suggest a read in the Hitex guides
http://www.hitex.com/index.php?id=download-insiders-guides , *The
Insider's Guide**To The NXP LPC2000 **Based Microcontrollers***

--
Alex
---------------------
http://alexan.edaboard.eu/ (Home of ARMwizard, a free tool for peripheral initialization of LPC2xxx/17xx/13xx/11xx microcontrollers )

--- In l..., Alexan_e wrote:
>
> On 10/06/2012 08:00 AM, preethamreddy1989 wrote:
> >
> >
> > k i m unable check how the interrupt is generated i cannot find the
> > ports bits setting and clearing i m using peripherals to check the
> > output is there any other way to check the output
> >
> > I'm not sure what you refer to, do you use a software simulator, a
> hardware debugger or the hardware is normal operation (no debug)?
>
> The outputs can be checked with a debugger, voltmeter, logic analyzer,
> oscilloscope etc
> The registers related to the pin operation are described in the user
> manual section 8.4, have you read it?
>
> I would also suggest a read in the Hitex guides
> http://www.hitex.com/index.php?id=download-insiders-guides , *The
> Insider's Guide**To The NXP LPC2000 **Based Microcontrollers***
>
> --
> Alex
> ---------------------
> http://alexan.edaboard.eu/ (Home of ARMwizard, a free tool for peripheral initialization of LPC2xxx/17xx/13xx/11xx microcontrollers )
>

how check with logic analyzer and debugger

On 6/10/2012 20:15, preethamreddy1989 wrote:
>
> --- In l... , Alexan_e wrote:
> >
> > On 10/06/2012 08:00 AM, preethamreddy1989 wrote:
> > >
> > >
> > > k i m unable check how the interrupt is generated i cannot find the
> > > ports bits setting and clearing i m using peripherals to check the
> > > output is there any other way to check the output
> > >
> > >
> >
> > I'm not sure what you refer to, do you use a software simulator, a
> > hardware debugger or the hardware is normal operation (no debug)?
> >
> > The outputs can be checked with a debugger, voltmeter, logic analyzer,
> > oscilloscope etc
> > The registers related to the pin operation are described in the user
> > manual section 8.4, have you read it?
> >
> > I would also suggest a read in the Hitex guides
> > http://www.hitex.com/index.php?id=download-insiders-guides , *The
> > Insider's Guide**To The NXP LPC2000 **Based Microcontrollers***
> >
> > --
> > Alex
> > ---------------------
> > http://alexan.edaboard.eu/ (Home of ARMwizard, a free tool for peripheral initialization of LPC2xxx/17xx/13xx/11xx
> microcontrollers )
> > how check with logic analyzer and debugger

If you own a logic analyzer then you should read its manual to learn how to use it, I don't think this forum can help you with that.
Also for the debugger you should read the uVision manual, start with http://www.keil.com/uvision/debug.asp

--
Alex
---------------------
http://alexan.edaboard.eu/ (Home of ARMwizard, a free tool for peripheral initialization of LPC2xxx/17xx/13xx/11xx/122x microcontrollers )



__irq void RTC_isr(void)
{
/* write code here */
if(ILR&0x01)
{
IOSET1=0xf0000000;
wait();
IOCLR1=0xf0000000;
ILR=0x00000001;
}
if(ILR&0x03)
{
IOSET1=0x0f000000;
ILR=0x00000003;
}
/* list of all available flags, select which to use */
ILR = (1UL<<0); /* Clear RTC counter increment interrupt flag */
ILR = (1UL<<1); /* Clear RTC alarm interrupt flag */
VICVectAddr = 0; /* Acknowledge Interrupt */
}

after debugging the program and start running the program
the above program will be Unexecuted lines (instructions) are marked with a grey block.

> > >
> > > I'm not sure what you refer to, do you use a software simulator, a
> > > hardware debugger or the hardware is normal operation (no debug)?
> > >
> > > The outputs can be checked with a debugger, voltmeter, logic analyzer,
> > > oscilloscope etc
> > > The registers related to the pin operation are described in the user
> > > manual section 8.4, have you read it?
> > >
> > > I would also suggest a read in the Hitex guides
> > > http://www.hitex.com/index.php?id=download-insiders-guides , *The
> > > Insider's Guide**To The NXP LPC2000 **Based Microcontrollers***
> > >
> > > --
> > > Alex
> > > ---------------------
> > > http://alexan.edaboard.eu/ (Home of ARMwizard, a free tool for peripheral initialization of LPC2xxx/17xx/13xx/11xx
> > microcontrollers )
> > >
> >
> > how check with logic analyzer and debugger
> >
> > If you own a logic analyzer then you should read its manual to learn how to use it, I don't think this forum can help you with that.
> Also for the debugger you should read the uVision manual, start with http://www.keil.com/uvision/debug.asp
>
> --
> Alex
> ---------------------
> http://alexan.edaboard.eu/ (Home of ARMwizard, a free tool for peripheral initialization of LPC2xxx/17xx/13xx/11xx/122x microcontrollers )
>
>
>

On Sun, 2012-10-07 at 07:42 +0000, preethamreddy1989 wrote:
> if(ILR&0x03)
> {
> IOSET1=0x0f000000;
> ILR=0x00000003;
> }

You still got the 0x03 value, any reason for that ?
In the first if() you check for bit0 to be set and if so
you clear it. The second if() also checks for bit0 AND bit1
to be set but at this check bit0 will not be set because you
cleared it in the previous if() statement.

Further, the ioset and ioclr and the wait() in between ????
If you are just using the io line to check for interrupt
activity you might be better of using a semaphore and toggle
the io line every time the isr is entered.
> after debugging the program and start running the program
> the above program will be Unexecuted lines (instructions)
> are marked with a grey block.

Fortunally (!) html is not allowed on this forum.
So please mark your non executed code with comments and delete
all the text you are not responding to.

roelof

ps. please do NOT change the topic (subject line) if you are
not creating an all new topic.