Discussion in "ARM Development" started by    bonois_dailleurs    Aug 22, 2010.
Sun Aug 22 2010, 12:56 AM
i'm performing programs for lpc2378 with arm7TDMI , and i'm using timer0 interrupt
my IDE is keil microvision4

here is my code

#include <LPC23xx.H>
#include <stdio.h>

void isr_T0()__attribute__((interrupt("irq")))
FIO2SET |= 0x3;
VICVectAddr0 = 0 ;
T0IR = 0x1 ;

void init_T0()

T0TCR = 0;
T0MR0 = 1500 ;
T0MCR = 0x3 ;
FIO2DIR = 0x3 ;
VICIntEnable = 0x00000010 ;

VICVectAddr4 = (int)isr_T0 ;

void main()
init_T0() ;
T0TCR = 0x1 ;

while(1) {}

as you can notice i'm trying to set P2.0 and P2.1 , thing that never happens while simulating
i don't know anymore about this trouble , which makes me mad because it does'nt let me step foreward
if someone knows anymore about the probleme , please answer me
Mon Aug 23 2010, 11:36 AM
keil follows a different coding style than ARM-GCC

so you have to write
void isr_T0()__attribute__((interrupt("irq")))


void isr_T0() __irq

and try again. i doubt why you did not get any error when building.
Tue Aug 24 2010, 08:56 PM
i've tried both :
void ir_T0()__irq and void isr_T0__attribute__((interrupt'"irq")))
while debugging i've ckecked up in periphrals the state of all registers ,
for every time , the case (interrupt on MR0) is ticked , and T0IR took OXO1
but the leds 'P2.0 , p2.1' are never set to 1
so i'm asking my self a lot of questions , what am i doing ????
i can't really see a true interrupt , so i can't go foreward !!!
so if you know anymore about my trouble , pleae tell me

thank you in advance
Wed Aug 25 2010, 05:03 PM
well you forgot to configure those pins as o/p

do it by setting direction on FIO2DIR.

FIO2DIR |= 0x03;
Thu Aug 26 2010, 09:59 AM
i've already set pins as output by writing : FIO2DIR = 0x3 ; or even
FIO2DIR |= 0x03 ;
still the same trouble !!!
is it because i'm using an evaluation softaware downloaded from KEIL.com ??
other request have you ever written a programme including interrupts in which you saw your routine performing what did you tell it to do ??
if yes , can you give me this exemple ??

and thank you for helping me
Thu Aug 26 2010, 06:07 PM
here is a small example for toggling P2.0

#include <LPC23xx.H>
#define INT_TMR0	4

void T0ISR() __irq {
	T0IR = 0x01;

	if(FIO2PIN & 0x01){
		FIO2CLR |= 0x1;
	} else
		FIO2SET |= 0x01;

	VICVectAddr = 0;

static void InitTimer(void){
	T0TCR = 0x02;
	T0MR0 = 0x1000;
	T0MCR = 0x03;
	VICVectAddr4 = (unsigned long)T0ISR;
	VICVectPriority4 = 0;
	VICIntEnable = 1 << INT_TMR0;

	T0TCR = 0x01;

int main (){
	FIO2DIR = 0x01;
Tags LPC23xx timer exampleLPC2378 timer0 code example
Sat Aug 28 2010, 12:28 AM
even in this exemple , it doesn'e enter the isr at all
i've tried to initialise FIO2PIN |= 0x1 but without any success
i've looked into the step by step mode when debugging
may be i could find out what's the matter
and by following the arrow which indicate which part of the program is being executed , i've seen that it didn't move to isr at all so i guessed there is a problem somewhere
here is all suppositions that i've tried :
*)enabling first and then giving the adress to the interrupt vector (VICVectAddr)
*)looping just with the function init_TIMER() , because timer initialisations don't change and all the action is performed by the isr
i mean it's enabled , setting pin , disabled (loop )
*)i've notices that the case of "interrupt on MR0" is always ticked and T0IR always takes one

for conclusion i think that my programme is not correctly built and there is some detail that i can't find out and which making me just turning around

other thing i would like to thank you for helping me !!

of course if you got a solution please tell me
Sat Aug 28 2010, 07:59 PM
The code i posted is checked and working..

if you are using a simulator you can simply put a breakpoint and see for yourself.

I am really not sure what exactly are you doing when testing the code i provided. Timer is configured for interrupt and reset on match, which is working fine.
Sat Aug 28 2010, 10:31 PM
which IDE do you use
concerning me i'm using KEIL microvision 4 "evaluation software", downloaded from keil.com
did you try your programme on your software and did it work ??

i have always LINUX ubuntu , and i know that we can work with arm-gcc
but i dont' know if we can simulate to see the result

may be i should use another IDE just to be sure that i'm not loosing my time

thank you in advance
Mon Aug 30 2010, 09:30 PM
I wrote this code for Keil uVision 4. I am attaching complete project here for your reference. check it.

also adding a screenshot from debug.

Get Social


Powered by e107 Forum System


Tue Oct 06 2015, 08:22 AM
HI you looking for ideas or you have solution
Fri Oct 02 2015, 03:39 PM
poojitha: projects on wireless communication between two microcontrollers
Thu Oct 01 2015, 04:38 PM
hey! i wanted to simulate my circit using proteus. i have a sugar cube relay in my circuit....but i dont know which one is that in the device libraries of the software. any help? thankyou.
Tue Sep 29 2015, 09:40 PM
@Michal, that rocket is too heavy for itself and trust is not enough unless afterburners are fed with fuel properly.
Sat Sep 26 2015, 08:19 PM
Hello, its possible to make a amateur rocket with this engine, or something simillar, which be able to flight?
Thu Sep 24 2015, 10:38 AM
Ir Switch sir.
Wed Sep 23 2015, 01:10 AM
@engr1931 which project ?
Tue Sep 22 2015, 11:57 AM
Hello sir, is it ok to use 12.000MHz oscillator in IRswitch, because the requirement written in the post is 11.059MHz. And i use PIC1018 as an Ir receiver
Mon Sep 21 2015, 04:15 PM
Hello sir, your blog is kind of helpful for us especially students. May I know do you have the coding for decimal to binary using proteus 8. My mini project is about to convert decimal to binary just like a calculator. The output is LCD. A bit confusing is the decimal to binary coding on proteus 8. pls help thanks.
Sun Sep 20 2015, 09:08 PM
Have you searched our Embedded GSM Development and GSM and CDMA Discussion forums ?



Tue Oct 06 2015, 01:02 PM
Fri Oct 02 2015, 03:28 PM
Sat Sep 26 2015, 01:26 AM
Fri Sep 25 2015, 10:57 AM
Wed Sep 23 2015, 08:13 PM
Wed Sep 16 2015, 04:55 AM
Mon Sep 14 2015, 03:06 PM
Fri Sep 11 2015, 06:03 AM


Guests: 32, Members: 0 ...

most ever online: 182184
(Members: , Guests: 182184) on 06 Aug 2010: 05:37 AM

Members: 37698
Newest member: praveenraoms
Forum Activity
praveenraoms Avatar
Posted By praveenraoms
Tue Oct 06 2015, 01:06 PM
hi i want to know the code to access the geographi...
sachinmm Avatar
Posted By sachinmm
Wed Sep 30 2015, 08:54 AM
how to used polling method in this?? my code is co...
ajay_bhargav Avatar
Posted By ajay_bhargav
Tue Sep 29 2015, 09:39 PM
__irq is just compiler directive to wrap IRQ routi...
ajay_bhargav Avatar
Posted By ajay_bhargav
Tue Sep 29 2015, 09:36 PM
The comment does say the time values as per the th...
ajay_bhargav Avatar
Posted By ajay_bhargav
Tue Sep 29 2015, 09:33 PM
are you testing this on Proteus? or MplabX simulat...
ajay_bhargav Avatar
Posted By ajay_bhargav
Tue Sep 29 2015, 09:31 PM
[Topic moved to ARM Development Forum]
ajay_bhargav Avatar
Posted By ajay_bhargav
Tue Sep 29 2015, 09:29 PM
start with reading datasheet. SPI interface on LPC...
ajay_bhargav Avatar
Posted By ajay_bhargav
Tue Sep 29 2015, 09:27 PM
I am not sure you've solved it or not but "USARTRe...
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Sep 29 2015, 06:31 PM
i am confused in "__irq"....how it is uesd??sachin...
sachinmm Avatar
Posted By sachinmm
Tue Sep 29 2015, 11:11 AM
my I2C.c file=>>/*********************************...