Implementing infrared functions on UART0 with FRDM-KE02Z platform.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Implementing infrared functions on UART0 with FRDM-KE02Z platform.

Implementing infrared functions on UART0 with FRDM-KE02Z platform.

This document shows the implementation of the infrared on the UART0 using the FRDM-KE02Z platform.

The FRDM-KE02Z platform is a developing platform for rapid prototyping. The board has a MKE02Z64VQH2 MCU a Kinetis E series MCU which is the first 5-Volt MCU built on the ARM Cortex-M0+ core. You can check the evaluation board in the Freescale’s webpage (FRDM-KE02Z: Kinetis E Series Freedom Development Platform)

The Freedom Board has a lot of great features and one of this is an IrDA transmitter and receiver on it. Check this out!

infrared on board.png

One of the features of the MCU is that the UART0 module can implement Infrared functions just following some tricks (MCU-magic tricks). According to the Reference Manual (Document Number: MKE02Z64M20SF0RM) this tricks are:

     UART0_TX modulation:

    • UART0_TX output can be modulated by FTM0 channel 0 PWM output

     UART0_RX Tag:

    • UART0_RX input can be tagged to FTM0 channel 1 or filtered by ACMP0 module

For this example we are going to use the ACMP0 module to implement the UART0_RX functionality.

Note1: The Core is configured to run at the maximum frequency: 20 Mhz

Note2: Refer to the reference manual document for more information about the registers.


Configuring the FTM0.

The next lines show the configuration of the FTM0; the module is configured with a Frequency of 38 KHz which is the ideal frequency for an infrared led. The FTM0_CH0 is in Edge_Aligned PWM mode (EPWM).

    

     #define IR_FREQUENCY       38000 //hz

     #define FTM0_CLOCK                BUS_CLK_HZ

     #define FTM0_MOD_VALUE            FTM0_CLOCK/IR_FREQUENCY

     #define FTM0_C0V_VALUE            FTM0_MOD_VALUE/2

     void FTM0CH0_Init( void )

     {

       SIM_SCGC |= SIM_SCGC_FTM0_MASK;

            // Init FTM0 to PWM output,frequency is 38khz

       FTM0_MOD= FTM0_MOD_VALUE;

       FTM0_C0SC = 0x28;

       FTM0_C0V = FTM0_C0V_VALUE;

       FTM0_SC = 0x08; // bus clock divide by 2

     }

With this we accomplish the UART0_TX modulation through a PWM on the FTM0_CH0.

Configuring the ACMP0.

The configuration of the ACMP0 is using a DAC and allowing the ACMP0 can be driven by an analog input.

     void ACMP_Init ( void )

     {

       SIM_SCGC |= SIM_SCGC_ACMP0_MASK;

       ACMP0_C1 |= ACMP_C1_DACEN_MASK |

                  ACMP_C1_DACREF_MASK|

                  ACMP_C1_DACVAL(21);    // enable DAC

       ACMP0_C0 |= ACMP_C0_ACPSEL(0x03)|

                           ACMP_C0_ACNSEL(0x01);

       ACMP0_C2 |= ACMP_C2_ACIPE(0x02);  // enable ACMP1 connect to PIN

       ACMP0_CS |= ACMP_CS_ACE_MASK;     // enable ACMP          

     }


With this we have now implemented the UART0_RX.

   

IrDA initialization.

Now the important thing is to initialize the UART0 to work together with these tricks and implement the irDA functions.

Basically we initialize the UART0 like when we use normal serial communication (this is not the topic of this post, refer to the project to see the UART_init function) and we write to the most important registers:

  

     SIM_SOPT |= SIM_SOPT_RXDFE_MASK;

    • UART0_RX input signal is filtered by ACMP, then injected to UART0.

     SIM_SOPT |= SIM_SOPT_TXDME_MASK;

    • UART0_TX output is modulated by FTM0 channel 0 before mapped to pinout.

The configuration is as follows:

     void IrDA_Init( void )

     {

// initialize UART0, 2400 baudrate

       UART_init(UART0_BASE_PTR,BUS_CLK_HZ/1000,2400);

    

            // clear RDRF flag

       UART0_S1 |= UART_S1_RDRF_MASK;

    

            // initialize FTM0CH1 as 38k PWM output

       FTM0CH0_Init();

        

            // enable ACMP

       ACMP_Init();

SIM_SOPT |= SIM_SOPT_RXDFE_MASK;  //UART0_RX input signal is filtered by ACMP, then injected to UART0.

       UART0_S2 &= ~UART_S2_RXINV_MASK;  //inverse data input

SIM_SOPT |= SIM_SOPT_TXDME_MASK;  //UART0_TX output is modulated by FTM0 channel 0 before mapped to pinout.

     }

With the irDA initialization we got the infrared features on the UART0.

Philosophy of the Example

In the attachments of this post you can find the example which shows the use of these functions in a basic application; the project was compiled in CodeWarrior 10.6 and the philosophy is:

Slide1.JPG

I hope that the information presented on this document could be useful for you. Thank you!

Best Regards!

Attachments
Comments

Hello Sanchez,

          A good post indeed. But, I was wondering what might be the communication pattern? Is it a standard 3/16th bit width communication or the modulated Tx waveform looks different altogether? Couldn't capture on oscilloscope as the FTM is running continuously. Is the modulated waveform similar to the one attached?HT32F125x_IrDA_TimingDiagram.png

I am trying this with the TWR-K60N512 KIT, I can receive interrupts on UART0_Rx through Comparator from a TV remote signal, but not from the Tx pin although checking with a smartphone camera, the Tx IR signal is going on. The code is as follows:

#include "types.h"
#include "infrared.h"
#define IR_FREQUENCY    38000
#define FTM1_CLOCK        750000
#define FTM1_MOD_VALUE    FTM1_CLOCK/IR_FREQUENCY
#define FTM1_C0V_VALUE            FTM1_MOD_VALUE/2
void init_infrared(void){
    //initialize uart0 as infrared port through CMP0
    init_uart0();
    //initialize Comparator
    init_cmp0();
    //initialize the Flex timer
    init_ftm();
}
void init_uart(UART_MemMapPtr uartch, int sysclk, int baud){
    uint16_t ubd, temp, brfa;
   //disable Tx and Rx during setup
    UART_C2_REG(uartch) &= ~(UART_C2_TE_MASK | UART_C2_RE_MASK );
    /* Configure the UART for 8-bit mode, no parity */
    /* We need all default settings, so entire register is cleared */
    UART_C1_REG(uartch) = 0;
    /* Calculate baud settings */
    ubd = (uint16_t)((sysclk*1000)/(baud * 16));
    /* Save off the current value of the UARTx_BDH except for the SBR */
    temp = UART_BDH_REG(uartch) & ~(UART_BDH_SBR(0x1F));
    UART_BDH_REG(uartch) = temp | UART_BDH_SBR(((ubd & 0x1F00) >> 8));
    UART_BDL_REG(uartch) = (uint8_t)(ubd & UART_BDL_SBR_MASK);
    /* Determine if a fractional divider is needed to get closer to the baud rate */
    brfa = (((sysclk*32000)/(baud * 16)) - (ubd * 32));
    /* Save off the current value of the UARTx_C4 register except for the BRFA */
    temp = UART_C4_REG(uartch) & ~(UART_C4_BRFA(0x1F));
    UART_C4_REG(uartch) = temp | UART_C4_BRFA(brfa);
    // enable the reciever interrupts
    UART_C2_REG(uartch) |= UART_C2_RIE_MASK;
}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
void init_uart0(void){
    //Gate clock to uart0
      SIM_SCGC4 |= SIM_SCGC4_UART0_MASK;
    init_uart(UART0_BASE_PTR,96000,2400);//core clock is 96Mhz=96000Khz
    //enable IR encoding and decoding
    UART0_IR |= UART_IR_IREN_MASK;
    UART0_IR |= UART_IR_TNP(0x0);//narrow pulse 3/16 of baudrate
    //System integration to route UART0_RX to CMP0
    SIM_SOPT5 |= SIM_SOPT5_UART0RXSRC(01);//CMP0 as source of UART0_RX
    SIM_SOPT5 |= SIM_SOPT5_UART0TXSRC(01);//Tx pin modulated with FTM1 channel0 output
    SIM_SOPT2 |= SIM_SOPT2_CMTUARTPAD_MASK;//select dual pad drive strength for UART0_TX
    //Enable receiver and transmitter
    UART0_C2 |= UART_C2_RE_MASK;
    UART0_C2 |= UART_C2_TE_MASK;
    // configure Nested Vector Interrupt Controller: clear pending and set enable
    NVICICPR1 |= interrupt_mask(1,INT_UART0_RX_TX);
    NVICISER1 |= interrupt_mask(1,INT_UART0_RX_TX);
}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
//UART0 brief interrupt handler
void UART0_RX_TX_IRQHandler(){
    if((UART0_S1 & UART_S1_RDRF_MASK)==UART_S1_RDRF_MASK){
        byte2 = (uint8_t)UART0_D;
        data_available2=1;
    }
}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
//FTM1 initialization, used to modulate UART0_TX
void init_ftm(void){
    SIM_SCGC6 |= SIM_SCGC6_FTM1_MASK;//gate the clock
    FTM1_SC |= FTM_SC_CLKS(01);//system core clock as clock source
    FTM1_SC |= FTM_SC_PS(7);//divide system clock by 128 = 750Khz
    FTM1_MODE |= FTM_MODE_WPDIS_MASK;//disable write protect
    FTM1_MOD |= FTM_MOD_MOD(FTM1_MOD_VALUE);//modulo value
    FTM1_C0SC = 0x28;//edge-aligned PWM
    FTM1_C0V = FTM1_C0V_VALUE;
}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
void init_cmp0(void){
    //gate the clock to CMP
    SIM_SCGC4 |= SIM_SCGC4_CMP_MASK;
    //disable comparator while configuring
    CMP0_CR1 &= ~(CMP_CR1_OPE_MASK | CMP_CR1_EN_MASK);
    //Configure and enable the Comparator's DAC for reference voltage
    CMP0_DACCR |= CMP_DACCR_VRSEL_MASK;//supply voltage select is 1 for Vin2
    CMP0_DACCR |= CMP_DACCR_VOSEL(0x0F);//Output voltage select is (Vin/64)*VOSEL+1 = Vin * 0.5 for a high(1)
    CMP0_DACCR |= CMP_DACCR_DACEN_MASK;
    //enable PMUX and MMUX
    CMP0_MUXCR |= CMP_MUXCR_PEN_MASK | CMP_MUXCR_MEN_MASK;
    //select IN0 for PMUX(positive side) and DACOUT i.e channel 7 as MMUX(minus side)
    //          |\
    //    IN0---|+\
    //          |  \______CMP_OUT
    //          |  /
    // DACout---|-/
    //          |/
    //         COMPARATOR
    //
    CMP0_MUXCR |= CMP_MUXCR_PSEL(0);
    CMP0_MUXCR |= CMP_MUXCR_MSEL(7);
    //set 0 samples per measurement
    CMP0_CR0 |= CMP_CR0_FILTER_CNT(0x0);//disable filter
    CMP0_CR1 |= CMP_CR1_COS_MASK;//unfiltered output
    CMP0_CR1 |= CMP_CR1_INV_MASK;//invert output
    //enable comparator and the output pin
    CMP0_CR1 |= (CMP_CR1_OPE_MASK | CMP_CR1_EN_MASK);
}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

I think I am missing some information on how the modulation actually works. Could you please explain a little further on the actual protocol, how the timing diagrams look like, how do we demodulate, where are the UART settings for demodulation, i can see how we modulate with the FTM, but not how we are actually demodulating the received signal. Is it by sampling the CMP input?

BlackNight‌ you have any ideas?

I got it to work without FTM modulation, just with the 3/16 narrow pulse. UART0 configured with 2400 baudrate and inverted RX, CMP DAC Output voltage select is (Vin/64)*31+1 = VDD(3.3v) * 0.5 = 1.65V for a high(1), supply voltage select is 1 for Vin2 which is VDD (3.3v). The trick is to configure the Comparator properly with a good reference voltage on the inverting input. I did not configure any sampling. Next I will try with FTM modulation, only I dont know how exactly to demodulate on the comparator end using the sampling feature.

I figured out what was the problem. The TWR-K60 has a different IR receiver filter with R=1KOhm and C=0.1uF, which passes frequencies less than 1.6KHz compared to the FRDM-KE02Z which has R=1KOhm and C=1000PF, which will passes frequencies less than 160KHz, hence 38KHz is OK for that board. 38KHz wont work with TWR-K60N512 because it wiIR_connection.pngll be blocked by the filter. I set the UART0 baud lower to 1400 and the FTM1 frequency to 1.5KHz and it works like a charm! I compared the two user manuals :-)

Formula:

fc = 1/(2*pi*Τ) = 1/(2pi*RC); where R=1000Ohms, C=0.1*10^-6Farads

fc = 1.6KHz

%3CLINGO-SUB%20id%3D%22lingo-sub-1114427%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EImplementing%20infrared%20functions%20on%20UART0%20with%20FRDM-KE02Z%20platform.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1114427%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%20style%3D%22text-align%3A%20justify%3B%22%3EThis%20document%20shows%20the%20implementation%20of%20the%20infrared%20on%20the%20UART0%20using%20the%20FRDM-KE02Z%20platform.%3C%2FP%3E%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%3C%2FP%3E%3CP%20style%3D%22text-align%3A%20justify%3B%22%3EThe%20FRDM-KE02Z%20platform%20is%20a%20developing%20platform%20for%20rapid%20prototyping.%20The%20board%20has%20a%20MKE02Z64VQH2%20MCU%20a%20Kinetis%20E%20series%20MCU%20which%20is%20the%20first%205-Volt%20MCU%20built%20on%20the%20ARM%20Cortex-M0%2B%20core.%20You%20can%20check%20the%20evaluation%20board%20in%20the%20Freescale%E2%80%99s%20webpage%20(%3CA%20href%3D%22http%3A%2F%2Fwww.freescale.com%2Fwebapp%2Fsps%2Fsite%2Fprod_summary.jsp%3Fcode%3DFRDM-KE02Z%22%20title%3D%22http%3A%2F%2Fwww.freescale.com%2Fwebapp%2Fsps%2Fsite%2Fprod_summary.jsp%3Fcode%3DFRDM-KE02Z%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%20target%3D%22_blank%22%3EFRDM-KE02Z%3A%20Kinetis%20E%20Series%20Freedom%20Development%20Platform%3C%2FA%3E)%3C%2FP%3E%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%3C%2FP%3E%3CP%20style%3D%22text-align%3A%20justify%3B%22%3EThe%20Freedom%20Board%20has%20a%20lot%20of%20great%20features%20and%20one%20of%20this%20is%20an%20IrDA%20transmitter%20and%20receiver%20on%20it.%20Check%20this%20out!%3C%2FP%3E%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22infrared%20on%20board.png%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22infrared%20on%20board.png%22%20style%3D%22width%3A%20273px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F111620i2417853BE1D006D7%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22infrared%20on%20board.png%22%20alt%3D%22infrared%20on%20board.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22text-align%3A%20justify%3B%22%3EOne%20of%20the%20features%20of%20the%20MCU%20is%20that%20the%20UART0%20module%20can%20implement%20Infrared%20functions%20just%20following%20some%20tricks%20(MCU-magic%20tricks).%20According%20to%20the%20Reference%20Manual%20(Document%20Number%3A%20MKE02Z64M20SF0RM)%20this%20tricks%20are%3A%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%3CSTRONG%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20UART0_TX%20modulation%3A%3C%2FSTRONG%3E%3C%2FP%3E%3CUL%20style%3D%22list-style-type%3A%20disc%3B%22%3E%3CUL%3E%3CLI%3EUART0_TX%20output%20can%20be%20modulated%20by%20FTM0%20channel%200%20PWM%20output%3C%2FLI%3E%3C%2FUL%3E%3C%2FUL%3E%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSTRONG%3EUART0_RX%20Tag%3A%3C%2FSTRONG%3E%3C%2FP%3E%3CUL%20style%3D%22list-style-type%3A%20disc%3B%22%3E%3CUL%3E%3CLI%3EUART0_RX%20input%20can%20be%20tagged%20to%20FTM0%20channel%201%20or%20filtered%20by%20ACMP0%20module%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FLI%3E%3C%2FUL%3E%3C%2FUL%3E%3CP%20style%3D%22text-align%3A%20justify%3B%22%3EFor%20this%20example%20we%20are%20going%20to%20use%20the%20ACMP0%20module%20to%20implement%20the%20UART0_RX%20functionality.%3C%2FP%3E%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%3C%2FP%3E%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%208pt%3B%22%3E%3CEM%3ENote1%3A%20The%20Core%20is%20configured%20to%20run%20at%20the%20maximum%20frequency%3A%2020%20Mhz%3C%2FEM%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%208pt%3B%22%3E%3CEM%3ENote2%3A%20Refer%20to%20the%20reference%20manual%20document%20for%20more%20information%20about%20the%20registers.%3C%2FEM%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%208pt%3B%22%3E%3CEM%3E%3CBR%20%2F%3E%3C%2FEM%3E%3C%2FSPAN%3E%3C%2FP%3E%3CH2%20id%3D%22toc-hId--1415419786%22%20id%3D%22toc-hId--499318736%22%3EConfiguring%20the%20FTM0.%3C%2FH2%3E%3CP%20style%3D%22text-align%3A%20justify%3B%22%3EThe%20next%20lines%20show%20the%20configuration%20of%20the%20FTM0%3B%20the%20module%20is%20configured%20with%20a%20Frequency%20of%2038%20KHz%20which%20is%20the%20ideal%20frequency%20for%20an%20infrared%20led.%20The%20FTM0_CH0%20is%20in%20Edge_Aligned%20PWM%20mode%20(EPWM).%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%200.0001pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20%237f0055%3B%20font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%22%3E%3CSTRONG%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%200.0001pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20%237f0055%3B%20font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%22%3E%3CSTRONG%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%23define%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%20IR_FREQUENCY%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%2038000%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%3CSPAN%20style%3D%22text-decoration%3A%20underline%3B%22%3Ehz%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%200.0001pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20%237f0055%3B%20font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%22%3E%3CSTRONG%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%23define%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%20FTM0_CLOCK%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20BUS_CLK_HZ%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%200.0001pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20%237f0055%3B%20font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%22%3E%3CSTRONG%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%23define%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%20%3CSPAN%20style%3D%22background%3A%20silver%3B%22%3EFTM0_MOD_VALUE%3C%2FSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20FTM0_CLOCK%2FIR_FREQUENCY%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%200.0001pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20%237f0055%3B%20font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%22%3E%3CSTRONG%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%23define%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%20FTM0_C0V_VALUE%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20FTM0_MOD_VALUE%2F2%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%200.0001pt%3B%22%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%200.0001pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20%237f0055%3B%20font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%22%3E%3CSTRONG%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20void%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%20%3CSTRONG%3EFTM0CH0_Init%3C%2FSTRONG%3E(%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%237f0055%3B%20font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%22%3E%3CSTRONG%3Evoid%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%20)%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%200.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%200.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20SIM_SCGC%20%7C%3D%20SIM_SCGC_FTM0_MASK%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%200.0001pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20%3CSPAN%20style%3D%22text-decoration%3A%20underline%3B%22%3EInit%3C%2FSPAN%3E%20FTM0%20to%20PWM%20output%2Cfrequency%20is%2038khz%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%200.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20FTM0_MOD%3D%20FTM0_MOD_VALUE%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%200.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20FTM0_C0SC%20%3D%200x28%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%200.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20FTM0_C0V%20%3D%20FTM0_C0V_VALUE%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%200.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20FTM0_SC%20%3D%200x08%3B%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20bus%20clock%20divide%20by%202%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7D%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EWith%20this%20we%20accomplish%20the%20UART0_TX%20modulation%20through%20a%20PWM%20on%20the%20FTM0_CH0.%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CH2%20id%3D%22toc-hId-1072093047%22%20id%3D%22toc-hId-1988194097%22%3EConfiguring%20the%20ACMP0.%3C%2FH2%3E%3CP%3EThe%20configuration%20of%20the%20ACMP0%20is%20using%20a%20DAC%20and%20allowing%20the%20ACMP0%20can%20be%20driven%20by%20an%20analog%20input.%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%200.0001pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20%237f0055%3B%20font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%22%3E%3CSTRONG%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20void%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%20%3CSTRONG%3EACMP_Init%3C%2FSTRONG%3E%20(%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%237f0055%3B%20font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%22%3E%3CSTRONG%3Evoid%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%20)%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%200.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%200.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20SIM_SCGC%20%7C%3D%20SIM_SCGC_ACMP0_MASK%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%200.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20ACMP0_C1%20%7C%3D%20ACMP_C1_DACEN_MASK%20%7C%20%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%200.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20ACMP_C1_DACREF_MASK%7C%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%200.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20ACMP_C1_DACVAL(21)%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20enable%20DAC%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%200.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20ACMP0_C0%20%7C%3D%20ACMP_C0_ACPSEL(0x03)%7C%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%200.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20ACMP_C0_ACNSEL(0x01)%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%200.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20ACMP0_C2%20%7C%3D%20ACMP_C2_ACIPE(0x02)%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20enable%20ACMP1%20connect%20to%20PIN%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%200.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20ACMP0_CS%20%7C%3D%20ACMP_CS_ACE_MASK%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20enable%20ACMP%3C%2FSPAN%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7D%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EWith%20this%20we%20have%20now%20implemented%20the%20UART0_RX.%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%200.0001pt%3B%22%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%200.0001pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20%237f0055%3B%20font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%22%3E%3CSTRONG%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%3CH2%20id%3D%22toc-hId--735361416%22%20id%3D%22toc-hId-180739634%22%3EIrDA%20initialization.%3C%2FH2%3E%3CP%20style%3D%22text-align%3A%20justify%3B%22%3ENow%20the%20important%20thing%20is%20to%20initialize%20the%20UART0%20to%20work%20together%20with%20these%20tricks%20and%20implement%20the%20irDA%20functions.%3C%2FP%3E%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%3C%2FP%3E%3CP%20style%3D%22text-align%3A%20justify%3B%22%3EBasically%20we%20initialize%20the%20UART0%20like%20when%20we%20use%20normal%20serial%20communication%20(%3CEM%3Ethis%20is%20not%20the%20topic%20of%20this%20post%2C%20refer%20to%20the%20project%20to%20see%20the%20UART_init%20function%3C%2FEM%3E)%20and%20we%20write%20to%20the%20most%20important%20registers%3A%3C%2FP%3E%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%26nbsp%3B%20%3C%2FP%3E%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSTRONG%3ESIM_SOPT%20%7C%3D%20SIM_SOPT_RXDFE_MASK%3B%20%3C%2FSTRONG%3E%3C%2FP%3E%3CUL%20style%3D%22list-style-type%3A%20disc%3B%22%3E%3CUL%3E%3CLI%3EUART0_RX%20input%20signal%20is%20filtered%20by%20ACMP%2C%20then%20injected%20to%20UART0.%3C%2FLI%3E%3C%2FUL%3E%3C%2FUL%3E%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSTRONG%3ESIM_SOPT%20%7C%3D%20SIM_SOPT_TXDME_MASK%3B%3C%2FSTRONG%3E%3C%2FP%3E%3CUL%20style%3D%22list-style-type%3A%20disc%3B%22%3E%3CUL%3E%3CLI%3EUART0_TX%20output%20is%20modulated%20by%20FTM0%20channel%200%20before%20mapped%20to%20pinout.%3C%2FLI%3E%3C%2FUL%3E%3C%2FUL%3E%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%3C%2FP%3E%3CP%20style%3D%22text-align%3A%20justify%3B%22%3EThe%20configuration%20is%20as%20follows%3A%3C%2FP%3E%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%200.0001pt%3B%22%3E%3CSPAN%20style%3D%22color%3A%20%237f0055%3B%20font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%22%3E%3CSTRONG%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20void%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%20%3CSPAN%20style%3D%22background%3A%20silver%3B%22%3E%3CSTRONG%3EIrDA_Init%3C%2FSTRONG%3E%3C%2FSPAN%3E(%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%237f0055%3B%20font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%22%3E%3CSTRONG%3Evoid%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%20)%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%200.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%200.0001pt%3B%20text-indent%3A%200.5in%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20%3CSPAN%20style%3D%22text-decoration%3A%20underline%3B%22%3Einitialize%3C%2FSPAN%3E%20UART0%2C%202400%20baudrate%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%200.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20UART_init(UART0_BASE_PTR%2CBUS_CLK_HZ%2F1000%2C2400)%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%200.0001pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%200.0001pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20clear%20RDRF%20flag%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%200.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20UART0_S1%20%7C%3D%20UART_S1_RDRF_MASK%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%200.0001pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%200.0001pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20%3CSPAN%20style%3D%22text-decoration%3A%20underline%3B%22%3Einitialize%3C%2FSPAN%3E%20FTM0CH1%20as%2038k%20PWM%20output%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%200.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20FTM0CH0_Init()%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%200.0001pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%200.0001pt%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2F%20enable%20ACMP%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%200.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20ACMP_Init()%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%20style%3D%22margin-left%3A%203in%3B%20margin-bottom%3A%200.0001pt%3B%20text-indent%3A%20-2.5in%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3ESIM_SOPT%20%7C%3D%20SIM_SOPT_RXDFE_MASK%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2FUART0_RX%20input%20signal%20is%20filtered%20by%20ACMP%2C%20then%20injected%20to%20UART0.%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%200.0001pt%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20UART0_S2%20%26amp%3B%3D%20~UART_S2_RXINV_MASK%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2Finverse%20data%20input%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-left%3A%203in%3B%20margin-bottom%3A%200.0001pt%3B%20text-indent%3A%20-2.5in%3B%22%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3ESIM_SOPT%20%7C%3D%20SIM_SOPT_TXDME_MASK%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20%233f7f5f%3B%22%3E%2F%2FUART0_TX%20output%20is%20modulated%20by%20FTM0%20channel%200%20before%20mapped%20to%20%3CSPAN%20style%3D%22text-decoration%3A%20underline%3B%22%3Epinout%3C%2FSPAN%3E.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%20style%3D%22font-size%3A%2010.0pt%3B%20font-family%3A%20Consolas%3B%20color%3A%20black%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7D%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%3C%2FP%3E%3CP%20style%3D%22text-align%3A%20justify%3B%22%3EWith%20the%20irDA%20initialization%20we%20got%20the%20infrared%20features%20on%20the%20UART0.%3C%2FP%3E%3CP%20style%3D%22text-align%3A%20justify%3B%22%3E%3C%2FP%3E%3CH2%20id%3D%22toc-hId-1752151417%22%20id%3D%22toc-hId--1626714829%22%3EPhilosophy%20of%20the%20Example%3C%2FH2%3E%3CP%3EIn%20the%20attachments%20of%20this%20post%20you%20can%20find%20the%20example%20which%20shows%20the%20use%20of%20these%20functions%20in%20a%20basic%20application%3B%20the%20project%20was%20compiled%20in%20CodeWarrior%2010.6%20and%20the%20philosophy%20is%3A%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Slide1.JPG%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Slide1.JPG%22%20style%3D%22width%3A%20960px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F111619i864FDD6ED9ECA72D%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Slide1.JPG%22%20alt%3D%22Slide1.JPG%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%200.0001pt%3B%22%3EI%20hope%20that%20the%20information%20presented%20on%20this%20document%20could%20be%20useful%20for%20you.%20Thank%20you!%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%200.0001pt%3B%22%3E%3C%2FP%3E%3CP%20style%3D%22margin-bottom%3A%200.0001pt%3B%22%3EBest%20Regards!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1114427%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3EFreedom%20Development%20Platform%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EKinetis%20E%20Series%20MCUs%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1114431%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Implementing%20infrared%20functions%20on%20UART0%20with%20FRDM-KE02Z%20platform.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1114431%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EI%20figured%20out%20what%20was%20the%20problem.%20The%20TWR-K60%20has%20a%20different%20IR%20receiver%20filter%20with%20R%3D1KOhm%20and%20C%3D0.1uF%2C%20which%20passes%20frequencies%20less%20than%201.6KHz%20compared%20to%20the%20FRDM-KE02Z%20which%20has%20R%3D1KOhm%20and%20C%3D1000PF%2C%20which%20will%20passes%20frequencies%20less%20than%20160KHz%2C%20hence%2038KHz%20is%20OK%20for%20that%20board.%2038KHz%20wont%20work%20with%20TWR-K60N512%20because%20it%20wi%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22IR_connection.png%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22IR_connection.png%22%20style%3D%22width%3A%20961px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F5786i239E2F1A8322C8E6%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22IR_connection.png%22%20alt%3D%22IR_connection.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3Ell%20be%20blocked%20by%20the%20filter.%20I%20set%20the%20UART0%20baud%20lower%20to%201400%20and%20the%20FTM1%20frequency%20to%201.5KHz%20and%20it%20works%20like%20a%20charm!%20I%20compared%20the%20two%20user%20manuals%20%3CLI-EMOJI%20id%3D%22lia_slightly-smiling-face%22%20title%3D%22%3Aslightly_smiling_face%3A%22%3E%3C%2FLI-EMOJI%3E%3C%2FP%3E%3CP%3E%3C%2FP%3E%3CP%3EFormula%3A%3C%2FP%3E%3CP%3Efc%20%3D%201%2F(2*pi*%CE%A4)%20%3D%201%2F(2pi*RC)%3B%20where%20R%3D1000Ohms%2C%20C%3D0.1*10%5E-6Farads%3C%2FP%3E%3CP%3Efc%20%3D%201.6KHz%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1114430%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Implementing%20infrared%20functions%20on%20UART0%20with%20FRDM-KE02Z%20platform.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1114430%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EI%20got%20it%20to%20work%20without%20FTM%20modulation%2C%20just%20with%20the%203%2F16%20narrow%20pulse.%20UART0%20configured%20with%202400%20baudrate%20and%20inverted%20RX%2C%20CMP%20DAC%20Output%20voltage%20select%20is%20(Vin%2F64)*31%2B1%20%3D%20VDD(3.3v)%20*%200.5%20%3D%201.65V%20for%20a%20high(1)%2C%20supply%20voltage%20select%20is%201%20for%20Vin2%20which%20is%20VDD%20(3.3v).%20The%20trick%20is%20to%20configure%20the%20Comparator%20properly%20with%20a%20good%20reference%20voltage%20on%20the%20inverting%20input.%20I%20did%20not%20configure%20any%20sampling.%20Next%20I%20will%20try%20with%20FTM%20modulation%2C%20only%20I%20dont%20know%20how%20exactly%20to%20demodulate%20on%20the%20comparator%20end%20using%20the%20sampling%20feature.%20%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1114429%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Implementing%20infrared%20functions%20on%20UART0%20with%20FRDM-KE02Z%20platform.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1114429%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EI%20am%20trying%20this%20with%20the%20TWR-K60N512%20KIT%2C%20I%20can%20receive%20interrupts%20on%20UART0_Rx%20through%20Comparator%20from%20a%20TV%20remote%20signal%2C%20but%20not%20from%20the%20Tx%20pin%20although%20checking%20with%20a%20smartphone%20camera%2C%20the%20Tx%20IR%20signal%20is%20going%20on.%20The%20code%20is%20as%20follows%3A%3C%2FP%3E%3CPRE%20class%3D%22language-c%20line-numbers%22%3E%3CCODE%3E%3CSPAN%20class%3D%22property%20macro%20token%22%3E%23include%20%3CSPAN%20class%3D%22string%20token%22%3E%22types.h%22%3C%2FSPAN%3E%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22property%20macro%20token%22%3E%23include%20%3CSPAN%20class%3D%22string%20token%22%3E%22infrared.h%22%3C%2FSPAN%3E%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22property%20macro%20token%22%3E%23define%20IR_FREQUENCY%26nbsp%3B%26nbsp%3B%26nbsp%3B%2038000%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22property%20macro%20token%22%3E%23define%20FTM1_CLOCK%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20750000%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22property%20macro%20token%22%3E%23define%20FTM1_MOD_VALUE%26nbsp%3B%26nbsp%3B%26nbsp%3B%20FTM1_CLOCK%2FIR_FREQUENCY%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22property%20macro%20token%22%3E%23define%20FTM1_C0V_VALUE%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20FTM1_MOD_VALUE%2F2%3C%2FSPAN%3E%3CSPAN%20class%3D%22line-numbers-rows%22%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CPRE%20class%3D%22language-c%20line-numbers%22%3E%3CCODE%3E%3CSPAN%20class%3D%22keyword%20token%22%3Evoid%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22token%20function%22%3Einit_infrared%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22keyword%20token%22%3Evoid%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%7B%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2Finitialize%20uart0%20as%20infrared%20port%20through%20CMP0%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22token%20function%22%3Einit_uart0%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2Finitialize%20Comparator%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22token%20function%22%3Einit_cmp0%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2Finitialize%20the%20Flex%20timer%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22token%20function%22%3Einit_ftm%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%7D%3C%2FSPAN%3E%3CSPAN%20class%3D%22line-numbers-rows%22%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CPRE%20class%3D%22language-c%20line-numbers%22%3E%3CCODE%3E%3CSPAN%20class%3D%22keyword%20token%22%3Evoid%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22token%20function%22%3Einit_uart%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3EUART_MemMapPtr%20uartch%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22keyword%20token%22%3Eint%3C%2FSPAN%3E%20sysclk%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22keyword%20token%22%3Eint%3C%2FSPAN%3E%20baud%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%7B%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20uint16_t%20ubd%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3E%20temp%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3E%20brfa%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2Fdisable%20Tx%20and%20Rx%20during%20setup%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22token%20function%22%3EUART_C2_REG%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3Euartch%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%26amp%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E~%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3EUART_C2_TE_MASK%20%3CSPAN%20class%3D%22operator%20token%22%3E%7C%3C%2FSPAN%3E%20UART_C2_RE_MASK%20%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F*%20Configure%20the%20UART%20for%208-bit%20mode%2C%20no%20parity%20*%2F%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F*%20We%20need%20all%20default%20settings%2C%20so%20entire%20register%20is%20cleared%20*%2F%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22token%20function%22%3EUART_C1_REG%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3Euartch%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22number%20token%22%3E0%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F*%20Calculate%20baud%20settings%20*%2F%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20ubd%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3Euint16_t%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3Esysclk%3CSPAN%20class%3D%22operator%20token%22%3E*%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E1000%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22operator%20token%22%3E%2F%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3Ebaud%20%3CSPAN%20class%3D%22operator%20token%22%3E*%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22number%20token%22%3E16%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F*%20Save%20off%20the%20current%20value%20of%20the%20UARTx_BDH%20except%20for%20the%20SBR%20*%2F%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20temp%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22token%20function%22%3EUART_BDH_REG%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3Euartch%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%26amp%3B%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E~%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22token%20function%22%3EUART_BDH_SBR%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E0x1F%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22token%20function%22%3EUART_BDH_REG%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3Euartch%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20temp%20%3CSPAN%20class%3D%22operator%20token%22%3E%7C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22token%20function%22%3EUART_BDH_SBR%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3Eubd%20%3CSPAN%20class%3D%22operator%20token%22%3E%26amp%3B%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22number%20token%22%3E0x1F00%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%26gt%3B%26gt%3B%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22number%20token%22%3E8%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22token%20function%22%3EUART_BDL_REG%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3Euartch%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3Euint8_t%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3Eubd%20%3CSPAN%20class%3D%22operator%20token%22%3E%26amp%3B%3C%2FSPAN%3E%20UART_BDL_SBR_MASK%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F*%20Determine%20if%20a%20fractional%20divider%20is%20needed%20to%20get%20closer%20to%20the%20baud%20rate%20*%2F%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20brfa%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3Esysclk%3CSPAN%20class%3D%22operator%20token%22%3E*%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E32000%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22operator%20token%22%3E%2F%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3Ebaud%20%3CSPAN%20class%3D%22operator%20token%22%3E*%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22number%20token%22%3E16%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E-%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3Eubd%20%3CSPAN%20class%3D%22operator%20token%22%3E*%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22number%20token%22%3E32%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F*%20Save%20off%20the%20current%20value%20of%20the%20UARTx_C4%20register%20except%20for%20the%20BRFA%20*%2F%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20temp%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22token%20function%22%3EUART_C4_REG%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3Euartch%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%26amp%3B%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E~%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22token%20function%22%3EUART_C4_BRFA%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E0x1F%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22token%20function%22%3EUART_C4_REG%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3Euartch%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20temp%20%3CSPAN%20class%3D%22operator%20token%22%3E%7C%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22token%20function%22%3EUART_C4_BRFA%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3Ebrfa%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2F%20enable%20the%20reciever%20interrupts%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22token%20function%22%3EUART_C2_REG%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3Euartch%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E%7C%3C%2FSPAN%3E%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20UART_C2_RIE_MASK%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%7D%3C%2FSPAN%3E%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%3CSPAN%20class%3D%22line-numbers-rows%22%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CPRE%20class%3D%22language-c%20line-numbers%22%3E%3CCODE%3E%3CSPAN%20class%3D%22keyword%20token%22%3Evoid%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22token%20function%22%3Einit_uart0%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22keyword%20token%22%3Evoid%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%7B%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2FGate%20clock%20to%20uart0%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20SIM_SCGC4%20%3CSPAN%20class%3D%22operator%20token%22%3E%7C%3C%2FSPAN%3E%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20SIM_SCGC4_UART0_MASK%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22token%20function%22%3Einit_uart%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3EUART0_BASE_PTR%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E96000%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E2400%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2Fcore%20clock%20is%2096Mhz%3D96000Khz%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2Fenable%20IR%20encoding%20and%20decoding%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20UART0_IR%20%3CSPAN%20class%3D%22operator%20token%22%3E%7C%3C%2FSPAN%3E%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20UART_IR_IREN_MASK%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20UART0_IR%20%3CSPAN%20class%3D%22operator%20token%22%3E%7C%3C%2FSPAN%3E%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22token%20function%22%3EUART_IR_TNP%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E0x0%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2Fnarrow%20pulse%203%2F16%20of%20baudrate%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2FSystem%20integration%20to%20route%20UART0_RX%20to%20CMP0%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20SIM_SOPT5%20%3CSPAN%20class%3D%22operator%20token%22%3E%7C%3C%2FSPAN%3E%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22token%20function%22%3ESIM_SOPT5_UART0RXSRC%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E01%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2FCMP0%20as%20source%20of%20UART0_RX%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20SIM_SOPT5%20%3CSPAN%20class%3D%22operator%20token%22%3E%7C%3C%2FSPAN%3E%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22token%20function%22%3ESIM_SOPT5_UART0TXSRC%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E01%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2FTx%20pin%20modulated%20with%20FTM1%20channel0%20output%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20SIM_SOPT2%20%3CSPAN%20class%3D%22operator%20token%22%3E%7C%3C%2FSPAN%3E%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20SIM_SOPT2_CMTUARTPAD_MASK%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2Fselect%20dual%20pad%20drive%20strength%20for%20UART0_TX%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2FEnable%20receiver%20and%20transmitter%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20UART0_C2%20%3CSPAN%20class%3D%22operator%20token%22%3E%7C%3C%2FSPAN%3E%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20UART_C2_RE_MASK%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20UART0_C2%20%3CSPAN%20class%3D%22operator%20token%22%3E%7C%3C%2FSPAN%3E%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20UART_C2_TE_MASK%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2F%20configure%20Nested%20Vector%20Interrupt%20Controller%3A%20clear%20pending%20and%20set%20enable%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20NVICICPR1%20%3CSPAN%20class%3D%22operator%20token%22%3E%7C%3C%2FSPAN%3E%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22token%20function%22%3Einterrupt_mask%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E1%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3EINT_UART0_RX_TX%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20NVICISER1%20%3CSPAN%20class%3D%22operator%20token%22%3E%7C%3C%2FSPAN%3E%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22token%20function%22%3Einterrupt_mask%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E1%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%2C%3C%2FSPAN%3EINT_UART0_RX_TX%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%7D%3C%2FSPAN%3E%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%3CSPAN%20class%3D%22line-numbers-rows%22%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CPRE%20class%3D%22language-c%20line-numbers%22%3E%3CCODE%3E%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2FUART0%20brief%20interrupt%20handler%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22keyword%20token%22%3Evoid%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22token%20function%22%3EUART0_RX_TX_IRQHandler%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%7B%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22keyword%20token%22%3Eif%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3EUART0_S1%20%3CSPAN%20class%3D%22operator%20token%22%3E%26amp%3B%3C%2FSPAN%3E%20UART_S1_RDRF_MASK%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3D%3C%2FSPAN%3EUART_S1_RDRF_MASK%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%7B%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20byte2%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3Euint8_t%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3EUART0_D%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20data_available2%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E1%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22punctuation%20token%22%3E%7D%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%7D%3C%2FSPAN%3E%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%3CSPAN%20class%3D%22line-numbers-rows%22%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CPRE%20class%3D%22language-c%20line-numbers%22%3E%3CCODE%3E%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2FFTM1%20initialization%2C%20used%20to%20modulate%20UART0_TX%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22keyword%20token%22%3Evoid%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22token%20function%22%3Einit_ftm%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22keyword%20token%22%3Evoid%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%7B%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20SIM_SCGC6%20%3CSPAN%20class%3D%22operator%20token%22%3E%7C%3C%2FSPAN%3E%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20SIM_SCGC6_FTM1_MASK%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2Fgate%20the%20clock%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20FTM1_SC%20%3CSPAN%20class%3D%22operator%20token%22%3E%7C%3C%2FSPAN%3E%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22token%20function%22%3EFTM_SC_CLKS%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E01%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2Fsystem%20core%20clock%20as%20clock%20source%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20FTM1_SC%20%3CSPAN%20class%3D%22operator%20token%22%3E%7C%3C%2FSPAN%3E%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22token%20function%22%3EFTM_SC_PS%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E7%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2Fdivide%20system%20clock%20by%20128%20%3D%20750Khz%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20FTM1_MODE%20%3CSPAN%20class%3D%22operator%20token%22%3E%7C%3C%2FSPAN%3E%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20FTM_MODE_WPDIS_MASK%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2Fdisable%20write%20protect%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20FTM1_MOD%20%3CSPAN%20class%3D%22operator%20token%22%3E%7C%3C%2FSPAN%3E%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22token%20function%22%3EFTM_MOD_MOD%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3EFTM1_MOD_VALUE%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2Fmodulo%20value%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20FTM1_C0SC%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22number%20token%22%3E0x28%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2Fedge-aligned%20PWM%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20FTM1_C0V%20%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20FTM1_C0V_VALUE%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%7D%3C%2FSPAN%3E%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%3CSPAN%20class%3D%22line-numbers-rows%22%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CPRE%20class%3D%22language-c%20line-numbers%22%3E%3CCODE%3E%3CSPAN%20class%3D%22keyword%20token%22%3Evoid%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22token%20function%22%3Einit_cmp0%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22keyword%20token%22%3Evoid%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%7B%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2Fgate%20the%20clock%20to%20CMP%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20SIM_SCGC4%20%3CSPAN%20class%3D%22operator%20token%22%3E%7C%3C%2FSPAN%3E%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20SIM_SCGC4_CMP_MASK%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2Fdisable%20comparator%20while%20configuring%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20CMP0_CR1%20%3CSPAN%20class%3D%22operator%20token%22%3E%26amp%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22operator%20token%22%3E~%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3ECMP_CR1_OPE_MASK%20%3CSPAN%20class%3D%22operator%20token%22%3E%7C%3C%2FSPAN%3E%20CMP_CR1_EN_MASK%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2FConfigure%20and%20enable%20the%20Comparator's%20DAC%20for%20reference%20voltage%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20CMP0_DACCR%20%3CSPAN%20class%3D%22operator%20token%22%3E%7C%3C%2FSPAN%3E%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20CMP_DACCR_VRSEL_MASK%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2Fsupply%20voltage%20select%20is%201%20for%20Vin2%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20CMP0_DACCR%20%3CSPAN%20class%3D%22operator%20token%22%3E%7C%3C%2FSPAN%3E%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22token%20function%22%3ECMP_DACCR_VOSEL%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E0x0F%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2FOutput%20voltage%20select%20is%20(Vin%2F64)*VOSEL%2B1%20%3D%20Vin%20*%200.5%20for%20a%20high(1)%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20CMP0_DACCR%20%3CSPAN%20class%3D%22operator%20token%22%3E%7C%3C%2FSPAN%3E%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20CMP_DACCR_DACEN_MASK%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2Fenable%20PMUX%20and%20MMUX%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20CMP0_MUXCR%20%3CSPAN%20class%3D%22operator%20token%22%3E%7C%3C%2FSPAN%3E%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20CMP_MUXCR_PEN_MASK%20%3CSPAN%20class%3D%22operator%20token%22%3E%7C%3C%2FSPAN%3E%20CMP_MUXCR_MEN_MASK%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2Fselect%20IN0%20for%20PMUX(positive%20side)%20and%20DACOUT%20i.e%20channel%207%20as%20MMUX(minus%20side)%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2F%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C%5C%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2F%26nbsp%3B%26nbsp%3B%26nbsp%3B%20IN0---%7C%2B%5C%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2F%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C%26nbsp%3B%20%5C______CMP_OUT%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2F%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C%26nbsp%3B%20%2F%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2F%20DACout---%7C-%2F%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2F%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7C%2F%20%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2F%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20COMPARATOR%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2F%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20CMP0_MUXCR%20%3CSPAN%20class%3D%22operator%20token%22%3E%7C%3C%2FSPAN%3E%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22token%20function%22%3ECMP_MUXCR_PSEL%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E0%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20CMP0_MUXCR%20%3CSPAN%20class%3D%22operator%20token%22%3E%7C%3C%2FSPAN%3E%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22token%20function%22%3ECMP_MUXCR_MSEL%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E7%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2Fset%200%20samples%20per%20measurement%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20CMP0_CR0%20%3CSPAN%20class%3D%22operator%20token%22%3E%7C%3C%2FSPAN%3E%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22token%20function%22%3ECMP_CR0_FILTER_CNT%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3E%3CSPAN%20class%3D%22number%20token%22%3E0x0%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2Fdisable%20filter%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20CMP0_CR1%20%3CSPAN%20class%3D%22operator%20token%22%3E%7C%3C%2FSPAN%3E%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20CMP_CR1_COS_MASK%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2Funfiltered%20output%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20CMP0_CR1%20%3CSPAN%20class%3D%22operator%20token%22%3E%7C%3C%2FSPAN%3E%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20CMP_CR1_INV_MASK%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2Finvert%20output%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3CSPAN%20class%3D%22comment%20token%22%3E%2F%2Fenable%20comparator%20and%20the%20output%20pin%3C%2FSPAN%3E%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20CMP0_CR1%20%3CSPAN%20class%3D%22operator%20token%22%3E%7C%3C%2FSPAN%3E%3CSPAN%20class%3D%22operator%20token%22%3E%3D%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22punctuation%20token%22%3E(%3C%2FSPAN%3ECMP_CR1_OPE_MASK%20%3CSPAN%20class%3D%22operator%20token%22%3E%7C%3C%2FSPAN%3E%20CMP_CR1_EN_MASK%3CSPAN%20class%3D%22punctuation%20token%22%3E)%3C%2FSPAN%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%3B%3C%2FSPAN%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22punctuation%20token%22%3E%7D%3C%2FSPAN%3E%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%E2%80%8D%3CSPAN%20class%3D%22line-numbers-rows%22%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3CSPAN%3E%E2%80%8D%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%3C%2FP%3E%3CP%3EI%20think%20I%20am%20missing%20some%20information%20on%20how%20the%20modulation%20actually%20works.%20Could%20you%20please%20explain%20a%20little%20further%20on%20the%20actual%20protocol%2C%20how%20the%20timing%20diagrams%20look%20like%2C%20how%20do%20we%20demodulate%2C%20where%20are%20the%20UART%20settings%20for%20demodulation%2C%20i%20can%20see%20how%20we%20modulate%20with%20the%20FTM%2C%20but%20not%20how%20we%20are%20actually%20demodulating%20the%20received%20signal.%20Is%20it%20by%20sampling%20the%20CMP%20input%3F%3C%2FP%3E%3CP%3E%3CA%20class%3D%22jx-jive-macro-user%22%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Fpeople%2FBlackNight%22%20target%3D%22_blank%22%3EBlackNight%3C%2FA%3E%E2%80%8C%20you%20have%20any%20ideas%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1114428%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Implementing%20infrared%20functions%20on%20UART0%20with%20FRDM-KE02Z%20platform.%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1114428%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%20Sanchez%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20A%20good%20post%20indeed.%20But%2C%20I%20was%20wondering%20what%20might%20be%20the%20communication%20pattern%3F%20Is%20it%20a%20standard%203%2F16th%20bit%20width%20communication%20or%20the%20modulated%20Tx%20waveform%20looks%20different%20altogether%3F%20Couldn't%20capture%20on%20oscilloscope%20as%20the%20FTM%20is%20running%20continuously.%20Is%20the%20modulated%20waveform%20similar%20to%20the%20one%20attached%3F%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22HT32F125x_IrDA_TimingDiagram.png%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22HT32F125x_IrDA_TimingDiagram.png%22%20style%3D%22width%3A%20818px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F50596i9825ED0A8F296542%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22HT32F125x_IrDA_TimingDiagram.png%22%20alt%3D%22HT32F125x_IrDA_TimingDiagram.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
No ratings
Version history
Last update:
‎06-05-2014 02:33 PM
Updated by: