I2C Developers Information.

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

Moderators: Henry, Mods

Post Reply
Henry
OMNIPRESENT
OMNIPRESENT
Posts: 2834
Joined: Tue Aug 14, 2001 6:00 pm
Contact:

I2C Developers Information.

Post by Henry » Thu Nov 28, 2002 11:35 am

Since there is a lot of questions about I2C in e-mails and on the forums, here is a small guide to help.

Q: How do I talk to the display?

A:
We use a standard Phillips 7bit address as defined by Phillips. How ever, we at Matrix Orbital specify the I2C address in 8bits. The 8th bit, least significant bit (LSB or Low Order Bit) of the 8bit address is read/write bit. If we take a standard Phillips 7bit address of 45hex this would be in binary 1000101. This is 7bits. If one adds the read write bit to this 7bit address and you assume that you are writing one gets 10001010. Matrix Orbital would describe the Philips I2C address of 45hex as 8Ahex. The read address would be 8Bhex.

Q: How do i read the keypad data?

A:
The keypad is read by I

Lovmy
LCD?
Posts: 1
Joined: Thu Mar 10, 2005 8:15 am

Problem with i2c controller PCF8584

Post by Lovmy » Fri Mar 11, 2005 2:11 am

Hello, sorry i don't speak very well English.

I have LCD2041, TTL and I2C MODE. J0 in, J1, J2, J3 OUT, adress i2c : 52H
To write to LCD i send:

Start 1 0 1 0 0 1 0 0 Ack 0 1 0 0 0 0 0 1 Ack Stop

To send A, but i have nothing on the display, and i have Ack error.

Can use i2c inferior has 100Kbs ?

What's the form of trame to send ?

LCD is slave or master I2C ?

Regards.

Tom
Matrix Orbital
Matrix Orbital
Posts: 1030
Joined: Mon Jul 19, 2004 4:43 pm
Location: Calgary
Contact:

Post by Tom » Fri Mar 11, 2005 10:54 am

Hi Lovmy,

Thank you for posting.

Looks like you are not getting an ACK because you are not sending the right address. Try sending 0 1 0 1 0 0 1 0 (0x52) .

You are capable of communicating at a maximum of 100Kbs.

The way to send data to the display is you send the address, then the command or text.

The LCD is always the slave.

The following link is a sample program of using I2C with the unit which can be helpful to you. viewtopic.php?t=2357&postdays=0&postord ... s&start=15

If you have anymore questions or concerns, please feel free to post.

Best Regards,
:D

tvoglund
LCD!
Posts: 13
Joined: Tue Sep 10, 2013 4:28 pm

Re: I2C Developers Information.

Post by tvoglund » Tue Sep 10, 2013 4:32 pm

I am new to programming I2C and the Orbital Matrix Display. I have the GLT240128-422-FGW Display and plan on writing to it using I2C protocall using C. I clicked on the link to the code above but found nothing. Can you please resend the link to the code?

Thanks for every ones help.

Tino
Matrix Orbital
Matrix Orbital
Posts: 158
Joined: Wed May 22, 2013 9:04 am
Location: Matrix Orbital
Contact:

Re: I2C Developers Information.

Post by Tino » Wed Sep 11, 2013 8:21 am

Hi tvoglund,

Here is a link to some application notes and a sample program written in C for I2C:
http://www.matrixorbital.ca/appnotes/i2c/

Also this link has a sample written by a member of the forum. You will find it within their post:
viewtopic.php?t=2357&postdays=0&postord ... s&start=15

The post is by RussCA.

If you have any other questions or concerns please feel free to let me know.
Thank you,
Martino
Martino DeLeon
Matrix Orbital
Technical Support Representative

tvoglund
LCD!
Posts: 13
Joined: Tue Sep 10, 2013 4:28 pm

Re: I2C Developers Information.

Post by tvoglund » Sun Sep 15, 2013 11:38 pm

Below is the code I have written to simply clear the display so the Matrix Orbital screen disappears when I power up. I am unable to communicate withe the LCD. Please give me any feed back of the code. It is in C. Currently, nothing happens when this code is compiled and loaded onto my pic.

U08 I2CClearDisplay(U08 nSensor)
{
//Make sure flag is clear
PIR3bits.SSP2IF = 0;

//Enable correct sensor
//Hard code this until working
//I2CEnableSensor(nSensor);
//this just changes the mux to point to the lcd
//Set bits to enable display and disable other devices
SENSOR_FLOW_EN = 0;
SENSOR_FILTER_EN = 0;
DISPLAY_EN = 1;

//Send start bit and wait for completion
SSP2CON2bits.SEN = 1;
if(I2CWaitComplete(I2C_TIMEOUT_BIT))
return(1);

//Write the address of the LCD using I2C
SSP2BUF = 0x80; //DISPLAY_HEADER; //this is address of the display I believe 80 check manual and create this variable in same location as SENSOR_HEADER
if(I2CWaitComplete(I2C_TIMEOUT_BYTE))
return(1);

SSP2BUF = 0xfe; //ddress of register to write to
if(I2CWaitComplete(I2C_TIMEOUT_BYTE))
return(1);

SSP2BUF = 0x58; //clear screen commnad
if(I2CWaitComplete(I2C_TIMEOUT_BYTE))
return(1);

//Then send stop command... figure this out
//Send stop bit and wait for completion
SSP2CON2bits.PEN = 1;
if(I2CWaitComplete(I2C_TIMEOUT_BIT))
return(1);

return(0);
}

U08 I2CWaitComplete(U16 nTimeout)
{
U16 nStart, nCurrent, nTimeElapsed;

//Get current starting time, read low byte first to latch upper
nStart = (U16) TMR0L;
nStart = nStart | (((U16) TMR0H) << 8);

//Each loop is 50 clock cycles, so it checks every 3us
while(1)
{
if(PIR3bits.SSP2IF)
{
//Complete, clear flag and return success
PIR3bits.SSP2IF = 0;
return(0);
}
else
{
//Get current time, read low byte first to latch upper
nCurrent = (U16) TMR0L;
nCurrent = nCurrent | (((U16) TMR0H) << 8);

//Calculate difference, taking wrap into account
if(nCurrent >= nStart)
nTimeElapsed = nCurrent - nStart;
else
nTimeElapsed = nCurrent + (0xFFFF - nStart);

//Compare time to timeout, return timeout error if past time
if(nTimeElapsed >= nTimeout)
return(1);
}
}

return(0);
}

Tino
Matrix Orbital
Matrix Orbital
Posts: 158
Joined: Wed May 22, 2013 9:04 am
Location: Matrix Orbital
Contact:

Re: I2C Developers Information.

Post by Tino » Mon Sep 16, 2013 10:32 am

tvoglund,

Before your display will communicate in I2C you must be sure to set the protocol jumpers to I2C. You will also need to connect a SDA and SCL lines to your display. In doing so you will need to solder to your PCB which will void your warranty.

When connected the display will send a NACK or ACK when trying to communicate to it.

If you have any other questions or concerns please feel free to ask.
Martino DeLeon
Matrix Orbital
Technical Support Representative

tvoglund
LCD!
Posts: 13
Joined: Tue Sep 10, 2013 4:28 pm

Re: I2C Developers Information.

Post by tvoglund » Mon Sep 16, 2013 7:30 pm

Thank you for your reply. I already have the I2c Jumpers set on the board. Is there any code errors in the logic above. I do not wait for Ack, should I after each command, my 254, then 88 should I wait for the Ack? Please look over code and see if you can see anything incorrect.

Tino
Matrix Orbital
Matrix Orbital
Posts: 158
Joined: Wed May 22, 2013 9:04 am
Location: Matrix Orbital
Contact:

Re: I2C Developers Information.

Post by Tino » Tue Sep 17, 2013 9:08 am

Hi tvoglund,

You dont necessarily have to wait for a ACK or NACK after each byte. Although if you do it will help you while debugging. Whereas when you receive the NACK you will then know where the error is.

Here is a link to the I2C standards manual which should help you along the way:
http://www.nxp.com/documents/user_manual/UM10204.pdf

We provide an easy to use display with a number of code examples, but unfortunately we do not debug customer code.

You can find these examples here:
http://www.matrixorbital.ca/appnotes/

If you have any other questions or concerns please feel free to ask.
Thank you,
Martino
Martino DeLeon
Matrix Orbital
Technical Support Representative

tvoglund
LCD!
Posts: 13
Joined: Tue Sep 10, 2013 4:28 pm

Re: I2C Developers Information.

Post by tvoglund » Thu Sep 19, 2013 5:37 pm

Seems like most forum articles I read, the address of the slave is always the issue. I am still unable to get the LCD to do anything, I am simply trying to clear the default Matrix Orbital landing page.

In the manual it states, "The display will now be in I²C mode and have a default slave address of 80, unless changed with the appropriate command". Ok, seems simple, is this a hex number or decimal number? Is this address bit shifted adding the r/w bit to lsb, or do I need to convert 80 to 0xA0 which would be bit shifted with LSB being 0 for a write command?

From the manual none of this is clear. I assume the slave address of 80 in the manual is decimal and has not been shifted adding the r/w bit to the lsb. But not really sure.

Tino
Matrix Orbital
Matrix Orbital
Posts: 158
Joined: Wed May 22, 2013 9:04 am
Location: Matrix Orbital
Contact:

Re: I2C Developers Information.

Post by Tino » Fri Sep 20, 2013 8:25 am

tvoglund,

Yes the slave address of 80 is in decimal. As default the display is set to have the slave address of 80, this will be your write address. The read address will set to 81.

Martino
Martino DeLeon
Matrix Orbital
Technical Support Representative

tvoglund
LCD!
Posts: 13
Joined: Tue Sep 10, 2013 4:28 pm

Re: I2C Developers Information.

Post by tvoglund » Thu Sep 26, 2013 11:24 pm

Martino,

In your manual you have a command to Initialize Label. You need to pass into this, Font and CharSpace. These are a byte each.

For Font is there any Fonts build in? Or what is the default value for this.
For CharSpace, what is it looking for, I know byte, but is there a default value? Or please more details on this

I guess, I was looking for more documentation on describing the input parameters for all the commands.

Thanks,

Truby

Tino
Matrix Orbital
Matrix Orbital
Posts: 158
Joined: Wed May 22, 2013 9:04 am
Location: Matrix Orbital
Contact:

Re: I2C Developers Information.

Post by Tino » Fri Sep 27, 2013 8:35 am

tvoglund,

Yes there are fonts loaded into your display as a default. They are loaded into ID 1 and 2.

For the character space this is the space you would like to have between characters. When setting labels I use a character spacing of 0 or 1, but you could use a larger space.

If you have any other questions please feel free to ask.
Thank you
Martino
Martino DeLeon
Matrix Orbital
Technical Support Representative

tvoglund
LCD!
Posts: 13
Joined: Tue Sep 10, 2013 4:28 pm

Re: I2C Developers Information.

Post by tvoglund » Mon Oct 07, 2013 3:02 pm

I am trying to read from Display and not having any success. My read address is 80 and write is 81. when I do following command sequence it locks up of I try to use 81. I am using touchpad mode.

[start][read address][A][READ DATA][NA][stop]


Any help would be great.

Truby

Tino
Matrix Orbital
Matrix Orbital
Posts: 158
Joined: Wed May 22, 2013 9:04 am
Location: Matrix Orbital
Contact:

Re: I2C Developers Information.

Post by Tino » Mon Oct 07, 2013 3:20 pm

tvoglund,

I am not sure as to what the commands you are sending. But please be sure to have the proper jumpers set in your "Protocol Selection Jumpers" at the rear of the display.

Also be sure to send the command "Transmission Protocol Select" to the display before sending any other commands to the display.

If you set Remember to on before you send this command then set it to off after you will set the display to remember the selection made. Causing the display to return data in I2C which in turn will enable you to read from the display.

You can find all the commands need and instructions in you manual here:
http://www.matrixorbital.ca/manuals/GLT ... /GLT240128

Also please refer to the "I2C Errata" in the above link.

If you haven't updated you firmware please do so using the Firmware upgrader found here:
http://www.matrixorbital.ca/software/GLT%20Series/

If you have any other questions or concerns please feel free to ask.
Thank you
Martino
Martino DeLeon
Matrix Orbital
Technical Support Representative

Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests