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.

generating Bit pattern with TIMER/PWM

Hello,

since some days i am trying to generate a bit pattern with the TM4C123 Timer Modul:

 

PATTERN:
 8x HIGH Pulses, width is const 400us, the LOW Pulse width change between 0,8...1.5ms

This pulses repeat every 20ms.

What i tried:

Timer PWM mode--> Interrupt on the negative edge of the 400us pulse--> update TimerLoadSet and TimerMatchSet.

.....is working well if the new TimerLoad value ist not smaller than the old TimerMatch value.

My Question:

a) How i can generate bitpattern with Lm4C??

b) In oneShot Timer Mode i cannot drive  Port Pins, correct?

 

could anybody help me?

Best regards, Walter

 

 

  • Two options that i can think of.

    1) add a timer counter reset to the system you already have so that you can set the new match value smaller than the current match value.

    2) use one shot mode and manually modify the GPIO pins in the interrupt handler.

    Dexter

  • Hello Dexter,

    A) thanks for your answer:

    1) "add a timer counter reset to the system you already have so that you can set the new match value smaller than the current match value."

    [Walter]: Where you would place this reset?

    After an timer reload and after an match event  i cannot reset the counter, or!?!


    B)

    I choosed the BITS: TBMRSU and TBILD so, that the new MATCH and LOAD Register values are correct  activ when the timer is reloaded.

    In this case i dont understand, why the old Match/Load register values are relevant

    With the debugger all register values and  timing is correct, but the CCP Pin is after the ISR immediately high if the new load value is smaller than the old match value.

    maybe i make an mistake, but for me looks this like an bug


    C) Workaround:  I inverted the CCP_PIN, now its working correct because now ist the 400us impuls at the end of the periode and i dont have do change the match register.


    nevertheless i want know why the other version is not OK

    best regards

    Walter