XMOS XK-1, configuring to work with HD44780 LCD.
January 2, 2010
Well this is the first actual hardware I'm going to interface! (I tried with my color LCD.. but when that failed.. figured I should start a bit more simple)
The code is borrowed from a MIDI Synthesizer project, I just took out the LCD part, along with the buffer code. He was using the XC-1, which is just a 4-core version of the XK-1. The code should be fairly easy to implement, but I'm afraid I'm missing some of the basics when it comes to the XMOS pin usage. (I've gone through the tutorials and understand them for the most part)
Here's the code that was borrowed, I deleted everything besides:
lcd.xc / .xh
LCD is the LCD-protocol, with the pin numbers and such. Buffer is , well the buffer! And the Write is for the Strings/Chars.
Okay, well here's where I think my problem lies! He originally used XS1_PORT_8C, and also had onstdcore (which dedicates 1 of the 4 processors to the LCD. I'm afraid I've got the ports changed to the wrong ones?
// Adjust these to match how you wired the display up.
// I'm assuming you've got it all on one 8-bit port.
out port lcd_port = XS1_PORT_8A;
#define SHIFT_DATA 0 // LCD D4-D7 = PortC D2-D5
#define BIT_RS 0x10 // LCD RS = PortC D6
#define BIT_RW 0x20 // LCD R/W = PortC D7
#define BIT_E 0x40 // LCD E = PortC D8
If you look at the XK1 Hardware PDF, the pins are labled as XD0 - XD28 (or XDSomething), my connections are as stated:
XMOS // LCD
XD2 // D4 (data4)
XD3 // D5 (data5)
XD4 // D6 (data6)
XD5 // D7 (data7)
XD6 // RS (register shift)
XD7 // R/W (read/write)
XD8 // E (enable)
And I made a main.XC file and added: (I had made it a .c previously)
Compiles and uploads okay, but LCD never initializes. Anyone have any ideas? Hoping it's something simple, like mixed up pins! :D