Author Topic: dsPIC - Calling asm code from C  (Read 3836 times)

0 Members and 1 Guest are viewing this topic.

Offline drZoidberg

  • Contributor
  • Posts: 21
dsPIC - Calling asm code from C
« on: June 06, 2010, 07:40:42 am »
Hi! I'm a student trying to learn digital filters, and i have a problem with c being too slow.

I use a dsPIC30F4011, and i want to use the hardware multiplier. But I dont know how to call assembler code from c.

Can someone please show me how to call asm from c?

Thanks!  :)
 

Offline migsantiago

  • Frequent Contributor
  • **
  • Posts: 381
  • Country: 00
    • MigSantiago's Web Site
Re: dsPIC - Calling asm code from C
« Reply #1 on: June 06, 2010, 09:51:03 am »
Hi

Just add the asm() tags and you're ready to go!

Code: [Select]
asm("TBLRDL [W0], W4");
 

Offline TheDirty

  • Frequent Contributor
  • **
  • Posts: 440
  • Country: ca
Re: dsPIC - Calling asm code from C
« Reply #2 on: June 06, 2010, 02:12:55 pm »
Assuming you are using the MicroChip C compiler, then read chapter 9 of the manual.

http://ww1.microchip.com/downloads/en/DeviceDoc/51284J.pdf
Mark Higgins
 

Offline drZoidberg

  • Contributor
  • Posts: 21
Re: dsPIC - Calling asm code from C
« Reply #3 on: June 06, 2010, 07:57:48 pm »
Awesome! Ch 9 was just what i was looking for! Thanks!   ;D
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf