Inexplicably Working Errata

A few days ago, I received an email from a reader who reported a new errata on page 123 (in the “Learning to fly the PIC24” book) in the write() function, an example of redirecting the “stdout” output stream.

The function receives a pointer to a buffer containing characters that need to be forwarded to the output device of choice and a counter. A loop is performed to print sequentially the required number of characters, but (here is the bug) I apparently omitted to increment the buffer pointer.  To the reader’s greatest surprise the code example seems to work anyway! How is this possible?

Continue reading

Posted in PIC24, Tips and Tricks | Comments Off on Inexplicably Working Errata

PIC32, Harvard or Von Neumann

In Chapter 6 of the PIC32 book I briefly mention that the PIC32 differs from all previous PIC microcontrollers since it offers a Von Neumann programming model as opposed to the Harvard model adopted by all previous Microchip architectures.   Then, in a note I remind all the readers that the core of the PIC32 (MIPS M4K) is Harvard based. More than one reader has written back to me to report the apparent contradiction, while in fact there is none. Let’s see if I can make things clearer …

Continue reading

Posted in PIC32 | Comments Off on PIC32, Harvard or Von Neumann

Back online, Excuses and the Blues Brothers

It has been almost three full months since my last posting and you might have been wondering what happened … I have only a few excuses, but good ones:

  1. I moved back to the old continent, I am now writing this from Munich, Germany
  2. I changed job (a bit), while still working for Microchip, I am now responsible for the marketing of 32-bit microcontrollers in Europe, Middle East and Africa. This of course requires quite a bit of traveling.
  3. But perhaps the most important one is my new “project”, my son Luca, who is now 10 months old and absorbing ALL that is left of my wake time.

In this last few months I have received tons of email, (I love emails from my readers) and tried to respond to most of them. Some of you have been reporting about typos in the books and/or issues with new versions of the compilers and libraries. Others have brought up interesting ideas and questions that I plan on using in the future postings. Slowly, I will try to cover all the backlog and get back live.

Stay tuned!

P.S.: For those among you who are old enough to remember the Blues Brothers movie, here is Jake’s (Jim Belushi) original list of excuses:

  1. I ran outta gas.
  2. I had a flat tire.
  3. I didn’t have enough money for cab fare.
  4. My tux didn’t come back from the cleaners.
  5. An old friend came in from outta town.
  6. Someone stole my car.
  7. There was an earthquake,
  8. … a terrible flood,
  9. …locust’s.
  10. It wasn’t my fault!!
Posted in PIC24, PIC32 | Comments Off on Back online, Excuses and the Blues Brothers

Not a dsPIC!

The last two days of the Masters ’08 have been such a rush that I could not possibly find the time to write any more postings during the day, and I was too exhausted, once back home, to write the night. For two days I was on duty in the “ask the experts” area behind the PIC32 table playing with a few demos derived from the last few chapters of the book(s). I met with so many PIC users/enthusiasts that I cannot possibly write about all of them and their projects/ideas. Perhaps the funniest things that happened though is when one of them, (a veteran of several Masters) after checking out a few colorful PIC32 graphic demos, lying on the table in front of me, had a sudden epiphany, looked up and with eyes of stupor and a wide smile exclaimed: “But… it is not a dsPIC!”

It had never dawned on me that someone could have had this (wrong) impression. It is true, the official marketing campaign of the PIC32 talks a lot about pin-out and software compatibility with Microchip 16-bit architecture (although when you look closely it is the PIC24F and in particular the GA0 series that all the documentation keeps referring to). Not to mention that the part number being “surrounded” by the dsPIC30 and the (ill named) dsPIC33 can further confuse the matter.

Once I reassured him that the PIC32 was a very simple, general purpose, 32-bit microcontroller that just happened to run C code very fast, I saw him sigh with relief. He grabbed a copy of the brochure and disappeared rapidly in the crowd heading toward the development tools counter.

Did you happen to think the same? Let me know, because we certainly never meant it to be!

Posted in PIC32 | Comments Off on Not a dsPIC!

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!

Posted in Tools | Comments Off on Scilab, FLEX and the Evidence

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.

Posted in PIC32, Tools | Comments Off on New compiler and new libraries for the PIC32

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!

Posted in PIC32, Tools | Comments Off on freeRTOS for the PIC24 and PIC32

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…

Posted in PIC32 | Tagged | Comments Off on The Masters 2008 is here!

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?

Posted in PIC24, Tips and Tricks | Comments Off on Modifying and Testing the code for the new GA1 and GB1 families

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

Continue reading

Posted in Flying | Tagged | Comments Off on Landing on a Carrier