LK404-55 PIC CPU and Proton+ compiler by Crownhill

LK/ELK/VK/PK/OK/MX/GLK/EGLK/GVK/GLT Series

Moderators: Henry, Mods

Post Reply
glenlivet
LCD?
Posts: 2
Joined: Mon Nov 22, 2004 8:44 pm

LK404-55 PIC CPU and Proton+ compiler by Crownhill

Post by glenlivet »

Has anyone had any experience using the LK404-55 with a PIC microcontroller (18F458) and the Proton+ PIC Basic compiler from Crownhill? I'm ripping my hair out so any suggestions would be greatfully appreciated!
I'm using the LK404-55 in the I2C bus mode. The PIC uController has built in MSSP circuitry and application specific pins for I2C communication. Pin RC3 is the SCL line and the pin RC4 is the SDA line. No problem so far.... I'm also using the Proton+ PIC Basic compiler from Crownhill. A great product( I hope ). The compiler has an HBUSOUT and an HBUSIN command to comminicate with I2C devices.

The HBUSOUT command structure is:
HBUSOUT Control, Address, [variable, variable...]
Where: Control=0 to write, 1 to read, Address is the 7-bit address of the I2C device, in the case of the LK404-55 display it is 0x45. The HBUSOUT command adds the 0 or 1 LSB to the 7-bit address for R/W, and the "clear display" command string is 0xFE, 0x58

So the command to the LK404-55 to write a "clear display" command should be:
HBUSOUT 0,$45,[$FE, $58] right??
Wrong!!!! What happens is that an upper case 'X' is written to the col1, row1 position of the dispaly as $58 is an uppercase ASCII 'X'. I then discovered that any command string writes whatever ASCII character follows the $FE address provided that it is implimented in the display. I then tried rewriting the command using the 8-bit address of the LK404-55 which is 0x8A.
The new command string is:
HBUSOUT $8A, $FE, [$58]
The same thing happens as before... Can I not see the forest for the trees?
Tom
Matrix Orbital
Matrix Orbital
Posts: 1030
Joined: Mon Jul 19, 2004 4:43 pm
Location: Calgary
Contact:

Post by Tom »

Hi,

Well I know this code isn't written in the basic programming that you are using. It is in c programming instead, but the idea is the same. The code is a good example of using the I2C interface. The link is at http://www.lcdforums.com/forums/viewtop ... c&start=15.

I hope this helps.

:D
Best Regards,
glenlivet
LCD?
Posts: 2
Joined: Mon Nov 22, 2004 8:44 pm

Problem Solved

Post by glenlivet »

I solved the I2C communication problem totally by accident!!!! In a fit of total frustration I inadvertantly entered the command byte twice, compiled it and viola! It worked like it was supposed to...
So for example, the command line to clear the display is: HBUSOUT 0,$45, [$FE,$FE,$58]
No fancy programming saavy- I totally stepped in it!
I'm posting the fix in the off chance some other poor slob who ends up dealing with the same hardware configuration won't have to be tortured as I was.
Miles
Matrix Orbital
Matrix Orbital
Posts: 1105
Joined: Mon Mar 04, 2002 4:00 pm

Post by Miles »

It appears that it uses the format "Address-Byte-Byte" when sending I2C. Similar to the Basic Atom, it "assumes" that you are talking to a memory device and that extra byte is needed. Some development boards have the ability to configure the bytes sent, so only one byte after the address of the device is sent ("Address-Byte"). It appears that the Basic Atom needs another byte and that's the byte needed. Can you try sending a different byte. Give this a try and let me know how it works!! :)
Miles Y.
Head of Technical Support
Product Manager
Matrix Orbital
Post Reply