eCAP in Support package of TI C2000

조회 수: 7 (최근 30일)
Mohsin Ejaz Ahmad
Mohsin Ejaz Ahmad 2019년 5월 21일
댓글: FRANCESCO FORNASARO 2023년 8월 28일
Hello,
I am trying to use eCAP to find the time for which the input signal of 150 kHz is high and low by using eCAP block:
But the problem is I am not sure is it working or not because I have attached a scope on TS output but it is not just reading zero.
How can I see the value of counter?
Regards,
Mohsin Ejaz Ahmad

답변 (1개)

FRANCESCO FORNASARO
FRANCESCO FORNASARO 2023년 8월 25일
Dear Mohsin Ejaz Ahmad,
I'm facing the same issue, did you manage to solve it?
Kind regards,
Franceso
  댓글 수: 2
Mohsin Ejaz Ahmad
Mohsin Ejaz Ahmad 2023년 8월 28일
Dear Francesco,
I did not work further with C2000 and MATLAB. Although I did program the controller without using MATLAB and it works like that and you can see the value of the counter in the debug window of code composer studio.
Kind Regards,
Mohsin Ejaz Ahmad
FRANCESCO FORNASARO
FRANCESCO FORNASARO 2023년 8월 28일
Ok, thank you!
For anybody interested, in the end I figured it out: I was not using the interrupts properly.
In order for the eCAP module to work as intendend one has to put the eCAP module itself in a function-call subsystem. The input port of the function-call subsystem has to be connected to the output port of an "Hardware Interrupt" block, which creates an interrupt service routine (ISR) in the generated code of your model. Then, one has to set for the Harware Interrupt block the "right" interrupt in the "Hardware Mapping" section (which you can access form the "Hardware interrput" block itself) and finally make sure that, in the eCAP block's interrupt section, the same (almost the same: see the Techincal Reference Manual) above mentioned "right" intterupt is posted on the capture event you are interested in.
To make things clearer, let me make an example: if you are using the Delfino F28335, and want to use the eCAP1 module to capture only one event, you'll have to select in the eCAP1 block "post interrupt on capture event 1". Then you'll have to set in the Hardware Mapping the "ECAP1_INT" interrupt. This way the interrupt will be posted on capture event 1 (to undestand exactly which interrupt is posted read the Technical Reference Manual) and the ISR ("made of" the Hardware Interrupt and the connected function-call Subsystem togheter) will be exected over and over again, capturing whatever it is you want to capture.
Please, correct me if I made any mistake or forgot anything, I am new to the c2000 toolbox.
kind reagrds,
Francesco

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by