Wow. Has it been four weeks?
Posted 2 Weeks Ago at 04:39 PM by Adrenalynn
Tough to believe it's been a month since I first got the XMOS plugged in. Things have been a little wild off-and-on, but I did have a chance to play with it a bit more, learning its architecture.
I had a bit of a challenge understanding the "pins/ports/banks" mapping of the XMOS initially, but Ross over at XMOSLinkers set me straight with this document . Page 129 is especially useful.
So once I had that pin mapping understanding, I was able to swipe the UART sample code, plug in an LCD that I hadn't ever had a chance to play with and bit bash some single-byte hex commands to it, and do a little "hello world" display.
Here's what it looked like [click once for larger legible image, twice for full-size]:
Since then, I've ported over some video algorithms and am really just waiting on a prototype board to come back and parts to come in. Alas, the memory and scan converter are both small SMT parts and don't take to just being slapped in a breadboard. Actually, parts and boards are probably in the mail box right now, I just haven't checked.
Really the learning curve on the XMOS hasn't been all that tough. There's always a little head-bumping-in-dark-caves when you endeavor to pick up a new architecture, and this one has been relatively painless/bruise-less. Even many of the apparent limitations can be relatively easily overcome - for example: you can do software emulated floats, but they can't be done in XC, and there are some limitations - tip to the wise: extern c. You can reference external ANSI C from the XC module, so the XC contains your main and then you can go off and do whatever it is you want to do in C, returning to your XC whatever external data you've generated. XC supports the extensions like par[rallel] and on-std-core[] for example.
Here's a stripped-down example of how one might talk to the LCD I was using. It's based entirely on the sample software uart code, just my LCD specifics merged in - but it does show how one maps to 1-bit ports and can extend the documentation referenced above. This simple example just autobauds the serial display, clears the screen, and sets the background to white:
So that's it for the moment. More as progress continues on the daughter card for video capture and buffer memory.
I had a bit of a challenge understanding the "pins/ports/banks" mapping of the XMOS initially, but Ross over at XMOSLinkers set me straight with this document . Page 129 is especially useful.

So once I had that pin mapping understanding, I was able to swipe the UART sample code, plug in an LCD that I hadn't ever had a chance to play with and bit bash some single-byte hex commands to it, and do a little "hello world" display.
Here's what it looked like [click once for larger legible image, twice for full-size]:
Since then, I've ported over some video algorithms and am really just waiting on a prototype board to come back and parts to come in. Alas, the memory and scan converter are both small SMT parts and don't take to just being slapped in a breadboard. Actually, parts and boards are probably in the mail box right now, I just haven't checked.
Really the learning curve on the XMOS hasn't been all that tough. There's always a little head-bumping-in-dark-caves when you endeavor to pick up a new architecture, and this one has been relatively painless/bruise-less. Even many of the apparent limitations can be relatively easily overcome - for example: you can do software emulated floats, but they can't be done in XC, and there are some limitations - tip to the wise: extern c. You can reference external ANSI C from the XC module, so the XC contains your main and then you can go off and do whatever it is you want to do in C, returning to your XC whatever external data you've generated. XC supports the extensions like par[rallel] and on-std-core[] for example.
Here's a stripped-down example of how one might talk to the LCD I was using. It's based entirely on the sample software uart code, just my LCD specifics merged in - but it does show how one maps to 1-bit ports and can extend the documentation referenced above. This simple example just autobauds the serial display, clears the screen, and sets the background to white:
Code:
#include <platform.h>
#define BIT_RATE 38400 //Baud = 38.4k
#define BIT_TIME XS1_TIMER_HZ / BIT_RATE
//BitBash to Pin D37 in Proto Area
on stdcore[0] : out port TXD = XS1_PORT_1N; //out port TXD = PORT_UART_TX;
void txByte(out port TXD, int byte);
int main(void)
{
txByte(TXD, 0x55); //Send the AutoBauding Character
txByte(TXD, 0x45); //CLS
txByte(TXD, 0x42); // Set Background to
txByte(TXD, 0xFF); // White LSB
txByte(TXD, 0xFF); // White MSB
return 0;
}
void txByte(out port TXD, int byte)
{
unsigned time;
timer t;
/* get initial time */
t :> time;
/* output start bit */
TXD <: 0;
time += BIT_TIME;
t when timerafter(time) :> void;
/* output data bits */
for (int i=0; i<8; i++)
{
TXD <: >> byte;
time += BIT_TIME;
t when timerafter(time) :> void;
}
/* output stop bit */
TXD <: 1;
time += BIT_TIME;
t when timerafter(time) :> void;
}
Tags: lcd programming, xc-2, xmos, xmos challenge
Total Comments 0
Comments
Total Trackbacks 0



