Implementing PWM on LPC18xx

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Implementing PWM on LPC18xx

2,933 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Sarvani A on Tue Apr 07 09:56:59 MST 2015
Hello,

Iam working on LPC18xx.
LPC1857 has one PWM with three channels.Iam implementing three different operations on three different channels with different frequencies. Iam using the api's of the example code periph_sct_pwm which is attached below. I can able to program the PWM and generate a square wave but the problem is that all the channels are resulting in a common output frequency irrespective of their individual frequency.

Can anyone help me in solving this


Looking forward for the reply

Thank you
Sarvani

Original Attachment has been moved to: periph_sct_pwm.rar

标签 (1)
0 项奖励
回复
12 回复数

2,621 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Sarvani A on Tue Apr 14 08:50:50 MST 2015
Hello,

Based on the above links information i have programed the SCTimer in  split mode. But still iam getting common frequecy irrespective of individual frequencies.


Is it really possible to generate two independent frequencies using SCTimer in Split mode?

Please post some sample codes of SCTimer in split mode


Thank you

0 项奖励
回复

2,621 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mc on Mon Apr 13 06:44:35 MST 2015
Hello Sarvani,
Please read Coockbook examples at
http://www.nxp.com/documents/application_note/AN11538.zip

It is linked at below SCTimer/PWM page
http://www.lpcware.com/content/project/SCTimer-PWM

0 项奖励
回复

2,621 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Sarvani A on Mon Apr 13 04:34:58 MST 2015
Hello,

Can you just tell me how to use SCTimer/PWM block in split mode.
Any register's have to be taken care and modified?


Please give me some idea or sample code regarding SCTimer/PWM block in split mode.


Thank you
0 项奖励
回复

2,621 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mc on Fri Apr 10 06:09:43 MST 2015
Hi Sarvani A,
You can also use same SCTimer/PWM block in split mode( Two 16 bit counters) to generate 2 independent PWM frequencies.
0 项奖励
回复

2,621 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Sarvani A on Fri Apr 10 01:01:13 MST 2015
Ok, i will try with timer output.
Thank you soo much for the response
0 项奖励
回复

2,621 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by wmues on Thu Apr 09 00:42:24 MST 2015
Sarvani,

we all know that you need separate frequencies for your PWM.

But the hardware in the LPC18xx does not work this way: you can only set ONE frequency for the PWM.

I suggest you to use a timer output to generate the second PWM.

regards
Wolfgang
0 项奖励
回复

2,621 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Sarvani A on Wed Apr 08 23:16:09 MST 2015
No, i dont want that..
I need separate frequencies.

In LPC1857, PWM has three channels. Iam using one channel for Buzzer with a frequency of 1.4KHz and other channel for LCD with a frequency of 300Hz.

Please do see the attached files

1. Configurations
2. Example code periph_sct_pwm with i took as reference (this is a rar file..please download and check)
3. Mcu_PWMControl.c - code where iam using the api's of the example code. In this code iam facing issue


Thank you
0 项奖励
回复

2,621 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by capiman on Wed Apr 08 02:26:46 MST 2015
You call the first one, it is set.
Then you call the second one, and replaces the first.
Is this really what you want?

Do you have two different PWMs, so you assign one frequency to peripheral 1 and the other to peripheral2?
0 项奖励
回复

2,621 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Sarvani A on Wed Apr 08 02:20:21 MST 2015
Hello,

I need to program two operations in that code. one is for buzzer and second is for LCD.
Each of the operations has it's own frequency( not a common frequency rate)
So i have defined two frequency rates PWM_RATE and PWM2_RATE
      PWM_RATE is for buzzer  with a frequency of 10KHz
      PWM2_RATE is for LCD with a frequency of 20KHz
0 项奖励
回复

2,621 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by wmues on Tue Apr 07 23:53:30 MST 2015
Chip_SCTPWM_SetRate(SCT_PWM, SCT_PWM_RATE);   //PWM1 with 10KHz
Chip_SCTPWM_SetRate(SCT_PWM, SCT_PWM2_RATE); //PWM2 with 20KHz


Please explain why you assume that the first call is for PWM1 and the second for PWM2.

regards
Wolfgang
0 项奖励
回复

2,621 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Sarvani A on Tue Apr 07 23:23:47 MST 2015
Hello,

Yes, iam using the example code from LPCOpen.This example, uses the SCT PWM driver to create 2 independent PWMs (running at
the same frequency) but iam trying to create 2 independent PWMs running at different frequencies.

Can you suggest me how to modify the example code to make it run with different frequencies.

Below attached is the Source code file

Looking forward

Thank you
0 项奖励
回复

2,620 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mc on Tue Apr 07 17:22:00 MST 2015
Hi sarvani,
I do not see any source files in your project. Did you use example from LPCOpen?
Did you modify it?
0 项奖励
回复