Easylab board: Description & MPLAB IDE Library

From ErikaWiki

(Difference between revisions)
Jump to: navigation, search
(Compile & Run the example)
(Compile & Run the example)
Line 48: Line 48:
      
      
# Create a project directory and put all Easylab Library files inside (easylab.h, easylab.c, main.c).
# Create a project directory and put all Easylab Library files inside (easylab.h, easylab.c, main.c).
-
# Open MPLAB IDE and start a new Project Wizard ([MAIN MENU] Project-> [ITEM] Project Wizard...).
+
# Open MPLAB IDE and start a new Project Wizard ([MAIN MENU] Project-> [ITEM] Project Wizard...). <br>Following steps are made inside wizard procedure.
-
<br>Following steps are made inside wizard procedure.
+
# Connect your Easylab with supply-communication cable and connect you microstick<br>board with programmer cable to your computer
-
# Connect your Easylab with supply-communication cable and connect you microstick  
+
-
<br>board with programmer cable to your computer
+
# select dsPIC33FJ64MC802 as target device ([Main Menu] Configure -> Select Device...)
# select dsPIC33FJ64MC802 as target device ([Main Menu] Configure -> Select Device...)
-
# Choose your Toolsuite (Microchip C30 Toolsuite), eventually give the path to the tools
+
# Choose your Toolsuite (Microchip C30 Toolsuite), eventually give the path to the tools<br>if MPLAB IDE is not able to found them by it self.
-
<br>if MPLAB IDE is not able to found them by it self.
+
# Create a new Project file browsing for the previously created project directory and giving a<br>name to project file in "Save Project As" dialog.
-
# Create a new Project file browsing for the previously created project directory and giving a  
+
-
<br>name to project file in "Save Project As" dialog.
+
# Add all Easylab Library files at your project.
# Add all Easylab Library files at your project.
-
# After click next until the end of wizard you could uncomment all needed compile defines  
+
# After click next until the end of wizard you could uncomment all needed compile defines<br>at begin of easylab.h file or add them to your project build options<br>([Project CONTEXT MENU] (right click on the project) -> [ITEM] Build Options... -> [TAB] MPLAB C30 -><br>[GROUP] Preprocessr Macros -> [BUTTON] Add) .
-
<br>at begin of easylab.h file or add them to your project build options  
+
-
<br>([Project CONTEXT MENU] (right click on the project) -> [ITEM] Build Options... -> [TAB] MPLAB C30 ->  
+
-
<br>[GROUP] Preprocessr Macros -> [BUTTON] Add) .
+
# Build your project  ([Project CONTEXT MENU] -> [ITEM] Build All).
# Build your project  ([Project CONTEXT MENU] -> [ITEM] Build All).
# Select Starter Kits programmer ([MAIN MENU] Programmer -> [SUB MENU] Select Programmer -> [ITEM] Starter Kits)
# Select Starter Kits programmer ([MAIN MENU] Programmer -> [SUB MENU] Select Programmer -> [ITEM] Starter Kits)
-
# Open a Serial Terminal (e.g. Putty.exe, HTerm.exe). Configure the port, baud rate (115200),
+
# Open a Serial Terminal (e.g. Putty.exe, HTerm.exe). Configure the port, baud rate (115200),<br>data bits(8 bit), stop bits (1 bit) and parity bits (none). DON'T enable CTS. Connet to the channel.<br>Step 11: Program your board ([MAIN TOLLBAR] ->[BUTTON] Program (It should have been appeared after you selected the<br>programmer))
-
<br>data bits(8 bit), stop bits (1 bit) and parity bits (none). DON'T enable CTS. Connet to the channel.
+
-
<br>Step 11: Program your board ([MAIN TOLLBAR] ->[BUTTON] Program (It should have been appeared after you selected the  
+
-
<br>programmer))
+
# Enjoy the kitt effect and a nice stadium choir. :)
# Enjoy the kitt effect and a nice stadium choir. :)
# Look at your serial teminal, you should get the example instruction on the console.
# Look at your serial teminal, you should get the example instruction on the console.
# Have fun with it. :D
# Have fun with it. :D

Revision as of 13:40, 12 October 2011

Contents

Description

Easylab board is cheap easy to use prototyping board that let you develop with Microchip Microstick dsPIC33F and PIC24H Development Board. The board give you two connectors to access to all Microcontroller I/O pins, a bounch of leds to visually test Digital I/O, a buzzer to play with and an USB port to interact with the microcontroller, through serial over USB protocol. Power supply and serial communication come both through the same USB cable.

Easylab MPLAB IDE Library

Exist a free to download Easylab Software Packet for the board that contains the source files for a simple library (easylab.h, easylab.c) to access all easylab goodies and a complete example that show how to use these API (main.c). The library rely on dsPIC33F Microchip support library, so you need to install a Microchip C30 compiler for dsPIC (we tested with version 3.25).

The library contains API for:

  • Configure dspic pins in realation with board layout
  • Set/Get actual clock frequency (with internal FRC with PLL)
  • Turn on/off & toggle leds
  • Read/Write DIO pins
  • Configure up to 2 General Purpose Timers
  • Start and stop a buzzer with a given forcing frequency
  • Configure one of 4 ADC channels and sample that synchronously
  • Configure 2 couple of PWM pins in any combination of PWM/override, with given frequency and duty cycle
  • Serial comunication with UART serial over USB

The library has been coded with dsPIC33FJ64MC802 as only test target, even though Microstick package come with a PIC24FJ64GP too.

Easylab MPLAB IDE Library Example

Easylab Library come with a complete example that shows the usage of some features of the board like PWM, ADC, Buzzer, USB/Serial and leds. At the beginning the User configure the PWM and the ADC channels, and the desired voltage value that analog input should match, through serial communication. Then, using a simple cable, the user can connect the analogic output (AOx for PWM channel x) to the AD converter (ANx for ADC channel x). The value measured by the AD converter is then transmitted to the PC. You can interact with the application with any serial console (e.g putty.exe, hyperterminal, HTerm).

So application steps are:

  1. Select the PWM channel.
  2. Select the ADC channel.
  3. Set the desired voltage value.
  4. Connect the cable and measure the output voltage.

You can send 'ESC' char to restart the demo.

Compile & Run the example

To compile and run the example you should use MPLAB IDE v8.66 or later and follow these steps:

  1. Create a project directory and put all Easylab Library files inside (easylab.h, easylab.c, main.c).
  2. Open MPLAB IDE and start a new Project Wizard ([MAIN MENU] Project-> [ITEM] Project Wizard...).
    Following steps are made inside wizard procedure.
  3. Connect your Easylab with supply-communication cable and connect you microstick
    board with programmer cable to your computer
  4. select dsPIC33FJ64MC802 as target device ([Main Menu] Configure -> Select Device...)
  5. Choose your Toolsuite (Microchip C30 Toolsuite), eventually give the path to the tools
    if MPLAB IDE is not able to found them by it self.
  6. Create a new Project file browsing for the previously created project directory and giving a
    name to project file in "Save Project As" dialog.
  7. Add all Easylab Library files at your project.
  8. After click next until the end of wizard you could uncomment all needed compile defines
    at begin of easylab.h file or add them to your project build options
    ([Project CONTEXT MENU] (right click on the project) -> [ITEM] Build Options... -> [TAB] MPLAB C30 ->
    [GROUP] Preprocessr Macros -> [BUTTON] Add) .
  9. Build your project ([Project CONTEXT MENU] -> [ITEM] Build All).
  10. Select Starter Kits programmer ([MAIN MENU] Programmer -> [SUB MENU] Select Programmer -> [ITEM] Starter Kits)
  11. Open a Serial Terminal (e.g. Putty.exe, HTerm.exe). Configure the port, baud rate (115200),
    data bits(8 bit), stop bits (1 bit) and parity bits (none). DON'T enable CTS. Connet to the channel.
    Step 11: Program your board ([MAIN TOLLBAR] ->[BUTTON] Program (It should have been appeared after you selected the
    programmer))
  12. Enjoy the kitt effect and a nice stadium choir. :)
  13. Look at your serial teminal, you should get the example instruction on the console.
  14. Have fun with it. :D
Personal tools