Jump to content


Photo

Boostc Inline Assembly With Mplab X V3.55


2 replies to this topic

#1 futz

futz

    Newbrie

  • EstablishedMember
  • 6 posts
  • Gender:Male

Posted 27 March 2017 - 10:51 PM

Anybody have a working example of how to do inline assembly with BoostC and MPLAB X v3.55? I've tried everything in the manual, but nothing works. It just errors out with "unknown assembly identifier"s.

 

It's happy with my nop's, but complains about porta and PORTA.

 

Tried a bunch of other things - no go. Here's the last thing I tried - no go:

    asm("bsf   porta,0");
    asm("nop");
    asm("nop");
    asm("bcf   PORTA,0");
    asm("nop");
    asm("nop");
    asm("nop");
 

 

 



#2 Reynard

Reynard

    Maniac

  • EstablishedMember
  • PipPipPipPip
  • 660 posts
  • Gender:Male
  • Location:Scotland
  • Interests:Archery - target and field

Posted 28 March 2017 - 07:55 AM

Hi Futz,

 

Have you tried _porta (that is underscore porta).

 

Cheers

 

Reynard



#3 futz

futz

    Newbrie

  • EstablishedMember
  • 6 posts
  • Gender:Male

Posted 28 March 2017 - 11:49 PM

Have you tried _porta (that is underscore porta).

Yes. :D After posting my question here I continued Googling. Found it about a half hour later on someone's blog. Thanks for the help though.

 

Code looks like this now, and it works. I'm tinkering with WS2812s. Still need to put a few more things into the asm section to tighten up timing more, but it's good for now.

      asm{
        bsf _porta,0
        nop
        nop
        nop
        bcf _porta,0
      }
    }
    else{
      asm{
        bsf _porta,0
        nop
        bcf _porta,0
      }
    }
    byte <<= 1;

 





Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users