Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
11 years, 2 months ago.
PwmOut in LPC800
Hi, Why I can't compile code:
#include "mbed.h" #include <PwmOut.h> PwmOut led(LED1); int main() { }
Error is:
"Identifier "PwmOut" is undefined" in file "/main.cpp", Line: 4, Col: 1
I'm newbie in LPC and ARM platform, I just got my LPC812-MAX mbed/Xpresso board and I want to use PWM on built-in LED (or external).
Also, how I can check if built-in button is pressed? Example uses I2C, it's little complicated...
2 Answers
11 years, 2 months ago.
Sadly the LPC800 has no PwmOut options. I don't know if it can't make them at all, or it is just that its timer(s) are already used for ticker/timeout/etc and that it has no other timers.
Thats a very good question. My answer came from the source code which has PwmOut disabled (I don't have the board myself currently).
A quick check makes me think they use the SCT for the timer functions, which also is the only thing that can make PWM. The mbed site doesn't tell it can use PWM, although the pin picture does show it, which I think then is incorrect. (I also don't understand why there are those pin limitations, okay a few I get, but I thought the LPC800 could switch pin functions around with barely limitations).
posted by 07 Oct 2013I can understand this problem for something this new. But given that my robot has to be finished in the next 7 days, it's crippling my progress and definitely a bad decision on my part to migrate from the arduino :( hopefully someone can fix this asap
posted by 09 Oct 2013If it needs to be done in the next 7 days then that is indeed a problem. Especially since that also doesn't leave much time for alternatives. There is the KL25Z which also has the arduino formfactor and the seeeduino with the LPC11U24, and they both have PWM. Or if you don't need the formfactor you can use any mbed enabled device.
If you don't need timer functions you can also try to manually set registers to use PWM. I really wouldn't expect this to be fixed within 7 days, since it is designed to be like this.
Edit: Checked alternative timers to use for timing functions, but they lack prescalers, so not really many alternatives.
posted by 09 Oct 201311 years, 1 month ago.
See the LPC800-MAX RGB demo using PWM State-Configurable Timer (SCT),
Import programlpc800-max-RGB
LPC800-MAX RGB demo using SCT and MRT
http://www.lpcware.com/content/nxpfile/lpc80-sct-cookbook-and-tutorial-code-examples
I have the same problem...
posted by Marcin Kosela 07 Oct 2013