Reply by John April 11, 20092009-04-11
On Apr 10, 10:50&#4294967295;am, "johnstokes" <rich_sedgew...@yahoo.com> wrote:
> hi > > I am using A C6711 dsp. &#4294967295;I have an interrupt that operates at 16kHz. &#4294967295;I > want to add a LCD initialisation routine onto this interrupt, since i will > only call LCD init once on power up and then not call it again. &#4294967295;I am > unsure of generating delays in the ISR though for the LCD. &#4294967295; > > The system clock is 100Mhz and the ISR is 16khz &#4294967295;So for 2 ms delay in the > ISR for the LCDinit can i just use a simple for loop for 2ms / (1/16000) = > 32 samples? > > isr() > { > &#4294967295; &#4294967295;static int LCD = 1; > &#4294967295; &#4294967295; if(LCD) > &#4294967295; &#4294967295; { > &#4294967295; &#4294967295; &#4294967295;call LCD routine once > &#4294967295; &#4294967295; &#4294967295;for(i=0;i<32;i++); //delay of 2 ms? > &#4294967295; &#4294967295; &#4294967295;writetoLCD; > > &#4294967295; &#4294967295; &#4294967295;for(i=0;i<32;i++) > &#4294967295; &#4294967295; &#4294967295;writetoLCD; > &#4294967295; &#4294967295; &#4294967295;LCD &#4294967295;= 0; > &#4294967295; &#4294967295; } > > &#4294967295; &#4294967295;//do other processing in ISR > > } > > i do not think this is correct though? as in the ISR we are still at > 100MHz? please excuse me as i do not have test hardware to check this when > my program is running in real time. > > I am sure there will be more efficient means of doing this but i would > just like to understand if i am correct? > > thanks > John
The delay of 2 msec should be realized by waiting until the ISR runs 32 more times, not by waiting 2 msec inside the ISR. John
Reply by Jerry Avins April 10, 20092009-04-10
johnstokes wrote:
> hi > > I am using A C6711 dsp. I have an interrupt that operates at 16kHz. I > want to add a LCD initialisation routine onto this interrupt, since i will > only call LCD init once on power up and then not call it again. I am > unsure of generating delays in the ISR though for the LCD. > > The system clock is 100Mhz and the ISR is 16khz So for 2 ms delay in the > ISR for the LCDinit can i just use a simple for loop for 2ms / (1/16000) = > 32 samples? > > isr() > { > static int LCD = 1; > if(LCD) > { > call LCD routine once > for(i=0;i<32;i++); //delay of 2 ms? > writetoLCD; > > for(i=0;i<32;i++) > writetoLCD; > LCD = 0; > } > > //do other processing in ISR > > } > > > i do not think this is correct though? as in the ISR we are still at > 100MHz? please excuse me as i do not have test hardware to check this when > my program is running in real time. > > I am sure there will be more efficient means of doing this but i would > just like to understand if i am correct?
Premise: You initialize the LCD only once. Premise: You initialize the LCD in the interrupt routine. Conclusion: The interrupt routine is called only once. Question: What is the interrupt routine for? Notice: Initializations are usually done without interrupts in a preamble to the main program. (That's how some interrupt registers are initialized.) Advice: When a device has a bust/~ready flag, use it instead of a timed delay. Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
Reply by johnstokes April 10, 20092009-04-10
hi

I am using A C6711 dsp.  I have an interrupt that operates at 16kHz.  I
want to add a LCD initialisation routine onto this interrupt, since i will
only call LCD init once on power up and then not call it again.  I am
unsure of generating delays in the ISR though for the LCD.  

The system clock is 100Mhz and the ISR is 16khz  So for 2 ms delay in the
ISR for the LCDinit can i just use a simple for loop for 2ms / (1/16000) =
32 samples?

isr()
{
   static int LCD = 1;
    if(LCD)
    {
     call LCD routine once 
     for(i=0;i<32;i++); //delay of 2 ms?
     writetoLCD;

     for(i=0;i<32;i++)
     writetoLCD;
     LCD  = 0;
    }

   //do other processing in ISR
  
}


i do not think this is correct though? as in the ISR we are still at
100MHz? please excuse me as i do not have test hardware to check this when
my program is running in real time.

I am sure there will be more efficient means of doing this but i would
just like to understand if i am correct?

thanks
John