Main Site Documentation

FEZ Domino to widescreen TV


#1

OK, I cheated a bit and used a TellyMate shield http://www.batsocks.co.uk/products/Shields/TellyMate%20Shield.htm but I was pleased when it just worked. Test code below; now to do something useful with it…

Andrew

using System;
using System.Threading;
using System.IO.Ports;
using System.Text;

using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;

using GHIElectronics.NETMF.FEZ;

namespace Domino___Serial {
    public class Program {
        static int counter = 0;
        public static void Main() {
            SerialPort UART = new SerialPort("COM1", 57600);
            UART.Open();
            while (true) {
                string comanda = "Counter: " + (counter++) + "\r";
                byte[] buffer = Encoding.UTF8.GetBytes(comanda);
                UART.Write(buffer, 0, buffer.Length);
                
                // Sleep for 0 milliseconds
                Thread.Sleep(00);
            }
        }

    }
}

#2

…and now to make the classic pong game :slight_smile:

What is cool about this is that you can use a USB joystick :wink:


#3

Probably not useful but it is one of my favourite programming exercises. I give you Conway’s Life:

I’ve uploaded the code here: http://code.tinyclr.com/project/303/conways-life-on-tv-with-fez-domino-and-tellymate/

I’m a bit sad at how slow it runs - it was a lot faster on the Arduino (see here: http://www.youtube.com/watch?v=Bsb930zd5As). Maybe I’m doing something obviously wrong in the code - I’ve only been writing C# a couple of days so it’s quite possible.

Andrew


#4

Looks good. To speed things up read about RLP.


#5

Oh yes, RLP speeds it up alright!

:slight_smile:

Now I think the bottleneck is the 57k6 serial connection to the TellyMate shield. I’ve done some optimization of how the characters are transferred but there might be more to be had.

UPDATE I’ve uploaded the code as a .zip file attachment here: http://code.tinyclr.com/project/303/conways-life-on-tv-with-fez-domino-and-tellymate/

Andrew


#6

Nice work for getting into RLP


#7

Very cool.

Just looking at your src, maybe the drawing routine could be adapted to do a whole row at a time or alternativly do a clear screen & home - before the draw and just ignore drawing blank spaces.


#8

I [italic]think[/italic] the current limiting factor speedwise is how fast you can send characters to the TellyMate shield - it’s official top speed is 57600 baud, which is 5760 characters a second. The grid is 38x25 which is 950 characters, therefore if they all change (so you have to display each one) the theoretical maximum refresh rate is 6 frames a second. Plus you have to send some control characters which adds even more bytes. Luckily in a typical Life generation far fewer than 100% of the cells change - this gives us some wiggle room for optimisations.

I hadn’t thought of CLS then only draw the non-blank cells - I’ll have to give it some thought.

Andrew