Let's Make Robots!

XMOS XK-1, configuring to work with HD44780 LCD.

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[2] (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)

#include <xs1.h>
#include <platform.h>

#include "lcd.xh"

int main()
    return 0;

Compiles and uploads okay, but LCD never initializes.  Anyone have any ideas? Hoping it's something simple, like mixed up pins! :D

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
CaptainObvious's picture

Well, it's not the HD44780 LCD, but that does work.. just not as exciting! Check these out! I've converted these to a .c file with the bmpdump.exe program supplied with the example code (here: http://www.xcore.com/projects/nokia-6100-display-driver-pcf8833-controller)

Here's a link to my page if you want big pictures:






This ones a bit blurry.. :/





CaptainObvious's picture

Yeah, I just tested the hardware.. since I'm using an IDE cable, when I try with just cycling the LEDs, works like expected. And I tested all the ports that were being used.. when I used them in a sketch with LED's setup through transistors and such, each port was correct.

So I'm lost again, I thought for sure it was the IDE cable. I was using the ports right at least! Well damn, I didn't check the 8 bit code, since it uses 8 pins on 1 port. That's for another night.. lol

CaptainObvious's picture

Yeah I forgot about the XK1 pins being backwards, I have the most updated PDF so I hope that parts fixed. The 5v and Ground are in the correct place, I know that much! I've based the rest of how I hook it up with where the 5v and ground is connected.


voodoobot's picture

Yeah, that should be correct then, I verified a couple of the pins and the power pins after the doc was corrected.

hrmm....other ideas....

CaptainObvious's picture

Bah hum bug.. :/

I tried the 8-bit mode.. which is a hell of a pain to setup!All code borrowed from here:


That was a no go.. I also tried to edit in the changes you suggested Voodoo, I don't get errors, so I'm able to upload it and run it.. but it doesn't display anything.


I'm starting to think it's a mental issue. lol :) From what I've read.. I've got it connected right.. I KNOW the LCD works.. I can plug it into my Arduino and works perfectly. I'm still worried it's how I have the ports set up.. but I've tried and tried again, even re-wired the setup a few times.. I feel like I'm starting to experiment with LCD's on the first time again! Going through every possible situation that can make it NOT work.. and have it be simple like forgetting the contrast potentiometer! (Haha, I didn't forget it! :))

All of the code I've found so far is based on other boards such as the XC-1.. or XC-2.. so I'm wondering if it's problems with the incorrct port names.. or just a simple user error all along.

voodoobot's picture

well, what about this, try hooking up transistors(base) to the output pins and set them up to light an led on signal. Iusually do that to make sure that I'm getting a signal out...

you could also hook it up to a parallel input counter chip and see the results of that hooked up to leds as well.

 I know there is a lot of code based on the other boards, but we still have a board that should work in similar fashion.The two lines that we looked at should have worked....

I think it's something that we're missing....what though, I don't know.  :)


further testing could be done to make sure that you are connected to the correct pins...hook each one to an led and verify that it is the pin you think it is....you do have the updated manual, right??  :) there was that issue with the pin layout being opposite of what it was stated in the manual for the xk-1.

voodoobot's picture

Heya CO,


I modified the lcd.xc file and changed the following lines. no error when I compiled.

//on stdcore[2] : out port lcd_port = XS1_PORT_8C;

on stdcore[0] : out port lcd_port = XS1_PORT_8A;

//#define MILLISECS (1000 * XS1_REFERENCE_MHZ)

#define MILLISECS (1000 * XS1_TIMER_HZ)// not sure about this line but was unable to find anything close to xs1 ref mhz.