How to create new blocks (or DLL) for TMS320F28335 ?


I would like to create some new blocks for TMS320F28335 and I saw that everything is explain in Vissim 7 User Guide and that some examples are provide with Vissim 7. But there's no example for an embedded application block... So could you provide us a C code of an embedded application as the ePWM block for F280x ?



Hi Fabrice

Embedded application blocks use the same interface as in the VisSim User Guide. You want to look at the Event function. There are a number of codegen specific events that let you insert your blocks codegen text into the resulting .c file. The VisSim environment provides definitions for all the hardware registers as defined in the TI PDF files. Here is some code from the PWM block:

      pi = (C2X_BLOCK_INFO *)vissimRequest(VR_GET_BLOCK_PARAMS, blockHandle, 0);  // Get local params from block handle
      sprintf(cgBuf, "  T%dCMPR = (int)(((long)%%1*%d)>>15)"
        , pi->timerSource+1, pi->sampleRate); // VisSim expands %1 as the blocks connected to input pin 1
      return cgBuf;