PSOC Designer 5.0 code porting

Cypress switched back to the ImageCraft compiler, and now we’re left with the task of fixing our existing codebase that was developed with the HiTech compiler.

Not too problematic. The only thing that bothers me a bit is the lack of good/up-to-date documentation. I spent an hour to figure our how to get the printf’s that I used in my code compiling again. Once you know how to do it, it is simple…

Example code:


printf("Test printf without parameters\n");

Compiling your HiTech code with the ImageCraft compiler, the printf fails with the following error:


type error in argument 1 to `printf'; found `pointer to __flash char' expected `pointer to char'

Seems that in for ImageCraft you need to use another printf function if the strings are in ROM. And this function is called… tada: cprintf.

Replace the existing printf with cprintf and you’re up and running again. I guess it would have need nice if this info was added to the ‘migrating from HiTech to ImageCraft’ document that is bundled with PSOC Designer. Maybe eventually, it will be…

Also notice: to get the ImageCraft printf functions working, you need to replace the ‘putch’ helper function for printf by:

// Helper function for the printf function.
int putchar(char c) {
 // Send characters to the Lantronix interface
 LTRX_PutChar(c);
 return 1;
}

Finally, if you fancy some more advanced printf functionality like modifiers, or support for long/float, you’ll need to update your ‘local.mk’ (‘Project’ -> open local.mk) and add the option

CODECOMPRESSOR:=$(CODECOMPRESSOR) -lfpm8c // For floating

CODECOMPRESSOR:=$(CODECOMPRESSOR) -llpm8c // For long support

Hope this helps you saving some time until the documentation gets updated!

Garmin simple text convertor script

I needed to test some XBee long-range radios. Hmm, how can we make this test useful and fun at the same time? Well, let’s put one end of the radio in the lab connected to a computer, and wander around with the other radio while transmitting the current position obtained from a GPS.

Using the XBee evaluation kit, my (t)rusty eTrex GPS, a 12V battery and some cables, the hardware was quickly in place. Now, what to transmit over the link? Full NMEA? Hmm, maybe this is a bit overkill. Sending the position once a second ought to be enough. But then I need a microcontroller between the GPS and the radio to reformat the NMEA into simple position beacons. There has to be an easier way…

Continue reading Garmin simple text convertor script

xPL enabled utility meter monitor

When built our house, we took measures to ensure that we would consume little energy to keep our place to live warm and cosy. For this, we added extra insulation, we kept the number of air leaks as small as possible, and added a ventilation system that recycles the energy from the extracted air into the fresh air that is brought into our home.
Continue reading xPL enabled utility meter monitor

UPS power consumption

Recently I migrated my home server (a Linksys NSLU2 a.k.a. ‘Slug’) to a more powerful device (Mac Mini). The Mini has more capabilities and hence will run more services. Time to invest in a UPS that will keep the computer running when the electricity grid goes down.

Since the power consumption of my home server is a major concern to me, I’m also interested in the extra power consumption generated by the UPS.

I was able to measure the power consumption of a MGE Ellipse 750. Power was measured with a Voltcraft Energy Check 3000 and the test load was a normal PC (note: not the Mac Mini!).

The result was: the setup consumes 76 Watt without UPS and 80.5 Watt with the UPS. Note that the batteries of the UPS were fully loaded when the measurement was done.

Setting the execute bit in SVN

When committing files to an SVN repository, it happens that I forget to set the proper ‘execute’ permission.

This results in problems when checking out a fresh working copy, as it seems that SVN does not take up a ‘chmod u+x’ on a file as a change when a commit is performed.

This is easily fixed: just do

$ svn propset svn:executable ON somescript

And then commit.

Self-powered wireless ambient light sensor

Since some time, the window blinds in our home are automatically controlled. When the sun rises they go up, at sunset they are closed.

To determine the correct time for the blind commands, I’ve written a mix of Perl scripts. There exists a handy Perl module to calculate sunrise/sunset based on the date and your location on earth. After some fiddling with the parameters, I have a setup that works rather good. However, the Perl module does not take into account the weather. On bright and cloudless days, the blinds can stay open a bit longer. When we’re on the other hand experiencing our typical North Sea autumn weather, they can safely be closed a bit earlier.

Enter some electronics 😉

Continue reading Self-powered wireless ambient light sensor

Site migrated to WordPress

The site has finally been updated to WordPress.

The Joomla CMS became too cumbersome for me to maintain. Joomla certainly is a flexible and powerful CMS, however, I found out that WordPress better suits my needs.

All content has been migrated. and most important direct Joomla links are being redirected.

In the mean time, the web service has been approved a no-www class B status.

class-b

Unroute a complete PCB in Eagle

Unrouting a complete PCB in Eagle means that all routed tracks on the board are reverted back into so-called ‘airwires’. Airwires are lines that show that there is a connection between 2 points on the board, but that no actual connection is routed yet.

Unrouting signals on a board is called ‘ripup’ in Eagle slang.

Continue reading Unroute a complete PCB in Eagle