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. Continue reading

Posted in AV16/32, Graphics, Tips and Tricks | 1 Comment

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….

Continue reading

Posted in AV16/32, Graphics, Tips and Tricks | 1 Comment

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…

Continue reading

Posted in Graphics, Tips and Tricks | 1 Comment

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.

Continue reading

Posted in PIC32 | Comments Off on Only one design will survive!

Visualizing Data – A taste of Visual C#

Our brain is wired for image processing and all things visual just reach deep in our mind faster! If there is one moment when I just cannot seem to ever get enough of a “view”, that’s when I am debugging code. The Watch windows, the local variables windows, the stack window are not what I am talking about. The Logic Analyzer window (in MPLAB SIM) and the DCMI (with simulator and emulators) are barely starting to scratch the surface, when I need to debug some complex code, I am willing to use literally everything at my disposal, beyond MPLAB, using hardware (scopes and logic analyzers) but also additional software.

Continue reading

Posted in Tips and Tricks, Tools | Comments Off on Visualizing Data – A taste of Visual C#

Visualizing Data – DMCI

I guess one of the advantages of getting older (if there is any) is that I am becoming somewhat more patient and I am learning to resist the temptation of trying out on the hardware target every single line of new code I write. I am finding myself using the simulator (MPLAB SIM) more and more every day to test thoroughly sections of my code before throwing it out to the ICD. The result is overall less development cycles (code, program (ICD), run, crash, … repeat), more bugs caught early and more productivity.

Continue reading

Posted in Tips and Tricks | 1 Comment

Look Mom No … Linker Script

There are so many new features being added to MPLAB at each major (and minor) new release that I struggle to keep up. Just a couple of days ago for example, I was discussing with a colleague how it would be nice to have the MPLAB New Project Wizard to use a default linker script in every new project … so that in most standard cases the repetitive  task of adding one (navigating through the many subdirectories inside Program Files) can be spared and … I got stopped mid-sentence and promptly reminded that this feature was already there! In fact since last November, with the introduction of version 8.00, MPLAB has been quietly offering a default linker script when the MPLAB C30 toolsuite is selected.

Thanks !

Posted in Tips and Tricks | Comments Off on Look Mom No … Linker Script

LINUX catch-22

Linux penguin

For some reason I used to think that Linux was destined to be a hot topic among embedded control developers, so I have been disappointed last summer, at the MASTERs (the 11th), when a couple of enthusiastic colleagues decided to try and offer a short class on Linux tools for Microchip products. The class was great, I learned a lot in that single hour and I came out with a great desire to learn more about developing code in Linux, but the attendance (statistics) turned out pretty discouraging.

Continue reading

Posted in Tools | Tagged | 3 Comments

Exploring the PIC32

Exploring the PIC32

PROGRAMMING 32-BIT MICROCONTROLLERS IN C

EXPLORING THE PIC32

(ISBN-10: 0750687096 ISBN-13: 978-0750687096)

It is out! I got the first printed copy today fedex-ed directly to my office from Elsevier.

Amazon should start stocking up quickly in the next few days…

Mind this is not a sequel to the Flying PIC24 book, but rather its alter ego in the 32-bit world. The book walks the reader through most of the same steps and exercises though everything looks similar and different at the same time… The underlying theme is the exploration of a new world and the final objective is that of learning gradually to trust a C compiler (MPLAB C32) and learn to use a new PIC with a brand new (MIPS) 32-bit core!

Does it look like a PIC? Does it feel like a PIC? How similar is the PIC32 to the PIC24, really? How fast can you port code from one to the other? Is it easier or harder to use? And most importantly, how much faster does it really run?

These are some of the questions I have tried to answer in the new book. I hope you will enjoy it!

Posted in PIC32 | Comments Off on Exploring the PIC32

Addictive Tools

 Of the many tools I have used in the recent years, while working on various embedded control projects, there is one that I have quickly learned to love: the INTRONIX Logic Port.

LogicPort

Now I am sure you have seen and possibly tested plenty  of USB based tools that rely on your PC to do the heavy lifting and promise to replace some expensive and bulky traditional oscilloscope, logic analyzer or meter for a fraction of the cost. Well I have tested my share, and while they all shine for their ingenuity and often they speak well about the creativity and good intentions of the designer, they all kind of fall short of delivering on their promise and definitely pale in comparison to the LogicPort!

The LogicPort is not the cheapest of the USB logic analyzers you can find online nowadays, nor the one with the fanciest plastic case, but it does work.  It does exactly what the brochure says it would and most importantly it does what an embedded control designer needs with an effective and intuitive interface.

I know that their use has spread inside the company like a virus, by word of mouth, or I should say by our constant borrowing of each other’s tools… that’s the way I learned about it in my turn… now you are warned it’s addictive!
P.S.: Jon, I promise, I will return it to you … one day!

Posted in Tools | 1 Comment