I am a long time fan of PIC microcontroller. I used MPLAD IDE since I learned PIC. Now, developers of Microchip prepared a turn point for their IDE and development platform. The MPLABX is a beta stage IDE for past and upcoming microcontroller development. I like the way of AVR (totally free, flexible and open) and seem Microchip also want to turn this way. Some distant features of their partially open source MPLABX ( I mean partially because it is not fully open source, IDE is open but compiler and libs are still closed 😛 ) are-
- Used open sourced IDE , NetBean
- Mostly open source, free software components and plug -ins (Microchip used WinUSB/LibUSB for USB rather than their propitery USB stack)
- Crossed platform, Support Subversion, CVS, Mercurial, bugzellia and tracker and most opensoure features of NetBean
- Seem the most useful feature “History”, you can forward/backward your change
- MPLAB8 and X are don’t brother each. You can install both. There is also a con version tool to change 8 project to X
- Assembler, compiler are not changed
I got my new Open bench logic analyzer last month from Seedstudio. I am also a fan of DangerousPrototypes. So, I created a project to test both MPLABX and OBLS.
The idea is simple. To create an 8bits signal generator with PIC. The software project is developed by MPLABX and target hardware is PIC16F628A. I used this PIC because it is cheap and fast (20MHz clock) in low end controllers series.
First I download MPLABX from here. The installer is about 220M. I don’t nee others C30, C32 compiler at the moment. You can download if you want to use them.
I choosethe following along with IDE.
- PIC18C lite
- Hitech C lite
- HitechC pro lite
You may need latest Java.
Installation is straight forward and finished about 15 mins.
After that, installed C18 and HitechC lite version.The are separate installers. You need to download and installed separately.
Then, Hitech C lites. The installation style of both HitechC lite and pro are the same except you can choosed trial and lite versions in installati
Then, launch MPLABX…
The four panes as usual IDE, project, project , navigator, editor and output. The two bars, menu and editor. There is also error stripe beside editor window.
There is a guide “Getting started with MPLABX” in web site. But this is exampled with high end PIC and C18 compiler. Not with low end PIC and free MPASM assembler.So, I listed my work here.
– Starting a project
Click on the New Project icon on the toolbar, or select File –> New Project from the menu.
– Select Microchip Embedded under Categories and select C/ASM Standalone Project under Projects.
– Click Next.
– Select Device –> Family: All Families –> Device: PIC16F628A and Next
– You can select header for debug. I don’t need at the moment and skip it by clicking just “Next”
– I want to use PICKit2 and select it. If you have any tools from listed, you can choose. If you dont have any listed device, just choose “Simulator”.
– Select Compiler –> Mpasm, I choosed this I want to write the code in Assembly. If you want to use listed compiler, you can select here.
– Select where do you want to store your project.
– Click Next and project creation is done. There is a project “logictester” in project pane and infos, setting about the project is shown in navigation.
– This is just the beginning. There is no source file in project. I copy the template “16F628ATEMP” from ../MPLABX/MPASM30/templates/code folder to project ../logictester/nbproject folder.
– Right click “Source” in project windows and select “Add existing Item..” and choose 16F628ATEMP. Click the file name and rename the file as “logictest”. Make sure to choose Store path as: to “Relative”.
– There is a source “logictest” under source “Source Files” in project window. Double click it to open at editor window.
– Edit the code as follow. I want to develop the code in assembly to get both speed and optimization. The code is quite simple, just an software base 8-bits counter and output to PORTB of PIC. The software counter will increase from zero to 255 (in binary, 00000000~11111111) and loop forever. Each counter value will be output t0 PORTB simultaneously. Thus, all 8-pins of PORTB generate frequency twice of its’ lower pin. If LSB pin-1 generates 1MHz, most MSB pin-2 will generate 500 KHz and so on.
the rough pseudo code is:
PORTB = 00000000
PORTB = 00000001
PORTB = 00000010
PORTB = 00000011
PORTB = 00000100
PORTB = 11111110
PORTB = 11111111
– Build the circuit and attached with my DIY PICKit2 clone. The circuit is quite simple, a 16F628A, 20MHz crystal, 2x22pf capacitors and +5V power.
– To build project, Click on the Debug Project toolbar button. Building the code for debugging, programming the target and running the program should done.
– Oops, an error show device ID is wrong. I manually checked with PICkit2 standalone programmer software that PIC and PICkit2 are connected well and the device is surely chosen 628A. I am no idea about this error. So, I just click “yes”.
– The message show that building is complete.
– When done, click on Pause then End Debug Session.
– Then, I tested by click “Program Target” on main tool bar. This can also make and program to target. Not need to click Build or debug. It also show the same error but click “yes” and shows building successful and loading complete.
– Some issues are,
- I noticed about MPLABX, PICkit2 support here http://dangerousprototypes.com/2010/11/02/reactions-mplab-x-ide/
- The connection with PicKit2 shows also error in debug tool
- Although errors are shown, the building project is done. There is also a hex file “logictester.X.production.HEX” under ../dist/default/production folder.
- The programming to target is also done. I rechecked manually with PicKit2 standalone program. The hex file is successfully loaded to PIC.
- Some facts checking at “MPLABX Beta Limmitations” page on IDE start page
- At “Device and Compiler” support table, PICkit2 and ICD2 are listed
- At “MPLAB X IDE Features Surpotted” table, device debug header for ICD2 and Pickit2 are not listed
- From the current issues, ICD2 is not supported yet.
|i.||There is no Debug Header support at this time for ICD2.|
- Pickit2 is supported but not fully yet (can program the target although it shows error).
- ICD2 is not supported yet
- I don’t know why the device ID error is shown. If any one know about this, please point me out.
- It is a good IDE. I love to use such IDE and functions.
- Although IDE is open, Microchip don’t open or free to it’s C compiler. Lite versions are very limited. Hopefully they change the way of AVR one day. If not, they will loose new generation of developer, students, researchers (like me) who they cannot earn much money for development tools. So, the reason which I use this IDE is will be when I need to develop in Assembly not in C.
– My project source codes
Next post, I will post testing with OBLS. Stay tune.