This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Trap Instruction

Hello,

I am new to programming the F28027.  Can someone give me an example for setting up the user interrupt vectors and a typical trap call.  I have looked throughout the ti site but have not found any examples.

Steve Mansfield

  • Hi Steve,

    If you're new to programming the F28027, I've got to wonder why you are looking to use the software interrupts and trap.  This is far from the first thing a new user would be doing.  The software interrupts really don't buy you anything over just calling a function and turning off interrupts in the function.  TRAP was a way to do that quickly back in the day, when things ran at say 10 MHz.  Today, it is not used much.

    Look at the code examples for SPRA958:

    http://www.ti.com/mcu/docs/litabsmultiplefilelist.tsp?sectionId=96&tabId=1502&literatureNumber=spra958l&docCategoryId=1&familyId=1414

    See the code example F28027_example_nonBIOS_RAM or F28027_example_nonBIOS_Flash.  The interrupt vectors and stub ISRs are all setup, including the software interrupts.  If you want to use a TRAP from C, you'd need to use inline assembly code:

    asm(" TRAP #20");    // Vector to User interrupt #1

    Note that there is a space between the " and the TRAP.  This is required.

    Regards,

    David