I2C Code with Dynamic C

I am having a bit an elementary problem. I got the I2C to work with my LCD, but now need to use the clear screen, set home, etc codes. These are given to me by matrix orbital in hex, in this form:

Changing the Startup Screen
Syntax 0xFE 0x40[chars]

Clear Screen
Syntax 0xFE 0x58

I have used the I2CWrite command to write text and Matrix gives some single hex numbers for backspace, clear, return, and new line, but the other functions have two hex numbers. I am wondering where I put those in my code, and what to enter as the char variables in the line.

I2CWrite(lcd_address, ??? (0 for just text is working), char, charLength)

Ok, I found a fix to half of the problem.

char MAX[10];

MAX[0]=0x58;
I2CWrite(lcd_address, 0xFE, MAX, 0x01);

and I get the right function out of the LCD. HOWEVER, I still dont know how to do things like call that hex code and follow it with chars, or something like setting the cursor position…

0xFE 0x47[col][row]

I dont know where I would put in the bracketed row/column number. I have tried sending the 0x47 hex code and then sending 2,2 but the cursor doesnt go there?

review your Lcd manual operation, the LCD position is not a x,y format… is a number the position (DDRAM address ):

LCD 2 Lines x 20

line 1 begin in 00h to 13h
line 2 begin in 40h to 53h

LCD 4 lines x 20

line 1 begin in 00h - 13h
line 2 begin in 40h - 53h
line 3 begin in 14h - 57h
line 4 begin in 54h - 67h

this is for control a HD44780-based Character-LCD

regards

No where in the data sheet does it reference the hitachi controller. Its a Matrix Oribtal VK202-25. I didnt just make that command up, this is how the manual says to address a position on the screen.

0xFE 0x47[col][row]

And that is how most everything is formatted, I just dont know how to send the data in the brackets the right way?