Site Network: Home | Portfolio | Essay and Reports | Sandbox | Wiki

Embedded Ethernet

Interfacing an AVR with an ubiquitous Ethernet network allows for a host of novel applications with embedded communications. The Microchip ENC28J60 makes the tedious job of building a network interface simple, using the 'Serial Peripheral Interface' (SPI) and requiring only 4 wires.

Read more...

Cameras in OpenGL

I had assumed that having a camera in a 3D-graphics system was fairly elementary, until looking into walking-through a scene with OpenGL. The system does not contain a ‘camera’ object, but requires the entire scene to be rotated to simulate a moving viewport.

Initially, this seems to be a convoluted solution to a simple problem, but it is almost certainly a performance issue. OpenGL using interactive (rather than Ray Traced) rendering needs a strong idea of where objects are with respect to the camera. If the camera were to be moved, it would be likely that the OpenGL system would have to rotate the whole scene to achieve the effect, and therefore is trying to be a little more transparent.

The GLu library provides a useful helper function gluLookAt(...) to calculate the transformation matrix which is all well and good. However, trying to achieve ‘common’ camera effects with this rough interface is a challenge, involving lots of vector algebra and nasty code.

I have created a C library which implements a Camera-like ‘object’ on top of the functionality provided by GLu. This is currently pre-beta and totally undocumented – an updated version should be available soon:

Comment

Good Documentation

I am not one for providing copious documentation within source code – especially when it is totally unnecessary. However, I do like to see complex structures and crazy little hacks statements are given a little qualification.

Today, trying to port a software library to the AVR family of microprocessors I came across a good one:

++((char *)uip_appdata);

The GCC compiler is understandably nervous about this one, and I’m still not sure what it actually means.

Suggestions on the back of a postcard please.

Comment

Compiling for AVR with GCC and *nix

The file system employed by *nix systems is far more comprehensible that either FAT32, NTFS or whatever Microsoft is promoting with Vista or Windows 7. One problem, however, is portability between Windows and *nix platforms.

I have just lost half a morning trying to compile some C code for an AVR on my MacBook – the compiler complaining that:

compiler.h:31:26: avr\signal.h: No such file or directory

compiler.h:31:27: avr\interrupt.h: No such file or directory

compiler.h:31:28: avr\io.h: No such file or directory

I know for a fact that these libraries exist and looking at the offending lines of code there is nothing obviously wrong:

#include <avr\signal.h>

#include <avr\interrupt.h>

#include <avr\io.h>

Then it seemed obvious: the path separator is the wrong way around – just another way for Windows to make my life difficult without having to touch it! Correcting it to:

#include <avr/signal.h>

#include <avr/interrupt.h>

#include <avr/io.h>

and the problem is fixed (expec signal.h is deprecated).

So much for code claiming to be tested on every platform, but then again what is to be expected of code that tries to redefined the keyword ISR?

Comment

Drawing a Sphere

I have spent the morning trying to draw a wireframe sphere, using OpenGL but without the standard glu_ and glut_ extensions. I now have a sphere with a very pleasant spiral pattern on it – just a shame watching it rotate makes my head hurt!

Comment

The Specification

Time and time again I tell clients that we need to work out and agree a detailed specification of the product to be delivered; normally met with a response of ‘oh just do what seems right.’

This is also the case with the coursework exercise that I’ve just been set of a module in Management – which I never really wanted to study anyway:

This should be answered in report style, with a clear introduction and conclusion. The answer should have a well written, well observed case study that includes the evidence you might draw upon in your analysis. I will be looking for:

A well chosen and relevant case study.

Clear analysis.

A link between your case and the stance you take in answering the question.

Tell me about the technology of the project/company and then provide an analysis of how accounting/finance may interact with the engineering/technological aspects of the case study.

A more vague description I’ve never seen.

Then again, what should we expect from a department that specialises in training managers…

Comment

Solving Puzzles

With a few days off before term starts I have decided to attempt a few of the Facebook developer puzzles. I shall be posting my solutions here shortly:

There’s some other puzzles too:

Comment