Discussion in "ARM Development" started by    bonois_dailleurs    Aug 22, 2010.
Sun Aug 22 2010, 12:56 AM
#1
hi
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 ;
FIO2MASK = 0xFF ;
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
#2
keil follows a different coding style than ARM-GCC

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

as

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
#3
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
#4
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
#5
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
#6
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;
	InitTimer();
	while(1);
}
Tags LPC23xx timer exampleLPC2378 timer0 code example
Sat Aug 28 2010, 12:28 AM
#7
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
#8
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
#9
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
#10
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

Information

Powered by e107 Forum System

Conversation

ExperimenterUK
Thu Nov 20 2014, 06:00 PM
@Mehboob.. I don't think you can do that.
Sat Nov 15 2014, 06:41 AM
Mehboob
Pls can you send me code in c of PWM generation using UART/serial port in 8051.
Fri Nov 14 2014, 02:51 PM
mohammad aqil
NEED A BOOK ON MICROPROCESSOR AND INTERFACING BY D.V.HALL. RIGHT NOW, I SHALL BE VERY THANK FULL TO U....
Thu Nov 13 2014, 02:15 PM
m
please code hex project avr blood pressure monitor
Thu Nov 13 2014, 05:56 AM
Lambo
hi mate, whats the ajay-bhargav? tell us more pls
ExperimenterUK
Wed Nov 12 2014, 12:56 AM
@tmtm000.. have you been able to join ?
ExperimenterUK
Wed Nov 12 2014, 12:54 AM
@Alice..become a member,then send a PM to ajay_bhargav the site owner.
Tue Nov 11 2014, 03:58 AM
Abhishek Bansal
Thanks a lot for your informative tutorials!
Mon Nov 10 2014, 09:03 AM
Alice
Hello, This is Alice from a PCB rototype manufacturer. Our company is interested in your website contents, and wonder if we can advertise our company with payment on your website. There are two ways to advertise: first, if we an get a instant quote section on your main site columns; second, whether we can get a advertising section if you have any avaliable one. If any of above ways avaliable, please contact me with your detailed scheme and advertising charge. Thanks. Alice
Sat Nov 08 2014, 11:58 AM
Mohamed_123sd
Signals and Systems, 2nd Edition by Alan V. Oppenheim Alan S.willsky with S.Hamid Nawab?

Downloads

Comments

VikiPeter
Tue Nov 18 2014, 09:13 AM
gentlboy
Sun Nov 16 2014, 11:13 PM
philipeastbourne
Wed Nov 12 2014, 05:32 AM
astra91
Mon Nov 10 2014, 08:11 AM
francise
Thu Nov 06 2014, 02:55 AM
ashbir
Tue Nov 04 2014, 11:13 PM
shruthig
Tue Nov 04 2014, 10:50 AM
sk8boardboy
Mon Nov 03 2014, 11:20 AM

Online

Guests: 57, Members: 0 ...

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

Members: 37547
Newest member: VikiPeter
Forum Activity
ExperimenterUK Avatar
Posted By ExperimenterUK
Sat Nov 22 2014, 06:15 AM
@ExperimenterUKI make small table to observe Outpu...
Max.otto Avatar
Posted By Max.otto
Fri Nov 21 2014, 02:31 PM
@ExperimeterUKForgot my last question.As i told be...
Max.otto Avatar
Posted By Max.otto
Fri Nov 21 2014, 02:05 PM
@ExperimenterUKI make small table to observe Outpu...
Max.otto Avatar
Posted By Max.otto
Fri Nov 21 2014, 01:12 PM
@ExperimenterUKThank u. I do it. Ohne Period it's ...
ExperimenterUK Avatar
Posted By ExperimenterUK
Thu Nov 20 2014, 05:56 PM
You set the on/off times here as 47%float PWMcom...
vijay.parmar1992 Avatar
Posted By vijay.parmar1992
Thu Nov 20 2014, 04:06 AM
Right now i am studying Bootloader.I want to writ...
Max.otto Avatar
Posted By Max.otto
Wed Nov 19 2014, 03:11 PM
How can i get PWM on-off time..?pls check the atta...
Max.otto Avatar
Posted By Max.otto
Wed Nov 19 2014, 03:05 PM
I am using PSoC 5LP.pls check the attached design ...
ankitbajaj01 Avatar
Posted By ankitbajaj01
Wed Nov 19 2014, 01:49 PM
Thanks for the prompt response, I will try it out ...
engr1931 Avatar
Posted By engr1931
Wed Nov 19 2014, 11:45 AM
this one sir! i attached the whole project! ...