LPC Core:Project Transplanting Note

From Microduino Wiki
Revision as of 07:15, 12 September 2016 by Fengfeng (talk)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Steps of Development

  • 1. Enter mbed Mainpage, and register.
  • 2. After the registration, return to Mainpage, and click the "Compiler" on the top right corner, to enter the online compiling mode.
  • 3. After compiling, clicking "Compile" can automatically download the file bin after the success of compiling and linking.
  • 4. Download JFlash: https://www.segger.com/jflash.html
  • 5. Download bin to LPC824 through JFlash to run it.

Program Code





Notes of Transplanting Codes from Arduino to Mbed

  • Study guide about mbed won't be said here any more, because there are many materials online.
  • You can see File:MBed Study Guide.pdf here.


  • The entry of Arduino is the setup and loop functions in .ino file, and the entry of mbed is the main function in main.cpp. While(true) can be used to realize the function of function loop in Arduino in main function.
  • PinMode in Arduino needs to be changed into the instance of classes such as AnalogIn, AnalogOut, DigitalOut and DigitalIn of mbed.
  • In Arduino, analogWrite can be used to realize the output of PWM, and it should be changed into the instance of class PwmOut in mbed. In mbed, the output frequency and width of PWM both can be dynamically set through API.
  • In Arduino, class Serial is used to output serial port, and the instance of class Serial should be used to take place of it in mbed
  • Function millis and micros in Arduino should be altered into the instance of class Timer in mbed. Besides, in mbed, the effects of class Timeout and Ticker are respectively to realize single operation and timed repeat operation.
  • Function pgm_read_byte in Arduino is to read data from flash. And you can directly operate pointer uint8_t in mbed, and don't need single function to read data from flash.
  • Wire is be used for the operation of the I2C in Arduino, and it should be taken place by the instance of class I2C in mbed.
  • The interval of taking the temperature of AM2321 is must bigger than 2s, or i2c won’t work.
  • SimpleTimer has a bug, which will result in a quick calling of two timing function. For example, setInterval(4000, sendCH4), execute function sendCH4 once every 4s, but in the actual runtime, the execution interval of sendCH4 will be less than 4s.

You can sen an email to me if you have any questions: lixianyu@toweer.com, and let us talk about the word of mbed.

  • About the definition of pins, you can clone mbed source code to local:https://github.com/mbedmicro/mbed.git
    • In the directory hal\targets\hal\TARGET_NXP\TARGET_LPC82X\TARGET_LPC824, the PinNames.h file has the definition of all pins of LPC824.

  • mbed has realizes the TARGET LPC824.

  • mbed has offered support for the MCU of the following manufacturer:


  • Enter the directory of TARGET_NXP, you can see mbed has realized the following specific MCU:


  • MCU not listed can't use mbed platform now.