RE: Re: ISR Function
"Dobbin Allan-r11834" <[email protected]>
| Newsgroups | gmane.comp.hardware.motorola.microcontrollers |
|---|---|
| Message-ID | <4147ED8B92A864498825C07E53594E4AD48848@az33exm20.fsl.freescale.net> |
Set your PIT to interrupt every 100ms. From within the PIT ISR, simply call DAC ( ). No need to pass the parameters x and y since they are global variables. If they are not global, make them global. If DAC function and main will both modify x or y, you have to protect them within main whilst modifying i.e. temporary disable PIT interrupt whilst modifying. -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Rajesh Sent: Thursday, June 29, 2006 11:40 PM To: [email protected] Subject: [MPC500] Re: ISR Function Hi, I think I was unable to put my question. Sorry for that, here it is: My code is like this: main() { function1(); // this will execute and output of this function is x,y //which are global variables. } Now my DAC(x,y) function will take this x,y as input.I am trying to execute this DAC(x,y) function at every 100 milisec, nomatter where I am in the main loop at that time. I am using COdeWarrior Compiler 8.1. -regards Rajesh --- In [email protected] <mailto:MPC500%40yahoogroups.com> , "Dobbin Allan-r11834" <Allan.Dobbin@...> wrote: > > Rajesh, perhaps I don't understand your question - do you have PIT > working and interrupting, but you just don't know how to call a C > function from assembler? > > Most compilers allow you to specify a function is an interrupt function, > i.e. with Diab compiler you can do the following: > > INTERRUPT void external_interrupt (void) > { > " > " > PitIsr (); /* handle PIT interrupt */ > } > > so in your vector area, you have > .org base_add + 0x500 ;External Interrupt Exception > b external_interrupt > > So now calling your DAC function within PitIsr is just like any other C > code i.e. DAC(x,y); > > The question of where do x,y come from within an ISR - perhaps these are > global variables? > > I'm not sure if this is what you were asking. > > - Allan > > > > > -----Original Message----- > From: [email protected] <mailto:MPC500%40yahoogroups.com> [mailto:[email protected] <mailto:MPC500%40yahoogroups.com> ] On > Behalf Of Rajesh > Sent: Thursday, June 29, 2006 4:21 AM > To: [email protected] <mailto:MPC500%40yahoogroups.com> > Subject: [MPC500] ISR Function > > > > > Hi everyone, > I am working with MPC566 and I have a function DAC(x,y), > i.e. a D/A converter function, which I want to execute on > Interrupt > at every 100 ms. > I am using a PIT and can set time between 64 msecs to 4.19 secs. > Can anyone please tell me how to call this function in an ISR? > > -regards > Rajesh > > > > > > > > [Non-text portions of this message have been removed] > [Non-text portions of this message have been removed] ------------------------ Yahoo! Groups Sponsor --------------------~--> Great things are happening at Yahoo! Groups. See the new email design. http://us.click.yahoo.com/TISQkA/hOaOAA/yQLSAA/dN_tlB/TM --------------------------------------------------------------------~-> ----------------------------------------------------------- To learn more about Freescale Microcontrollers, please visit http://www.freescale.com/mcu Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/MPC500/ <*> To unsubscribe from this group, send an email to: [email protected] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/