- 15. May 2012: 32-bit PIC programming in Python!
- 23. April 2012: The Sinclair ZX Spectrum turns 30!
- 30. March 2012: Dmitry Grinberg
- 27. March 2012: Codecademy
- 4. March 2012: MPLAB X
- 19. February 2012: Virgil
- 11. February 2012: Maximite
- 17. January 2012: Atypical Curiosity
- 4. January 2012: PIC32MX7 PIM, RB5 pin conflict (solved)
- 30. December 2011: MikroE Mini-32 Board
- May 2012
- April 2012
- March 2012
- February 2012
- January 2012
- December 2011
- November 2011
- March 2011
- February 2011
- January 2011
- March 2010
- January 2010
- December 2009
- November 2009
- September 2009
- August 2009
- July 2009
- June 2009
- May 2009
- April 2009
- March 2009
- January 2009
- December 2008
- November 2008
- October 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008
- February 2008
- January 2008
32-bit PIC programming in Python!
15. May 2012 by pilot.
It has been a long journey for me to learn about modern interpreted object oriented programming languages, first on the desktop (see post here), later on industrial control and data acquisition applications (see post here) and now I feel like I have finally closed the circle: Python programming on an embedded control (32-bit) microcontroller thanks to the “Python-on-a-chip” project!
Dean Hall has been working at this project for several years now. He has demonstrated the possibility to run a small Python interpreter even on 8-bit architectures and others before me have ported the (well written) code to 16-bit microcontrollers like the PIC24. But since all Python interpreters have a huge thirst for RAM, it is only in the flat an (virtually) unlimited addressing space of a 32-bit microcontroller that Python starts really to make sense in my opinion.
So I have created a clone of the project (Mercurial) repository for the purpose (link) and developed a new PIC32 port for the v10 revision of the project. While describing the whole project would take a while, it is interesting to note that the time I spent to “port” the PIC32 code in itself (from pull to first successful build) was less than an hour!
Actually most of the time for me went into figuring out how to use Python effectively to wrap existing libraries and get a useable, or I should say a useful, package to develop applications on the PIC32 MX4 Micromedia Board.
At the moment I have demonstrated good real time support for the following features:
- QVGA Graphics Primitives
- Touch screen input
- Joystick input
- LED output
- Serial input/output
- Accelerometer input
- Temperature sensor input
- Audio (work in progress)
Eventually the project begs to be recompiled for a PIC32MX7 Micromedia board (128K of RAM!) where I could even dream to attempt a port of the PyGame libs to make development of little interactive applications real fast…
Please feel free to review the code and send your comments… but beware this is not a project for the faint of heart!
You will be required to master the following tools/application libraries:
- MPLAB X
- C32 Compiler
- PIC32 peripheral libs
- Microchip Application Libraries (GFX, MDD File System…)
- Scons project manager
- Mercurial versioning tools
- Doxygen automated documentation generator/manager
Enjoy!
Posted in Languages, MikroE MMB, PIC32 | No Comments »
The Sinclair ZX Spectrum turns 30!
23. April 2012 by pilot.
Happy Birthday ZX Spectrum!
Today Google UK dedicates the daily doodle to the 30th birthday of the ZX Spectrum.
I am part of that generation that learned to love computers/programming playing games like Manic Miner on an 8-bit little console with rubbery keys. The machine was so simple and ingenuous that you could get the entire schematic at a single glance and you could literally know every single line of code in the BASIC rom.
My tribute to that lost (romantic?) era: an emulator for the PIC32 written entirely in C from scratch that runs the original games in almost real time (a bit faster actually) on a Mikroe Multimedia Board.
Posted in Events, PIC32 | No Comments »
Dmitry Grinberg
30. March 2012 by pilot.
There are rare times when you realize unmistakably that you are in the presence of true genius. Visiting Dmitry’s web site today was one of them!
Check out this project and you will get the picture!
Now genius and madness are often separated by a thin line, here is a second example that will remove any last doubt!
I cannot wait to see what he will do next!
Posted in Linux, File I/O, Tips and Tricks | No Comments »
Codecademy
27. March 2012 by pilot.
Last night, I was cleaning up (managing) my notes (I use Evernote for pretty much everything in my life) and I stumbled upon a reference to “codecademy”. For as much as I tried I could not remember what it was about or where I had gotten this, so I did what we all do nowadays, I googled it! The result a misterious link to a web site: http://www.codecademy.com

You must take a look! This is one of those things that make you say: ” Why did I not think of it?”
My head is spinning with ideas for courses, if only there was a nice way to apply it to Embedded Programming too…
Posted in Languages | No Comments »
MPLAB X
4. March 2012 by pilot.
So it is done! After more than two years from my first hopeful post I have completed the transition. I have severed all my connections with Windows. MPLAB was the last strong chain keeping prisoner but with the latest release of MPLAB X (1.10 just a couple of days ago) I can finally say I am free.
No, it is not perfect yet, but I can definitely say that the advantages/features of the new (Netbeans based) IDE surpass the few remaining squawks and occasional annoyances/frustrations.
I love the new navigation capabilities, the call tree, the local history, the … it’s a long long list of sometimes little things that add up and can make your development time so much more productive.
It has been more than a year since I started using it (from the very early betas while re-writing many of the PIC24 book chapters for the second edition) and it is several weeks now that I am not firing up MPLAB 8 anymore. I guess this is the signal. Eventually MPLAB X has reached a level of familiarity for me such that I feel comfortable developing exclusively with it. Or perhaps there is a natural amount of time that our mind requires to accept a new tool, especially when it impacts so much our daily work.
MPLAB (8.x) is dead, long live MPLAB X!
Posted in MPLAB | No Comments »
Virgil
19. February 2012 by pilot.
I was reading recently about the (slow) adoption of object oriented programming languages in the embedded world. There is quite a sad situation, while in the mainstream, OOP languages are pretty much a standard, in the embedded world, they are just starting to show up, why?
The problem is not the lack of say C++ compilers or Java environments for the architectures used in the embedded world, it is more a matter of dealing with the runtime overhead and code bloating often produced by those solutions. But independently from the language of your choice, not all OOP is bad (as in bloating and runtime heavy…) there are some constructs in each language that are worse than others.
Ben L. Titzer, Jens Palsberg and other researchers at UCLA have been working for years on the subject and they have distilled a list of good and “bad” features that impact so much more heavily the typical embedded application. Their recipe, a new language called “Virgil“, designed from the ground up to provide you with the best of OOP without the worst of OOP.
Virgil is compiled to native (like C++) but is also strongly typed (like Java) and shares a syntax that is certainly familiar to programmers of both origin. There are also provisions for low level management including interrupt handling, special function registers and bit manipulation!
The only problem is that new languages’ adoption is always very slow, even when there are strong sponsors… (anybody used “GO” recently?), so if we wanted to accelerate the adoption of OOP, introducing a new language is not exactly a quick option…
Nonetheless, take a look at Virgil and see if you like what it has to offer…
Posted in Languages | No Comments »
Maximite
11. February 2012 by pilot.
I have to confess that, if I had not already done so in the past, when I wrote some of the material for the PIC24″flying” book such as the composite video and the keyboard interface examples, I had a bigger project in mind. Eventually I was hoping to be able to put them together and (re-) create some sort of a mini personal computer. Unfortunately the early PIC24 models proved to have too little RAM for that purpose, but when the PIC32 came out, I gave the whole project a second try.
This time though I took a completely different route, using a USB keyboard interface (in place of the PS2) and using a TFT display in place of the PAL video output. FreeRTOS gave me the ability to put various other pieces together with some agility, including a Z80 interpreter/emulator and even a tape emulator (using SD Cards instead). The result has been the ZX Spectrum project running on the MikroElektronika MMB-MX4 boards. With it, you can run Sinclair Basic programs but also play old videogames in almost perfect real time.
Unfortunately, in the process the simplicity of the original idea got somewhat lost. The ZX Spectrum simulator is composed of several layers (FreeRTOS, USB, Graphics libs, Z80 emulator, SD Card file system) each eventually requiring of a certain level of knowledge to handle and maintain.
Geoff Graham took a different approach and assembled instead a neat little board, the size of a credit card, to create a very agile little computer programmable in BASIC: the MAXIMITE. The project was the center of a series of articles he wrote for the magazine Silicon Chip where he described how he ended up writing almost from a scratch a BASIC interpreter for the PIC32. He has since posted the complete Maximite project on his web site and gathered a significant community around it.
I love his idea and I will keep checking his web site for news and future developments….
Posted in PIC32, Tools | No Comments »
Atypical Curiosity
17. January 2012 by pilot.
Actually I am typically pretty curious, especially when it comes to programming languages.
Atypical is a programming language that I discovered recently almost by mistake.
It was designed for the PIC and around the PIC assembly (midrange, 14-bit core) by Michael Park, with all the limitations and quirks of the PIC core, but with the intention to add a little structured programming and improve readability (quite a bit). Atypical flies very low, adding only a very thin layer of pre-processing to your source code. No fancy optimizations, if you are a hard core assembly wizard, you will appreciate how all the power is still in your hands…
As the author says, take a look and see if Atypical piques your interest! (link)
Posted in Languages | No Comments »
PIC32MX7 PIM, RB5 pin conflict (solved)
4. January 2012 by pilot.
I need to thank Martin K. for bringing to my attention an issue that appears to be affecting quite a few of the readers of my PIC32 book when they attempt to use one of the new MX7 PIMs on the Explorer 16 board.
On the PIC32MX7 models the VBUSON and FVBUSONIO, are multiplexed with RB5 where the Explorer 16 connects instead the potentiometer. That could in fact cause an issue if it was not for the fact that the PIM sockets are NOT a 1 to 1 match to the PIC pins!.
See the document that comes with the PIC32MX7 PIM:
http://ww1.microchip.com/…n/DeviceDoc/51949A.pdf
and you will find that pin 20 on the Explorer16 (the pin actually connected to the potentiometer), is instead connected to pin 23 on the device, which corresponds to AN2.
So in the examples of Day 10, just read out AN2 instead (remember to adjust AD1PCFG and AD1CHS accordingly) and you will get a perfect representation of your potmeter’s position!
Posted in PIC32, Tips and Tricks | No Comments »
MikroE Mini-32 Board
30. December 2011 by pilot.
The guys at MikroElektronika have done it again!
Here is another brilliant new development board for the PIC32: the Mini-32
This board makes a PIC32MX5 fit in the exact form factor of a standard PIC16 or PIC18 40-pin DIP with full pin-out compatibility (with approximately 80 PIC models), but it operates at about 10 to 40 times the speed.
Of course you get 64K (+12K) of FLash memory and 16K of RAM too. A CAN interface complements a number of serial ports and the USB port is already there for you to bootload new code into it without having to use any additional hw development tool.
At USD 25 a piece, it looks ideal for breadboard-ing and quick (classroom) experimentation.
Posted in PIC32, Tools | No Comments »
