Archive for February, 2012

Nuit Blanche 2012 a Montreal

Just got back from Nuit Blanche 2012 in Montreal.  It was an incredibly intense opening night for Art Souterrain as large groups of people streamed by Sound Post on their way from the Place Des Arts Metro Station.  Vraiment Superbe!

Code is Poetry

“Code is Poetry” is a tagline used by WordPress.  I have spent a lot of time over the last few weeks preparing to bring Sound Post up to Art Souterrain in Montreal.   However, one of the most beautiful things about the project is something that is not even seen.

The code listed below is running on the programmable integrated circuit (PIC) that monitors the sensors.  It is a very simple routine that  initializes the sensor objects and serial communications port, then reads the sensors every 2.5 seconds and sends the results to the main computer via a serial cable.

I think that it is simple and elegant.  BTW, this blog is written using WordPress.  The code is written in the internal ooPIC Multi-Language Compiler syntax.

// Sensor Readout v1.0

// Declare Objects

oA2D10 IR1 = New oA2D10;
oA2D10 IR2 = New oA2D10;
oA2D10 IR3 = New oA2D10;
oA2D10 IR4 = New oA2D10;
oA2D10 IR5 = New oA2D10;
oA2D10 IR6 = New oA2D10;

oInt irStat[5] = New oInt;
oNib X = New oNib;

oSerialPort Comm = New oSerialPort;

// Main Processing loop

Void Main(Void){

ooPIC.Delay = 5000;    // delay to reflash if needed
InitValues;                      // initialize objects

While(cvTrue){

ReadSensors;
XMitData;

ooPIC.Delay = 250;

} // while

}  // function

Void InitValues(Void)
{
IR1.IOLine = 1;
IR1.Operate = cvOn;
IR2.IOLine = 2;
IR2.Operate = cvOn;
IR3.IOLine = 3;
IR3.Operate = cvOn;
IR4.IOLine = 4;
IR4.Operate = cvOn;
IR5.IOLine = 5;
IR5.Operate = cvOn;
IR6.IOLine = 6;
IR6.Operate = cvOn;

Comm.Baud = cv19200;
Comm.Operate = 1;

}

Void ReadSensors(Void)
{

irStat[0] = IR1.Level;
irStat[1] = IR2.Level;
irStat[2] = IR3.Level;
irStat[3] = IR4.Level;
irStat[4] = IR5.Level;
irStat[5] = IR6.Level;

}

Void XMitData(Void)
{
Comm.Value = 2;      // stx

For (X = 0; X < 6 ; X++)
{

Comm.VString = Str$(irStat[X]);
Comm.Value = 9;

}

Comm.Value = 3;      // etx

}