1. How to Build a Better Arduino – the Development of MHVlib Alastair D’Silva @EvilDeece http://alastair.d-silva.org http://www.makehackvoid.com
2. What is an Arduino A hardware and software platform for prototyping electronics Low entry barrier allows programmers to interact with the real world Built on top of Wiring
3. Love Arduino Cheap hardware Simple to understand Serial bootloader makes programming easy
5. Fix Arduino Keep the good parts Hardware Bootloader Ditch the bad parts Runtime libraries
6. Design Philosophy Portable (support all ATMEGA & ATTINY) Lean Memory efficient Use interrupts if possible No deprecated calls No warnings
7. HardwareSerial Arduino Uses fixed length, preallocated 128 byte RX buffers Preinstanties 1 object for each serial port Reinvents the wheel regarding string formatting Interrupt driven RX, busy TX MHVlib User allocates buffers and passes them in User instantiates only what is needed Provides interrupt driven & busy variants of RX/TX Provides PROGMEM TX support
8. Digital IO Arduino Lots of handholding Uses extensive tables in PROGMEM to look up pin ports & bits ~55 clocks MHVlib No handholding Uses macros Single instruction, 2 clocks
11. Servo Library Arduino Servo Consumes 1 16 bit timer per 12 servos ~10 bits of significance Resolution of 16 clock cycles ArduinoSoftwareServo Uses a 16 bit int, valid values are 0 to 180 Refresh must be called periodically Sorts the list of servo positions on each pass Lots of busy waiting MHVlib Uses a uint16_t, 0-65535 (~14 bits significant) Consumes 1 16 bit timer Resolution of 2 clock cycles No restrictions as to how many servos Only sorts when positions change
13. First (Real) Project Spindle controller for a CNC Mill Generates a servo signal to a BLDC controller to drive an RC helicopter motor (up to 1.8kW) Read from the serial port and set the speed Monitor the spindle and adjust the speed Report actual speed back to the PC Arduino version 11,900 bytes of flash 500 bytes of RAM MHVlib version 6930 bytes of flash 177 bytes of RAM
Hinweis der Redaktion
Wiring is a simplified form of C++ - it provides a simple API and removes some of the requirements of C++ by using a preprocessor to do things such as automatic prototype declarations.
Currently have support for ATMEGA168, 328, 1280 & ATTINY2313. Adding new microcontrollers involves creating a new header file from the data sheet. Most of it can be cut and pasted from an existing header as Atmel have strived to be consistent between controllers.We try to keep the code lean by doing as little handholding as possible – we just get the job done, in as few instructions as possibleAvoid unnecessary memory allocations, use appropriate datatypesWe provide busy waiting and interrupt driven variants of most peripheral functions, allowing the microcontroller to get on with other work while the task progressesThe Arduino libraries make use of deprecated macros such as the old cbi & sbi macros, and also produces warnings when compiled