Interfacing to LCDs with Samsung KS0066 controller

rixterrixter Posts: 95

My search of a couple of past forum discussions didn't find a solution for interfacing the BASIC Stamp to an LCD unit that utilizes the Samsung KS0066 controller. Actually what I have is a 4x40 parallel LCD (CM404-1), with two of these controllers (one for each of 2x40 segments). I've successfully gotten the Stamp to communicate with a similar 4x40 LCD that uses the more common Hitachi HD44780 controller, but the same code does not apply. As "compatible" as they may be stated as being, there appears to be some differences. My Research found a datasheet for the KS0066 and it is in there that I learned that the initialization sequence is a bit different. But I am still failing to get anything but garbage to print on the display. The problem seems to be that it is not successfully getting the command to switch to 4 bit mode, the method that I am using for the other LCD as well. What I DO get is the screen to clear and a cursor in the upper left corner. I can even send LCDOUT commands to move the cursor across the screen. My suspicion is that because these commands are lower in value (on the LSB side of a byte), that I'm only successful with them because the MSB nibble is getting chopped off. The controller appears to still be looking for an 8 bit instruction instead of two 4 bit instructions. Determining the correct pinouts was another challenge as they were not stated as correct on the company's website. It is always possible that my 4 data line pins are not 100% correct, but I get nothing when I install them where several datasheets say to connect them. I'm thinking I wouldn't be able to execute cursor movement commands if my data lines were incorrect.

I've had good success with serial LCDs, but cannot find them in 4x40 size. If the packages were smaller, I'd contemplate sitting two 4x20 side by side, but the circuit boards and bezels on the LCD keep the actual displays from lining up close to one another.

I'd like to know if anyone has had success with this controller and what the trick was. I seem to be getting real close to getting it to work, but need that extra piece of information that I'm not seeming to come up with as yet. It powers up fine, I get the two dark lines on lines 1 and 3 and I have the contrast POT working fine. LCDOUT commands can produce results, but they are random characters, but consistent in each experiment.

Any advice appreciated.




  • 2 Comments sorted by Date Added Votes
  • rixterrixter Posts: 95
    edited March 2010 Vote Up0Vote Down

    I figured this situation out with continued diligence. As it turns out, the initializing sequence difference between the Samsumg KS0066 and the Hitachi HD44780 was not the issue. In fact the initialization sequence for the Hitachi works on the Samsung controller. What was completely different was the pinouts as compared with any documented 4x40 LCD I could find. Generally speaking, LCDs with fewer than 80 characters have the data pins starting at pin #1 and the LCDs with less than 80 characters have the power and ground connections starting at pin #1. This particular LCD is odd in that it starts out like a <80 character display with ground and power at pins 1 & 2, but the data lines start at pin #8. What helped was knowing that I had partial success and that getting control commands to work meant I was either sending partial commands or RS was not getting to the LCD. Add to that the fact that the second controller was not responding, I know I could have had up to three pin connections wrong. As it turned out, Enable #2 was in the wrong position and all of the four data lines were shifted by one position.

    All is well that ends well.

Sign In or Register to comment.