Scilab, FLEX and the Evidence

Third day of the Masters’08 and I discovered another little treasure.

If you have been dreaming about using a tool like MATLAB to model your applications and to generate automatically your control algorithms,  but you did not have the kind of money required to purchase the tool, here is an interesting Open Source alternative called Scilab:

Scilab

But wait there is more, much more. The guys from Evidence s.r.l. have actually combined the Scilab tool with a vast library of modules for the dsPIC and PIC24 so that you can generate an entire advanced control application simply by dragging and dropping graphic icons on your PC screen, it’s called SciCOS. To complete the picture they have created a line of modular components (that somewhat reminded me of the PC104 standard) called FLEX. Useless to say that all FLEX boards/components have a corresponding model in Scilab and integrate perfectly in your control solution.

I have seen some pretty impressive real time demos,  check them out!

New compiler and new libraries for the PIC32

The MPLAB C32 compiler got today its first new release v1.03!

And it is not just any minor update of the tool as the small version number change would have you believe… there are two important changes:

1- The math libraries have been significantly optimized, in particular the floating point math

Fast Math Libraries

2- The Student Edition of the compiler (free download)  is now using a scheme similar to the MPLAB C30 compiler. The first 60 days there are NO limitations of any sort. After this period, only the maximum optimizations level is limited to level 1 (still very effective).

Gone is the limitation in size that had so many of us frustrated when trying to compile the more advanced libraries (like the USB Host Stack for example)!

Check the MPLAB C32 compiler web page for more info.

freeRTOS for the PIC24 and PIC32

Today was my second day at the Masters 2008. After attending a number of excellent PIC32 classes (taught by the same architects and engineers that designed the chip and its libraries and tools) I sneaked out and went looking for a hands on class introducing the freeRTOS port for the PIC24 and PIC32.

freeRTOS

freeRTOS is one of the few Real Time Operating Systems that have been ported to a large selection of microcontrollers commonly used in embedded control applications. Previous PIC architectures had been supported in the past but of course the PIC24 and PIC32 are now part of the list.

The integration with the MPLAB C30 and C32 compilers is quite natural and even the MPLAB IDE recognizes the tool and allows you to inspect the list of active  tasks and perform some basic debugging.

If you are like me, looking for a way to run multiple software libraries (Graphics, USB, TCP/IP etc ), you are most probably looking for a small and inexpensive RTOS that can help you manage the complexity.

Check out the freeRTOS web site, it might just be what the doctor ordered!

The Masters 2008 is here!

MASTERS 2008

If you have never been at a Microchip Masters you don’t know what you are missing!

This is an event where only engineers are allowed and you get to hear of the latest products and tools directly from the people that designed them. No marketing fluff, no fancy shows, just the real thing!

I am going to be there all week long, you will find me sneaking in and out of classes trying to learn as much as I can. This year I plan on filling up on: PIC32 (of course), USB, Graphics and RTOS…

Modifying and Testing the code for the new GA1 and GB1 families

I have received a lot of request recently from readers, future PIC24 pilots, concerning the possibility to port the code from the book to the the newest families of PIC24 microcontrollers. The differences are not that big, but I have to be honest, I spent a lot of time recently “playing” with the PIC32 and I just did not have the time to go through the painstaking process of modifying all the code examples and testing them on the new GA1 and GB1 families. I have always encouraged you (my readers) to share the code (in the book and CDROM) and to modify it freely in your applications, but I also encourage you to share any enhancement that could be useful to the community.

Wayne Duquaine, an experienced programmer I had corresponded with a few times in the last few months, has followed this suggestions and recently, after working with an AV16 kit for a few weeks, he has surprised me with a long email where he has listed the code and all the results of his extensive experimentations with the new GA1 and GB1 PIMs and the MPLAB C30 compiler v.3.02.

I decided to post his code and his “scorecard” on the PIC24 web site  in the main download page with a link to his email address (he has agreed to share) with the understanding that he will be willing to provide support answering your emails on a time permitting basis. Wayne is a busy professional that travels often abroad for extensive periods of time. So I am sure you will be patient and you will appreciate any (personal) time he will be willing to dedicate to you.

Thanks Wayne!

Now, has anybody been playing/modifying the code for the PIC24H families recently?

How about  the little guys: GA004 and GA002?

Landing on a Carrier

Navy pilots will tell you that landing on a carrier is one of the most challenging maneuvers in aviation but also, as often is the case, one of the most rewarding. In Arizona there are no bodies of water that can float a carrier, but we have our own surrogate called Sedona!

No, it is not a ship, but a small village at the foot of the Coconino plateau where the Sonora desert makes a last step up (from 4000ft.) to reach for the elevations of Flagstaff (6000 ft) and the rock formations exposed are of a bright red color.

Red rocks

Read the rest of this entry »

3D Graphics

Using the new double buffered graphic library (see previous post) we can now create simple animations. In chapter 12 we have already seen how to visualize a 2D function using a grid and a bit of perspective (isometric). The next obvious step is to look into 3D objects and how to animate them by moving and rotating them in space. Read the rest of this entry »

Graphic Animation

In the good old times, when studying at the University of Trieste, I particularly enjoyed Rational Mechanics, a required class for any EE Master back then, presented by professor Enzo Tonti. One of the things that were always making his lectures a pleasure (and a challenge) was his constant reference to, and practical use of, personal computers to illustrate visually the concept at hand.

Mind those were the early days of the Apple II, the Commodore C64, the Sinclair Spectrum and for the few lucky (and rich) ones among us the first IBM XT personal computers. The graphic capabilities of those personal computers were primitive to say the least. In fact, a single PIC24F128GA010 has today more program memory than any of those personal computers and the resolution of the video output, using the AV16 board we developed in the book (without any hardware assistance), is actually pretty close. Yet prof. Tonti used to teach us how to develop effective demos using little more than a few lines of BASIC or, I should say, of the “soup” of BASIC dialects that were popular at the time… (Actually prof. Tonti developed a brilliant scheme to identify a sort of minimum common denominator among all those disparate systems and Basic dialects that he called Inter-Basic if I recall correctly… there must be a web site somewhere where all this is documented)…

We simulated graphically the motion of planets around a sun, the complex motion of pendulums of various kinds, we animated objects in 2D and 3D! Key to all those graphic exercises was the ability to alternate fast images on the display to obtain the illusion of motion….

Read the rest of this entry »

Optimizing the graphic library

While working on the porting to the PIC32 of the code developed for the original PIC24 book it occurred to me that there were some obvious optimizations I had yet to explore.

For a starter, the graphic.c library was using several resources including Timer3, the Output Compare 3 module, the Output Compare 4 module and the SPI1 port in addition to one general purpose I/O (RG0 in this case). The OC3 module was used to generate the Horizontal Synchronization pulse portion of the composite video signal, but the module output pin RD2 (active as soon as the module is enabled) was not used. Rather RG0 was “manually” set during the OC3 interrupt service routine and reset during the Timer3 interrupt service routine. This added unnecessary overhead to the application as the OC3 module could easily be configured to do it all by itself…

Read the rest of this entry »

Only one design will survive!

Survive

Yawn … you will say … yet another contest…

Well, look again! This is not like anything you have seen before. At least in terms of engineering challenges … this was never done before to my knowledge.

Read the rest of this entry »