eCAP in Support package of TI C2000

7 visualizzazioni (ultimi 30 giorni)
Mohsin Ejaz Ahmad
Mohsin Ejaz Ahmad il 21 Mag 2019
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

Risposte (1)

FRANCESCO FORNASARO
FRANCESCO FORNASARO il 25 Ago 2023
Dear Mohsin Ejaz Ahmad,
I'm facing the same issue, did you manage to solve it?
Kind regards,
Franceso
  2 Commenti
Mohsin Ejaz Ahmad
Mohsin Ejaz Ahmad il 28 Ago 2023
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 il 28 Ago 2023
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

Accedi per commentare.

Community Treasure Hunt

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

Start Hunting!

Translated by