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.

RM48L952: Period Capture for more than 8 signals

Part Number: RM48L952
Other Parts Discussed in Thread: HALCOGEN

Hello,

We are trying to capture period and duty cycle for more than 8 signals. We are attempting to do this via a branch in the het1Program and change between two different signals we can look at. Is there a better way to try to go about it? 

It seems like since I have the signals physically routed to the pins, I could also set up two edge counters as well and have one of these that we currently want as a capture to be configured as below - use the rising edge counter to calculate period and the both edges to calculate duty cycle? But do we then have to use the RTI to calculate the period? It seems like the het functions (besides capGetSignal) only give you a count of how many edges it sees, not the period of the signal. 

Thanks!

hetINSTRUCTION_t het1PROGRAM[62U] =
{
    /* CNT: Timebase
    *       - Instruction                  = 0
    *       - Next instruction             = 1
    *       - Conditional next instruction = na
    *       - Interrupt                    = na
    *       - Pin                          = na
    *       - Reg                          = T
    */
    {
        /* Program */
        0x00002C80U,
        /* Control */
        0x01FFFFFFU,
        /* Data */
        0xFFFFFF80U,
        /* Reserved */
        0x00000000U
    },
    /* PWCNT: PWM 0 -> Duty Cycle
    *         - Instruction                  = 1
    *         - Next instruction             = 2
    *         - Conditional next instruction = 2
    *         - Interrupt                    = 1
    *         - Pin                          = 31
    */
    {
        /* Program */
        0x000055C0U,
        /* Control */
        (0x00004006U | (uint32)((uint32)31U << 8U) | (uint32)((uint32)2U << 3U)),
        /* Data */
        0x00000000U,
        /* Reserved */
        0x00000000U
    },
    /* DJZ: PWM 0 -> Period
    *         - Instruction                  = 2
    *         - Next instruction             = 3
    *         - Conditional next instruction = 41
    *         - Interrupt                    = 2
    *         - Pin                          = na
    */
    {
        /* Program */
        0x00007480U,
        /* Control */
        0x00052006U,
        /* Data */
        0x00000000U,
        /* Reserved */
        0x00000000U
    },
    /* PWCNT: PWM 1 -> Duty Cycle
    *         - Instruction                  = 3
    *         - Next instruction             = 4
    *         - Conditional next instruction = 4
    *         - Interrupt                    = 3
    *         - Pin                          = 9
    */
    {
        /* Program */
        0x000095C0U,
        /* Control */
        (0x00008006U | (uint32)((uint32)9U << 8U) | (uint32)((uint32)2U << 3U)),
        /* Data */
        0x00000000U,
        /* Reserved */
        0x00000000U
    },
    /* DJZ: PWM 1 -> Period
    *         - Instruction                  = 4
    *         - Next instruction             = 5
    *         - Conditional next instruction = 43
    *         - Interrupt                    = 4
    *         - Pin                          = na
    */
    {
        /* Program */
        0x0000B480U,
        /* Control */
        0x00056006U,
        /* Data */
        0x00000000U,
        /* Reserved */
        0x00000000U
    },
    /* PWCNT: PWM 2 -> Duty Cycle
    *         - Instruction                  = 5
    *         - Next instruction             = 6
    *         - Conditional next instruction = 6
    *         - Interrupt                    = 5
    *         - Pin                          = 27
    */
    {
        /* Program */
        0x0000D5C0U,
        /* Control */
        (0x0000C006U | (uint32)((uint32)27U << 8U) | (uint32)((uint32)2U << 3U)),
        /* Data */
        0x00000000U,
        /* Reserved */
        0x00000000U
    },
    /* DJZ: PWM 2 -> Period
    *         - Instruction                  = 6
    *         - Next instruction             = 7
    *         - Conditional next instruction = 45
    *         - Interrupt                    = 6
    *         - Pin                          = na
    */
    {
        /* Program */
        0x0000F480U,
        /* Control */
        0x0005A006U,
        /* Data */
        0x00000000U,
        /* Reserved */
        0x00000000U
    },
    /* PWCNT: PWM 3 -> Duty Cycle
    *         - Instruction                  = 7
    *         - Next instruction             = 8
    *         - Conditional next instruction = 8
    *         - Interrupt                    = 7
    *         - Pin                          = 29
    */
    {
        /* Program */
        0x000115C0U,
        /* Control */
        (0x00010006U | (uint32)((uint32)29U << 8U) | (uint32)((uint32)2U << 3U)),
        /* Data */
        0x00000000U,
        /* Reserved */
        0x00000000U
    },
    /* DJZ: PWM 3 -> Period
    *         - Instruction                  = 8
    *         - Next instruction             = 9
    *         - Conditional next instruction = 47
    *         - Interrupt                    = 8
    *         - Pin                          = na
    */
    {
        /* Program */
        0x00013480U,
        /* Control */
        0x0005E006U,
        /* Data */
        0x00000000U,
        /* Reserved */
        0x00000000U
    },
    /* PWCNT: PWM 4 -> Duty Cycle
    *         - Instruction                  = 9
    *         - Next instruction             = 10
    *         - Conditional next instruction = 10
    *         - Interrupt                    = 9
    *         - Pin                          = 11
    */
    {
        /* Program */
        0x000155C0U,
        /* Control */
        (0x00014006U | (uint32)((uint32)11U << 8U) | (uint32)((uint32)2U << 3U)),
        /* Data */
        0x00000000U,
        /* Reserved */
        0x00000000U
    },
    /* DJZ: PWM 4 -> Period
    *         - Instruction                  = 10
    *         - Next instruction             = 11
    *         - Conditional next instruction = 49
    *         - Interrupt                    = 10
    *         - Pin                          = na
    */
    {
        /* Program */
        0x00017480U,
        /* Control */
        0x00062006U,
        /* Data */
        0x00000000U,
        /* Reserved */
        0x00000000U
    },
    /* PWCNT: PWM 5 -> Duty Cycle
    *         - Instruction                  = 11
    *         - Next instruction             = 12
    *         - Conditional next instruction = 12
    *         - Interrupt                    = 11
    *         - Pin                          = 21
    */
    {
        /* Program */
        0x000195C0U,
        /* Control */
        (0x00018006U | (uint32)((uint32)21U << 8U) | (uint32)((uint32)0U << 3U)),
        /* Data */
        0x00000000U,
        /* Reserved */
        0x00000000U
    },
    /* DJZ: PWM 5 -> Period
    *         - Instruction                  = 12
    *         - Next instruction             = 13
    *         - Conditional next instruction = 51
    *         - Interrupt                    = 12
    *         - Pin                          = na
    */
    {
        /* Program */
        0x0001B480U,
        /* Control */
        0x00066006U,
        /* Data */
        0x00000000U,
        /* Reserved */
        0x00000000U
    },
    /* PWCNT: PWM 6 -> Duty Cycle
    *         - Instruction                  = 13
    *         - Next instruction             = 14
    *         - Conditional next instruction = 14
    *         - Interrupt                    = 13
    *         - Pin                          = 4
    */
    {
        /* Program */
        0x0001D5C0U,
        /* Control */
        (0x0001C006U | (uint32)((uint32)4U << 8U) | (uint32)((uint32)0U << 3U)),
        /* Data */
        0x00000000U,
        /* Reserved */
        0x00000000U
    },
    /* DJZ: PWM 6 -> Period
    *         - Instruction                  = 14
    *         - Next instruction             = 15
    *         - Conditional next instruction = 53
    *         - Interrupt                    = 14
    *         - Pin                          = na
    */
    {
        /* Program */
        0x0001F480U,
        /* Control */
        0x0006A006U,
        /* Data */
        0x00000000U,
        /* Reserved */
        0x00000000U
    },
    /* PWCNT: PWM 7 -> Duty Cycle
    *         - Instruction                  = 15
    *         - Next instruction             = 16
    *         - Conditional next instruction = 16
    *         - Interrupt                    = 15
    *         - Pin                          = 31
    */
    {
        /* Program */
        0x000215C0U,
        /* Control */
        (0x00020006U | (uint32)((uint32)31U << 8U) | (uint32)((uint32)0U << 3U)),
        /* Data */
        0x00000000U,
        /* Reserved */
        0x00000000U
    },
    /* DJZ: PWM 7 -> Period
    *         - Instruction                  = 16
    *         - Next instruction             = 17
    *         - Conditional next instruction = 55
    *         - Interrupt                    = 16
    *         - Pin                          = na
    */
    {
        /* Program */
        0x00023480U,
        /* Control */
        0x0006E006U,
        /* Data */
        0x00000000U,
        /* Reserved */
        0x00000000U
    },
    /* ECNT: CCU Edge 0
    *         - Instruction                  = 17
    *         - Next instruction             = 18
    *         - Conditional next instruction = 18
    *         - Interrupt                    = 17
    *         - Pin                          = 7
    */
    {
        /* Program */
        0x00025440U,
        /* Control */
        (0x00024007U | (uint32)((uint32)7U << 8U) | (uint32)((uint32)1U << 4U)),
        /* Data */
        0x00000000U,
        /* Reserved */
        0x00000000U
    },
    /* ECNT: CCU Edge 1
    *         - Instruction                  = 18
    *         - Next instruction             = 19
    *         - Conditional next instruction = 19
    *         - Interrupt                    = 18
    *         - Pin                          = 9
    */
    {
        /* Program */
        0x00027440U,
        /* Control */
        (0x00026007U | (uint32)((uint32)9U << 8U) | (uint32)((uint32)1U << 4U)),
        /* Data */
        0x00000000U,
        /* Reserved */
        0x00000000U
    },
    /* ECNT: CCU Edge 2
    *         - Instruction                  = 19
    *         - Next instruction             = 20
    *         - Conditional next instruction = 20
    *         - Interrupt                    = 19
    *         - Pin                          = 14
    */
    {
        /* Program */
        0x00029440U,
        /* Control */
        (0x00028007U | (uint32)((uint32)14U << 8U) | (uint32)((uint32)1U << 4U)),
        /* Data */
        0x00000000U,
        /* Reserved */
        0x00000000U
    },
    /* ECNT: CCU Edge 3
    *         - Instruction                  = 20
    *         - Next instruction             = 21
    *         - Conditional next instruction = 21
    *         - Interrupt                    = 20
    *         - Pin                          = 16
    */
    {
        /* Program */
        0x0002B440U,
        /* Control */
        (0x0002A007U | (uint32)((uint32)16U << 8U) | (uint32)((uint32)1U << 4U)),
        /* Data */
        0x00000000U,
        /* Reserved */
        0x00000000U
    },
    /* ECNT: CCU Edge 4
    *         - Instruction                  = 21
    *         - Next instruction             = 22
    *         - Conditional next instruction = 22
    *         - Interrupt                    = 21
    *         - Pin                          = 17
    */
    {
        /* Program */
        0x0002D440U,
        /* Control */
        (0x0002C007U | (uint32)((uint32)17U << 8U) | (uint32)((uint32)1U << 4U)),
        /* Data */
        0x00000000U,
        /* Reserved */
        0x00000000U
    },
    /* ECNT: CCU Edge 5
    *         - Instruction                  = 22
    *         - Next instruction             = 23
    *         - Conditional next instruction = 23
    *         - Interrupt                    = 22
    *         - Pin                          = 18
    */
    {
        /* Program */
        0x0002F440U,
        /* Control */
        (0x0002E007U | (uint32)((uint32)18U << 8U) | (uint32)((uint32)1U << 4U)),
        /* Data */
        0x00000000U,
        /* Reserved */
        0x00000000U
    },
    /* ECNT: CCU Edge 6
    *         - Instruction                  = 23
    *         - Next instruction             = 24
    *         - Conditional next instruction = 24
    *         - Interrupt                    = 23
    *         - Pin                          = 20
    */
    {
        /* Program */
        0x00031440U,
        /* Control */
        (0x00030007U | (uint32)((uint32)20U << 8U) | (uint32)((uint32)1U << 4U)),
        /* Data */
        0x00000000U,
        /* Reserved */
        0x00000000U
    },
    /* ECNT: CCU Edge 7
    *         - Instruction                  = 24
    *         - Next instruction             = 25
    *         - Conditional next instruction = 25
    *         - Interrupt                    = 24
    *         - Pin                          = 22
    */
    {
        /* Program */
        0x00033440U,
        /* Control */
        (0x00032007U | (uint32)((uint32)22U << 8U) | (uint32)((uint32)1U << 4U)),
        /* Data */
        0x00000000U,
        /* Reserved */
        0x00000000U
    },
    /* PCNT: Capture Duty 0
    *         - Instruction                  = 25
    *         - Next instruction             = 26
    *         - Conditional next instruction = na
    *         - Interrupt                    = na
    *         - Pin                          = 0
    */
    {
        /* Program */
        0x00034E00U | (uint32)((uint32)1U << 6U)  | (uint32)(0U),
        /* Control */
        0x00000000U,
        /* Data */
        0x00000000U,
        /* Reserved */
        0x00000000U
    },
    /* PCNT: Capture Period 0
    *         - Instruction                  = 26
    *         - Next instruction             = 27
    *         - Conditional next instruction = na
    *         - Interrupt                    = na
    *         - Pin                          = 0  + 1
    */
    {
        /* Program */
        0x00036E80U | (uint32)((uint32)1U << 6U)  | (uint32)((0U) + 1U),
        /* Control */
        0x00000000U,
        /* Data */
        0x00000000U,
        /* Reserved */
        0x00000000U
    },
    /* PCNT: Capture Duty 1
    *         - Instruction                  = 27
    *         - Next instruction             = 28
    *         - Conditional next instruction = na
    *         - Interrupt                    = na
    *         - Pin                          = 2
    */
    {
        /* Program */
        0x00038E00U | (uint32)((uint32)1U << 6U)  | (uint32)(2U),
        /* Control */
        0x00000000U,
        /* Data */
        0x00000000U,
        /* Reserved */
        0x00000000U
    },
    /* PCNT: Capture Period 1
    *         - Instruction                  = 28
    *         - Next instruction             = 29
    *         - Conditional next instruction = na
    *         - Interrupt                    = na
    *         - Pin                          = 2  + 1
    */
    {
        /* Program */
        0x0003AE80U | (uint32)((uint32)1U << 6U)  | (uint32)((2U) + 1U),
        /* Control */
        0x00000000U,
        /* Data */
        0x00000000U,
        /* Reserved */
        0x00000000U
    },
    /* PCNT: Capture Duty 2
    *         - Instruction                  = 29
    *         - Next instruction             = 30
    *         - Conditional next instruction = na
    *         - Interrupt                    = na
    *         - Pin                          = 4
    */
    {
        /* Program */
        0x0003CE00U | (uint32)((uint32)1U << 6U)  | (uint32)(4U),
        /* Control */
        0x00000000U,
        /* Data */
        0x00000000U,
        /* Reserved */
        0x00000000U
    },
    /* PCNT: Capture Period 2
    *         - Instruction                  = 30
    *         - Next instruction             = 31
    *         - Conditional next instruction = na
    *         - Interrupt                    = na
    *         - Pin                          = 4  + 1
    */
    {
        /* Program */
        0x0003EE80U | (uint32)((uint32)1U << 6U)  | (uint32)((4U) + 1U),
        /* Control */
        0x00000000U,
        /* Data */
        0x00000000U,
        /* Reserved */
        0x00000000U
    },
    /* PCNT: Capture Duty 3
    *         - Instruction                  = 31
    *         - Next instruction             = 32
    *         - Conditional next instruction = na
    *         - Interrupt                    = na
    *         - Pin                          = 6
    */
    {
        /* Program */
        0x00040E00U | (uint32)((uint32)1U << 6U)  | (uint32)(6U),
        /* Control */
        0x00000000U,
        /* Data */
        0x00000000U,
        /* Reserved */
        0x00000000U
    },
    /* Changed by NJ to go to instruction 61 */
    /* PCNT: Capture Period 3
    *         - Instruction                  = 32
    *         - Next instruction             = 33
    *         - Conditional next instruction = na
    *         - Interrupt                    = na
    *         - Pin                          = 6  + 1
    */
    {
        /* Program */ /* Next Instruction (INSTR[61]) */
        0x00000E80U | (uint32)((uint32)61U << 13U) | (uint32)((uint32)1U << 6U)  | (uint32)((6U) + 1U),
        /* Control */
        0x00000000U,
        /* Data */
        0x00000000U,
        /* Reserved */
        0x00000000U
    },
    /* PCNT: Capture Duty 4
    *         - Instruction                  = 33
    *         - Next instruction             = 34
    *         - Conditional next instruction = na
    *         - Interrupt                    = na
    *         - Pin                          = 16
    */
    {
        /* Program */
        0x00044E00U | (uint32)((uint32)1U << 6U)  | (uint32)(16U),
        /* Control */
        0x00000000U,
        /* Data */
        0x00000000U,
        /* Reserved */
        0x00000000U
    },
    /* PCNT: Capture Period 4
    *         - Instruction                  = 34
    *         - Next instruction             = 35
    *         - Conditional next instruction = na
    *         - Interrupt                    = na
    *         - Pin                          = 16  + 1
    */
    {
        /* Program */
        0x00046E80U | (uint32)((uint32)1U << 6U)  | (uint32)((16U) + 1U),
        /* Control */
        0x00000000U,
        /* Data */
        0x00000000U,
        /* Reserved */
        0x00000000U
    },
    /* PCNT: Capture Duty 5
    *         - Instruction                  = 35
    *         - Next instruction             = 36
    *         - Conditional next instruction = na
    *         - Interrupt                    = na
    *         - Pin                          = 14
    */
    {
        /* Program */
        0x00048E00U | (uint32)((uint32)1U << 6U)  | (uint32)(14U),
        /* Control */
        0x00000000U,
        /* Data */
        0x00000000U,
        /* Reserved */
        0x00000000U
    },
    /* PCNT: Capture Period 5
    *         - Instruction                  = 36
    *         - Next instruction             = 37
    *         - Conditional next instruction = na
    *         - Interrupt                    = na
    *         - Pin                          = 14  + 1
    */
    {
        /* Program */
        0x0004AE80U | (uint32)((uint32)1U << 6U)  | (uint32)((14U) + 1U),
        /* Control */
        0x00000000U,
        /* Data */
        0x00000000U,
        /* Reserved */
        0x00000000U
    },
    /* PCNT: Capture Duty 6
    *         - Instruction                  = 37
    *         - Next instruction             = 38
    *         - Conditional next instruction = na
    *         - Interrupt                    = na
    *         - Pin                          = 20
    */
    {
        /* Program */
        0x0004CE00U | (uint32)((uint32)1U << 6U)  | (uint32)(20U),
        /* Control */
        0x00000000U,
        /* Data */
        0x00000000U,
        /* Reserved */
        0x00000000U
    },
    /* PCNT: Capture Period 6
    *         - Instruction                  = 38
    *         - Next instruction             = 39
    *         - Conditional next instruction = na
    *         - Interrupt                    = na
    *         - Pin                          = 20  + 1
    */
    {
        /* Program */
        0x0004EE80U | (uint32)((uint32)1U << 6U)  | (uint32)((20U) + 1U),
        /* Control */
        0x00000000U,
        /* Data */
        0x00000000U,
        /* Reserved */
        0x00000000U
    },
    /* PCNT: Capture Duty 7
    *         - Instruction                  = 39
    *         - Next instruction             = 40
    *         - Conditional next instruction = na
    *         - Interrupt                    = na
    *         - Pin                          = 22
    */
    {
        /* Program */
        0x00050E00U | (uint32)((uint32)1U << 6U)  | (uint32)(22U),
        /* Control */
        0x00000000U,
        /* Data */
        0x00000000U,
        /* Reserved */
        0x00000000U
    },
    /* PCNT: Capture Period 7
    *         - Instruction                  = 40
    *         - Next instruction             = 57
    *         - Conditional next instruction = na
    *         - Interrupt                    = na
    *         - Pin                          = 22  + 1
    */
    {
        /* Program */
        0x00072E80U | (uint32)((uint32)1U << 6U)  | (uint32)((22U) + 1U),
        /* Control */
        0x00000000U,
        /* Data */
        0x00000000U,
        /* Reserved */
        0x00000000U
    },
    /* MOV64: PWM 0 -> Duty Cycle Update
    *         - Instruction                  = 41
    *         - Next instruction             = 42
    *         - Conditional next instruction = 2
    *         - Interrupt                    = 1
    *         - Pin                          = 31
    */
    {
        /* Program */
        0x00054201U,
        /* Control */
        (0x00004007U | (uint32)((uint32)1U << 22U) | (uint32)((uint32)31U << 8U) | (uint32)((uint32)2U << 3U)),
        /* Data */
        12928U,
        /* Reserved */
        0x00000000U
    },
    /* MOV64: PWM 0 -> Period Update
    *         - Instruction                  = 42
    *         - Next instruction             = 3
    *         - Conditional next instruction = 41
    *         - Interrupt                    = 2
    *         - Pin                          = na
    */
    {
        /* Program */
        0x00006202U,
        /* Control */
        (0x00052007U),
        /* Data */
        12672U,
        /* Reserved */
        0x00000000U
    },
    /* MOV64: PWM 1 -> Duty Cycle Update
    *         - Instruction                  = 43
    *         - Next instruction             = 44
    *         - Conditional next instruction = 4
    *         - Interrupt                    = 3
    *         - Pin                          = 9
    */
    {
        /* Program */
        0x00058203U,
        /* Control */
        (0x00008007U | (uint32)((uint32)1U << 22U) | (uint32)((uint32)9U << 8U) | (uint32)((uint32)2U << 3U)),
        /* Data */
        12928U,
        /* Reserved */
        0x00000000U
    },
    /* MOV64: PWM 1 -> Period Update
    *         - Instruction                  = 44
    *         - Next instruction             = 5
    *         - Conditional next instruction = 43
    *         - Interrupt                    = 4
    *         - Pin                          = na
    */
    {
        /* Program */
        0x0000A204U,
        /* Control */
        (0x00056007U),
        /* Data */
        12672U,
        /* Reserved */
        0x00000000U
    },
    /* MOV64: PWM 2 -> Duty Cycle Update
    *         - Instruction                  = 45
    *         - Next instruction             = 46
    *         - Conditional next instruction = 6
    *         - Interrupt                    = 5
    *         - Pin                          = 27
    */
    {
        /* Program */
        0x0005C205U,
        /* Control */
        (0x0000C007U | (uint32)((uint32)1U << 22U) | (uint32)((uint32)27U << 8U) | (uint32)((uint32)2U << 3U)),
        /* Data */
        12928U,
        /* Reserved */
        0x00000000U
    },
    /* MOV64: PWM 2 -> Period Update
    *         - Instruction                  = 46
    *         - Next instruction             = 7
    *         - Conditional next instruction = 45
    *         - Interrupt                    = 6
    *         - Pin                          = na
    */
    {
        /* Program */
        0x0000E206U,
        /* Control */
        (0x0005A007U),
        /* Data */
        12672U,
        /* Reserved */
        0x00000000U
    },
    /* MOV64: PWM 3 -> Duty Cycle Update
    *         - Instruction                  = 47
    *         - Next instruction             = 48
    *         - Conditional next instruction = 8
    *         - Interrupt                    = 7
    *         - Pin                          = 29
    */
    {
        /* Program */
        0x00060207U,
        /* Control */
        (0x00010007U | (uint32)((uint32)1U << 22U) | (uint32)((uint32)29U << 8U) | (uint32)((uint32)2U << 3U)),
        /* Data */
        12928U,
        /* Reserved */
        0x00000000U
    },
    /* MOV64: PWM 3 -> Period Update
    *         - Instruction                  = 48
    *         - Next instruction             = 9
    *         - Conditional next instruction = 47
    *         - Interrupt                    = 8
    *         - Pin                          = na
    */
    {
        /* Program */
        0x00012208U,
        /* Control */
        (0x0005E007U),
        /* Data */
        12672U,
        /* Reserved */
        0x00000000U
    },
    /* MOV64: PWM 4 -> Duty Cycle Update
    *         - Instruction                  = 49
    *         - Next instruction             = 50
    *         - Conditional next instruction = 10
    *         - Interrupt                    = 9
    *         - Pin                          = 11
    */
    {
        /* Program */
        0x00064209U,
        /* Control */
        (0x00014007U | (uint32)((uint32)1U << 22U) | (uint32)((uint32)11U << 8U) | (uint32)((uint32)2U << 3U)),
        /* Data */
        12928U,
        /* Reserved */
        0x00000000U
    },
    /* MOV64: PWM 4 -> Period Update
    *         - Instruction                  = 50
    *         - Next instruction             = 11
    *         - Conditional next instruction = 49
    *         - Interrupt                    = 10
    *         - Pin                          = na
    */
    {
        /* Program */
        0x0001620AU,
        /* Control */
        (0x00062007U),
        /* Data */
        12672U,
        /* Reserved */
        0x00000000U
    },
    /* MOV64: PWM 5 -> Duty Cycle Update
    *         - Instruction                  = 51
    *         - Next instruction             = 52
    *         - Conditional next instruction = 12
    *         - Interrupt                    = 11
    *         - Pin                          = 21
    */
    {
        /* Program */
        0x0006820BU,
        /* Control */
        (0x00018007U | (uint32)((uint32)0U << 22U) | (uint32)((uint32)21U << 8U) | (uint32)((uint32)0U << 3U)),
        /* Data */
        0U,
        /* Reserved */
        0x00000000U
    },
    /* MOV64: PWM 5 -> Period Update
    *         - Instruction                  = 52
    *         - Next instruction             = 13
    *         - Conditional next instruction = 51
    *         - Interrupt                    = 12
    *         - Pin                          = na
    */
    {
        /* Program */
        0x0001A20CU,
        /* Control */
        (0x00066007U),
        /* Data */
        3199872U,
        /* Reserved */
        0x00000000U
    },
    /* MOV64: PWM 6 -> Duty Cycle Update
    *         - Instruction                  = 53
    *         - Next instruction             = 54
    *         - Conditional next instruction = 14
    *         - Interrupt                    = 13
    *         - Pin                          = 4
    */
    {
        /* Program */
        0x0006C20DU,
        /* Control */
        (0x0001C007U | (uint32)((uint32)0U << 22U) | (uint32)((uint32)4U << 8U) | (uint32)((uint32)0U << 3U)),
        /* Data */
        0U,
        /* Reserved */
        0x00000000U
    },
    /* MOV64: PWM 6 -> Period Update
    *         - Instruction                  = 54
    *         - Next instruction             = 15
    *         - Conditional next instruction = 53
    *         - Interrupt                    = 14
    *         - Pin                          = na
    */
    {
        /* Program */
        0x0001E20EU,
        /* Control */
        (0x0006A007U),
        /* Data */
        3199872U,
        /* Reserved */
        0x00000000U
    },
    /* MOV64: PWM 7 -> Duty Cycle Update
    *         - Instruction                  = 55
    *         - Next instruction             = 56
    *         - Conditional next instruction = 16
    *         - Interrupt                    = 15
    *         - Pin                          = 31
    */
    {
        /* Program */
        0x0007020FU,
        /* Control */
        (0x00020007U | (uint32)((uint32)0U << 22U) | (uint32)((uint32)31U << 8U) | (uint32)((uint32)0U << 3U)),
        /* Data */
        0U,
        /* Reserved */
        0x00000000U
    },
    /* MOV64: PWM 7 -> Period Update
    *         - Instruction                  = 56
    *         - Next instruction             = 17
    *         - Conditional next instruction = 55
    *         - Interrupt                    = 16
    *         - Pin                          = na
    */
    {
        /* Program */
        0x00022210U,
        /* Control */
        (0x0006E007U),
        /* Data */
        3199872U,
        /* Reserved */
        0x00000000U
    },
    /* WCAP: Capture timestamp
    *         - Instruction                  = 57
    *         - Next instruction             = 0
    *         - Conditional next instruction = 0
    *         - Interrupt                    = na
    *         - Pin                          = na
    *         - Reg                          = T
    */
    {
        /* Program */
        0x00001600U,
        /* Control */
        (0x00000004U),
        /* Data */
        0x00000000U,
        /* Reserved */
        0x00000000U
    },
    /*
     *   ADD THESE LINES BACK IN WHEN READY TO SWITCH CAP PINS
     */

    /* Custom instructions to switch between cap4 pins - Need to have instruction 32 execute this instruction on conditional  */
    /*  BR: Branch
     *      - Instruction                    = 58
     *      - Next Instruction               = 33
     *      - Conditional next instruction   = 59
     *      - Condition                      = zero flag
     *      - Interrupt                      = na
     *      - Pin                            = na
     *      - Continue on to 33 unless condition satisfied
     *         (which right now is state of zero flag), then jump to 59
     */
    {
         /* Program */
         0x00001A00U | (uint32)((uint32)33U << 13U),
         /* Control                 cond. addr.                     condition      */
         (0x00000000U) | (uint32)((uint32)59U << 13U) | (uint32)((uint32)16U << 3U),
         /* Data */
         0x00000000U,
         /* Reserved */
         0x00000000U
    },
    /* PCNT: Capture Duty 4(b)
    *         - Instruction                  = 59
    *         - Next instruction             = 60
    *         - Conditional next instruction = na
    *         - Interrupt                    = na
    *         - Pin                          = 18
    */
    {
        /* Program */
        0x00078E00U | (uint32)((uint32)1U << 6U)  | (uint32)(18U),
        /* Control */
        0x00000000U,
        /* Data */
        0x00000000U,
        /* Reserved */
        0x00000000U
    },
    /* PCNT: Capture Period 4(b)
    *         - Instruction                  = 60
    *         - Next instruction             = 35
    *         - Conditional next instruction = na
    *         - Interrupt                    = na
    *         - Pin                          = 18  + 1
    */
    {
        /* Program */
        0x00046E80U | (uint32)((uint32)1U << 6U)  | (uint32)((18U) + 1U),
        /* Control */
        0x00000000U,
        /* Data */
        0x00000000U,
        /* Reserved */
        0x00000000U
    },

    /* ADD: Add value in data field [31:0] to src1 (0x00000000)
    *  NOTE: all this is really doing is setting result1[31] to one, which sets zero flag,
    *        which is our branch op (58) conditional
    *         - Instruction                  = 61
    *         - Next instruction             = 58
    *         - Conditional next instruction = na
    *         - Interrupt                    = na
    *         - Pin                          = na
    */
    {
        /* Program */
        0x00074800U,
        /* Control            sub-op code                     src1 (ZEROES)                src2 (ONES)                   dest (instr. data field)              */
        0x00000000U | (uint32)((uint32)1U << 23U) | (uint32)((uint32)0U << 19U) | (uint32)((uint32)7U << 16U) | (uint32)((uint32)1U << 7U) | (uint32)((uint32)2U << 1U),
        /* Data */
        0x00000000U,
        /* Reserved */
        0x00000000U
    }
};

  • Hello Andrew,

    The PCNT is used to capture the period and duty-cycle of the input PWM signal, so you can capture more than 8 channels by adding your own code (PCNT).

    You don't have to use the NHET code generated by HALCOGen. You can develop your won code and simulate your code using HET IDE:

    For example:

    ; Input Pulse/Period measurements with PCNT
    ; Set HRSHARE register bit 0 to measure RISE2FALL and RISE2RISE from input signal on pin 0
    ; Set HRSHARE register bit 1 to measure FALL2RISE and FALL2FALL from input signal on pin 2
    ; If HRSHARE bits are not set, then the defined pulse/period type will be measured on the
    ; 4 individual pins as defined below

    L00 PCNT { type=RISE2FALL, pin=0};
    L01 PCNT { type=RISE2RISE, pin=1};
    L02 PCNT { type=RISE2FALL, pin=2}
    L03 PCNT { type=RISE2RISE, pin=3};
    L04 PCNT { type=RISE2FALL, pin=4};
    L05 PCNT { type=RISE2RISE, pin=5};
    L06 PCNT { type=RISE2FALL, pin=6};
    L07 PCNT { type=RISE2RISE, pin=7};
    L08 PCNT { type=RISE2FALL, pin=8};
    L09 PCNT { type=RISE2RISE, pin=9};
    L10 PCNT { type=RISE2FALL, pin=10};
    L11 PCNT { type=RISE2RISE, pin=11};
    L12 PCNT { type=RISE2FALL, pin=12};
    L13 PCNT { type=RISE2RISE, pin=13};
    L14 PCNT { type=RISE2FALL, pin=14};
    L15 PCNT { type=RISE2RISE, pin=15};
    L16 PCNT { type=RISE2FALL, pin=16};
    L17 PCNT { type=RISE2RISE, pin=17};
    L18 PCNT { type=RISE2FALL, pin=18};
    L19 PCNT { type=RISE2RISE, pin=19};
    L20 PCNT { type=RISE2FALL, pin=20};
    L21 PCNT { type=RISE2RISE, pin=21};
    L22 PCNT { type=RISE2FALL, pin=22};
    L23 PCNT { type=RISE2RISE, pin=23};
    L24 PCNT { type=RISE2FALL, pin=24};
    L25 PCNT { type=RISE2RISE, pin=25};

    L26 BR { next=L00,cond_addr=L00,event=NOCOND};