IMPORTANT!!! Moving (Back) to Mailing Lists

The forum site WILL BE DECOMMISSIONED by end of October. We are moving back to using mailing lists for user community, this time based on technology. More information available on
See more
See less

Wait for interrupt

  • Filter
  • Time
  • Show
Clear All
new posts

  • Wait for interrupt

    Hello, In other IDEs and sample code, I’ve come across a wait for interrupt instruction in ARM C programs. Apparently it provides some advantages over the old form of “while (1)”. I guess it may actually be an ‘assembly level macro’.

    Is there a way that it can be implemented in this IDE? Thanks for any info.

  • #2
    Hi Bruce, if you are using CMSIS (which you would be, if you are including one of the vendor supplied header files, or JSAPI, you can use the CMSIS inline function __WFI(), e.g.

    // interrupt happened, do stuff

    As you suspected, it just translates to something like asm("wfi"), but if you use the CMSIS function name, then the code will be portable to any CMSIS-compliant ARM compilers (e.g. all of them).

    Now you will need to fill out all entries for the interrupt handler to return properly. See the Help doc
    Check toward the bottom of the webhelp:

    Click image for larger version

Name:	capture.JPG
Views:	1
Size:	27.2 KB
ID:	282