eCAP in Support package of TI C2000
7 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
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 个评论
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!