Custom Code for eQEP in F28388D using Simulink

조회 수: 5 (최근 30일)
Roberto Aceiton
Roberto Aceiton 2020년 10월 8일
답변: Ram Alla 2020년 10월 13일
I would like to write my own C-Code to calculate the measured speed using the eQEP module within the F28388D. The block provided in the C2000 Library does not allow to interact with the UPEVNT bit). I learned that the new C Function Block (released in R2020a) would be a good alternative, however I am not sure how to acess the target's registers (e.g. QCTMRLAT or QEPSTS.UPEVNT) from my code. Is this possible? I am using R2020a and F28388D Control Card.

답변 (1개)

Ram Alla
Ram Alla 2020년 10월 13일
Hi Roberto,
The eQEP registers for F2838x are defined in the header file f2838x_eqep.h. Refer to the below mentioned path (in the installation path of your TI Control SUITE) for this header file:
C:\TI\c2000\C2000Ware_2_00_00_02\device_support\f2838x\headers\include
The registers QCTMRLAT and QEPSTS.UPEVNT for eQEP1 can be accessed as shown below:
EQep1Regs.QCTMRLAT;
EQep1Regs.QEPSTS.bit.UPEVNT;
Similarly, you can access these registers for eQEP2 or eQEP3 by replacing EQep1Regs with EQep2Regs or EQep3Regs respectively.
Hope this helps.
Best Regards,
Ram Alla.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by