1.6 Programming the Device and Comparing Efficiency

Todo: Load the project onto the microcontroller and get power readings.
  1. Get power consumption readings from the software implementation program.
    1. Connect the Curiosity Nano board to the computer and the two soldered pins together.
    2. With the software implementation program set as the main program, press the Make and Program Device button from the toolbar. A pop-up might appear that asks to select the tool that will be used as a programmer. Select the AVR128DA48 Curiosity Nano board.
      Figure 1-38. Make and Program the Device
    3. Connect the Power Debugger to the computer. Connect the first pin (the one closest to the Nano embedded debugger) to the inward arrow of the A channel ammeter and the second pin (the one closer to the microcontroller) to the outward pointing arrow of the A channel ammeter.
      Figure 1-39. Hardware Connections
    4. In Atmel Studio, go to Tools → Data Visualizer.
    5. Two boxes will appear. Check the one called DGI (Data Gateway Interface) Control Panel. If this does not show up, the Configuration menu on the left side can be accessed, and in the Modules → External Connection section, the Data Gateway Interface can be found.
      Figure 1-40. Data Gateway Interface
    6. Press Connect and a box labeled ‘power’ will appear. Select it and then press the wheel to open the menu. Disable the B channel.
      Warning: In case the Power field does not appear, disconnect the board and connect it again.
      Figure 1-41. Connect DGI
      Figure 1-42. Power Settings
    7. When everything is correctly configured, press Start and a new box that displays the power consumption in real time will appear.
      Tip: Open the control panel on the left side of the box to adjust the display. Unchecking Show Zero will provide a clearer picture.
      Figure 1-43. Start Monitoring
    8. After the reading has stabilized, press Stop and then disconnect. The box with the power measurement will remain open.
  2. Get power consumption readings from the Event System implementation program.
    1. Connect the two soldered pins on the Curiosity board together.
    2. With the Event System implementation project set as main program, press the Make and Program Device button on the toolbar in MPLAB X.
      Figure 1-44. Make and Program the Device
    3. Connect the Curiosity Nano Board to the Power Debugger. See Step 1.3 in this chapter for details and pictures.
    4. Go back to the Data Visualizer in Atmel Studio and in the DGI panel press Connect.
      Figure 1-45. Data Gateway Interface
    5. Check the power box and edit the settings to disable the B channel.
      Figure 1-46. Power Settings
    6. Press Start and a new box that displays the real-time power consumption will appear. Disable Show zero for a better picture.
      Figure 1-47. Start Monitoring
    7. When the reading has stabilized, press Stop to have a fixed result.
  3. Compare the two measurements.
    1. Both power consumption graphs are open on the same screen. They can now be analyzed to observe the way the programs behaved.
      Figure 1-48. Software Implementation Compared to EVSYS
      Info: The top part displays the power consumption of the Event System implementation, while the bottom part displays the power consumption of the Interrupts implementation. As can be seen from the picture, the difference is fairly small of about 1.5 uA. This is due to the long amount of time the microcontroller spends in Sleep.