I want to change the mode of rising edge to falling edge, by programming in CCSv6, but I don't know function I should use, I searched in the "help of HalcoGen" but cannot find the famous function hehe; please help!
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
I want to change the mode of rising edge to falling edge, by programming in CCSv6, but I don't know function I should use, I searched in the "help of HalcoGen" but cannot find the famous function hehe; please help!
Hi Martin,
HALCoGen does not have a function to change the trigger edge at runtime. You have to configure the trigger statically in the GUI. If you want to change the trigger level in your program, you can use the gioREG->POL register provided in HALCoGen gio.c file. You can check the TRM (Section 22.3.2)for more details.
Thanks and Regards,
Vineeth
Martin,
This is the initial register setting in gio.c to have Rising Edge on GIOA[0] (all other pins falling)
gioREG->POL = (uint32)((uint32)1U << 0U) /* Bit 0 */ | (uint32)((uint32)0U << 1U) /* Bit 1 */ | (uint32)((uint32)0U << 2U) /* Bit 2 */ | (uint32)((uint32)0U << 3U) /* Bit 3 */ | (uint32)((uint32)0U << 4U) /* Bit 4 */ | (uint32)((uint32)0U << 5U) /* Bit 5 */ | (uint32)((uint32)0U << 6U) /* Bit 6 */ | (uint32)((uint32)0U << 7U) /* Bit 7 */ | (uint32)((uint32)0U << 8U) /* Bit 8 */ | (uint32)((uint32)0U << 9U) /* Bit 9 */ | (uint32)((uint32)0U << 10U) /* Bit 10 */ | (uint32)((uint32)0U << 11U) /* Bit 11 */ | (uint32)((uint32)0U << 12U) /* Bit 12 */ | (uint32)((uint32)0U << 13U) /* Bit 13 */ | (uint32)((uint32)0U << 14U) /* Bit 14 */ | (uint32)((uint32)0U << 15U); /* Bit 15 */
This is the register setting to have Falling Edge on GIOA[0]
/** - interrupt polarity */ gioREG->POL = (uint32)((uint32)0U << 0U) /* Bit 0 */ | (uint32)((uint32)0U << 1U) /* Bit 1 */ | (uint32)((uint32)0U << 2U) /* Bit 2 */ // ...
So in your code, you will have to flip bit 0 of gioREG->POL to switch between rising and falling.
Take care that you don't overwrite any other bit when flipping Bit0.
My goal:
able to generate a control signal equal to the book to control motors and inductive loads, thanks to your help!
thanks to this I have noticed that the Hercules has great flexibility in their HET ports, surprised me with only its internal modules can generate such a signal.
Here are some pictures: