Sign in

username:

password:



Not a member?

Search motoroladsp



Search tips

Subscribe to motoroladsp



motoroladsp by Keywords

56303 | 563xx | 5680 | 56805 | 5680x | 56F80 | 56F800DEMO | 56F805 | 56f807 | 56F830 | ADC | Bootloader | Codec | CodeWarrior | CW5 | CW6 | Debugger | DSP56303 | DSP56303EVM | DSP563xx | DSP5680 | DSP56800 | DSP56807 | DSP56858 | DSP56858EVM | DSP56F803 | DSP56F805 | DSP56F807 | DSP56F80x | DSP56F826 | DSP56F827 | DSP56F8xx | EVM | FFT | Flash_over_jtag | GPIO | Interrupt | Interrupts | JTAG | LCD | Linker | MCF5307 | Metrowerks | Modulus | MSCAN | PCMaster | PWM | Quad | Rif | RTOS | SDK | SPI

Discussion Groups

Discussion Groups | Freescale DSPs | Using C-declared Variables in Assembly Code

Technical discussions about Freescale (Motorola) DSPs (including the DSP56000, DSP56300, DSP56600, 56800 DSPs).

  

Post a new Thread

Using C-declared Variables in Assembly Code - emespina - Sep 29 7:19:15 2007



Hi,

I'm currently working on a project on the 56F8013 DSP.  I have 
implemented all my codes in C to make code sharing and maintenance 
easier.

However, I would like to use Fast Interrupts and only Assemble codes 
are allowed within the ISR.  

My problem now is how to access the variables that I have declared in C 
within the ISR.  I have started to go thru the documentations to see 
how this is done.  But, any leads will be greatly appreciated!

Regards,
Evan



(You need to be a member of motoroladsp -- send a blank email to motoroladsp-subscribe@yahoogroups.com )

Re: Using C-declared Variables in Assembly Code - Charlie W - Oct 3 5:29:30 2007

You must define the variables are the globe varliables

#define	ADC_Addr 0xf080
#define PWM_Addr 0xf040

asm void ISR_ADC_End_of_Scan(void);

int gVar = 100;

void main(void)
{
  /* Write your local variable definition here */
int Var =5;
  PE_low_level_init();
	asm
	{
		move.w gVar, Y0;
		move.w Var, X0;
		move.w X0, gVar;
	}

/************************************/
/*	Initialize fast interrupt reg	*/
/************************************/

	asm (swap SHADOWS);
	asm (moveu.w #ADC_Addr,R0); //Initialize ADC address
	asm (moveu.w #(PWM_Addr+6),R1); //Initialize PWM
value reg address
	asm (moveu.w #0x0,N);
	asm (moveu.w #0xffff,M01);
	asm (swap SHADOWS);	
	
  /* Write your code here */

  for(;;) {}

}

//#pragma interrupt alignsp
//#pragma optimization_level 4
asm void ISR_Fast_ADC_End_of_Scan(void)
{
	
//	setRegBits(ADC_ADSTAT,2048);  /* Clear EOSI flag */
	
	bfset	#0x0800,X:(R0+6) /* Clear EOSI flag */

	/*Assembly Example*/
	move.w gVar, Y0;
	move.w X0, gVar;
			
	frtid					//fast interrupt return with Delay
  	move.w    x:(R1)+,y0	//update PWM0 duty cycle
  	move.w    x:(R1)-,y0	//update PWM1 duty cycle

  /* Add illegal instruction for debugging trick to
flag improper execution */
  illegal
} 
--- emespina <e...@yahoo.com> wrote:

> Hi,
> 
> I'm currently working on a project on the 56F8013
> DSP.  I have 
> implemented all my codes in C to make code sharing
> and maintenance 
> easier.
> 
> However, I would like to use Fast Interrupts and
> only Assemble codes 
> are allowed within the ISR.  
> 
> My problem now is how to access the variables that I
> have declared in C 
> within the ISR.  I have started to go thru the
> documentations to see 
> how this is done.  But, any leads will be greatly
> appreciated!
> 
> Regards,
> Evan



(You need to be a member of motoroladsp -- send a blank email to motoroladsp-subscribe@yahoogroups.com )