AnsweredAssumed Answered

MC9S12 mode trace analyzer?

Question asked by rafaelo damiani on Jan 30, 2018
Latest reply on Feb 5, 2018 by rafaelo damiani

Hi, I need a way, to capture variables such as, cycles X ISR (TCNT) X overflows X DeltaTime (variables) X etc. For the sake of study, I want to understand the logic of functioning ...

--------------------

software
* CW 5.9
* Truetime simulator 6.1
* MCU MC9S12
* is connected with a USBBDM.

--------------------

The PCB is capturing an ISR interrupt, with a square digital signal on that port. the system works perfectly, including the code and its operation.

I just want to understand the hardware operation ... and for this I need a tool to NOT stop the time. Unfortunately breakpoint does not work for this, the most suitable would be a dataloger (trace).


code:
I need to understand the logic of this:

  
if (! (TFLG2 & 0x80) || (TCNT <TC2)) {
    
if (! ICt_overflow) // no overflow
      
dt3 = t_in3 - t_in2;
    
else {
      
dt3 = t_in3 + ((long) ICt_overflow * 43690) - t_in2;
      
ICt_overflow = 0;
    
}
} else {
dt3 = t_in3 + ((long) (ICt_overflow + 1) * 43690) - t_in2;
ICt_overflow = 0;
}

obs: a part I already understood. others only analyzing the values and comparing, and for this a datalog is fundamental.

obs II: I understand the concept of overflow, I just do not understand "(TFLG2 & 0x80) || (TCNT <TC2)"

TFLG2 & 0x80 is when an overflow occurs. in your ISR (overflow) then it is cleaned (flag). What I do not understand is when the ISR (TC2) opts for (TFLG2 & 0x80) or (! TFLG2 & 0x80)

example: if the ISR (TC2) activate at the exact moment of the overflow x0000 what would happen?

sorry for so many questions, a datalogger would help me hehehehe

Outcomes