<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How can i add a PIT or a LPTMR to this code in Processor Expert Software</title>
    <link>https://community.nxp.com/t5/Processor-Expert-Software/How-can-i-add-a-PIT-or-a-LPTMR-to-this-code/m-p/1451539#M5085</link>
    <description>&lt;P&gt;Hi, I'm trying to add a PIT or LPTMR to make my sawtooth signal 1khz (currently is less than 1hz) im working with a KL25z and dont have much experince&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;/* p7_4.c: Use DAC to generate sawtooth waveform
* The DAC is initialized with no buffer and use software trigger,
* so every write to the DAC data registers will change the
analog output.
* The loop count i is incremented by 0x0010 every loop. The
12-bit DAC
* has the range of 0-0x0FFF. Divide 0x1000 by 0x0010 yields
0x0100 or 256.
* The sawtooth has 256 steps and each step takes 1 ms. The
period of the
* waveform is 256 ms and the frequency is about 3.9 Hz.
*/


void DAC0_init(void);
void delayMs(int n);

int main (void ){
	int i;
	DAC0_init(); /*configure DAC0*/
	while(1){
		for(i=0;i&amp;lt;0x1000;i+=0x0010){
			DAC0-&amp;gt;DAT[0].DATL=i&amp;amp;0xff;  /*write low bye*/
			DAC0-&amp;gt;DAT[0].DATH=(i&amp;gt;&amp;gt;8)&amp;amp;0x0f; /*write high bye*/
			delayMs (1); /*delay 1ms*/

		}
	}
}

void DAC0_init(void){
			SIM-&amp;gt;SCGC6 |=0x80000000; /*clock to DAC module*/
			DAC0-&amp;gt;C1=0; /*disble the user of buffer*/
			DAC0-&amp;gt;C0=0X80|0X20; /*enable DAC and use software trigger*/

}
/*Delay n miliseconds
*The CPU core clock is set to MCGFLILCLH at 41.94 MHZ in SystemInit().
*/
void delayMs (int n){
	int i;
	int j;
	for(i=0; i&amp;lt;n;i++)
		for(j=0;j&amp;lt;7000;j++){}

}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 30 Apr 2022 01:41:48 GMT</pubDate>
    <dc:creator>Dom051</dc:creator>
    <dc:date>2022-04-30T01:41:48Z</dc:date>
    <item>
      <title>How can i add a PIT or a LPTMR to this code</title>
      <link>https://community.nxp.com/t5/Processor-Expert-Software/How-can-i-add-a-PIT-or-a-LPTMR-to-this-code/m-p/1451539#M5085</link>
      <description>&lt;P&gt;Hi, I'm trying to add a PIT or LPTMR to make my sawtooth signal 1khz (currently is less than 1hz) im working with a KL25z and dont have much experince&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;/* p7_4.c: Use DAC to generate sawtooth waveform
* The DAC is initialized with no buffer and use software trigger,
* so every write to the DAC data registers will change the
analog output.
* The loop count i is incremented by 0x0010 every loop. The
12-bit DAC
* has the range of 0-0x0FFF. Divide 0x1000 by 0x0010 yields
0x0100 or 256.
* The sawtooth has 256 steps and each step takes 1 ms. The
period of the
* waveform is 256 ms and the frequency is about 3.9 Hz.
*/


void DAC0_init(void);
void delayMs(int n);

int main (void ){
	int i;
	DAC0_init(); /*configure DAC0*/
	while(1){
		for(i=0;i&amp;lt;0x1000;i+=0x0010){
			DAC0-&amp;gt;DAT[0].DATL=i&amp;amp;0xff;  /*write low bye*/
			DAC0-&amp;gt;DAT[0].DATH=(i&amp;gt;&amp;gt;8)&amp;amp;0x0f; /*write high bye*/
			delayMs (1); /*delay 1ms*/

		}
	}
}

void DAC0_init(void){
			SIM-&amp;gt;SCGC6 |=0x80000000; /*clock to DAC module*/
			DAC0-&amp;gt;C1=0; /*disble the user of buffer*/
			DAC0-&amp;gt;C0=0X80|0X20; /*enable DAC and use software trigger*/

}
/*Delay n miliseconds
*The CPU core clock is set to MCGFLILCLH at 41.94 MHZ in SystemInit().
*/
void delayMs (int n){
	int i;
	int j;
	for(i=0; i&amp;lt;n;i++)
		for(j=0;j&amp;lt;7000;j++){}

}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 30 Apr 2022 01:41:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Processor-Expert-Software/How-can-i-add-a-PIT-or-a-LPTMR-to-this-code/m-p/1451539#M5085</guid>
      <dc:creator>Dom051</dc:creator>
      <dc:date>2022-04-30T01:41:48Z</dc:date>
    </item>
    <item>
      <title>Re: How can i add a PIT or a LPTMR to this code</title>
      <link>https://community.nxp.com/t5/Processor-Expert-Software/How-can-i-add-a-PIT-or-a-LPTMR-to-this-code/m-p/1452034#M5089</link>
      <description>&lt;P&gt;Hi, may be those articles can help you &lt;A href="https://os.mbed.com/media/uploads/GregC/an4470-using_low-power_modes_with_kinetis_mcus.pdf" target="_blank"&gt;https://os.mbed.com/media/uploads/GregC/an4470-using_low-power_modes_with_kinetis_mcus.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://spivey.oriel.ox.ac.uk/dswiki/images-digisys/5/56/KL25-refman.pdf," target="_blank"&gt;https://spivey.oriel.ox.ac.uk/dswiki/images-digisys/5/56/KL25-refman.pdf,&lt;/A&gt; &lt;A href="https://comm.eefocus.com/media/download/index/id-1009420" target="_blank"&gt;https://comm.eefocus.com/media/download/index/id-1009420&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have a good day&lt;/P&gt;</description>
      <pubDate>Mon, 02 May 2022 22:10:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Processor-Expert-Software/How-can-i-add-a-PIT-or-a-LPTMR-to-this-code/m-p/1452034#M5089</guid>
      <dc:creator>CarlosGarabito</dc:creator>
      <dc:date>2022-05-02T22:10:03Z</dc:date>
    </item>
  </channel>
</rss>

