hi all
I am using AT91SAM7S64 to interface with 128x64 graphical lcd (monochrome),i am able to initialize the LCD and write dat into it but i have some problem in it like if the column address is incremented the data should print on the column address passed but i dont get it printed on the column which i pass into the function the code i am writing it down to make it clear
SEL_CS2(0); // chip slect second controller SEL_CS1(0); //chip select controller one LCD_COMMAND(PAGE_ADDRESS ); //passing the page address(0xB8)
LCD_COMMAND(COLUMN_ADDRESS + 15); //passing the column address (0x40 + 15) LCD_WRITE_DATA(0xFF);
the output of this code is the 0xFF is printed on the 15 line of the lcd but if i increment the count to 16 from 15 then i get the 0xFF printed on the 0x40 address of the column i dont know how it prints i am not able to print any data according to my column address .
void LCD_COMMAND(int set) { DATA_INST(LOW); //D/I pin low LCD_COMMAND_SEND(set); //data into port ENABLE_SIGNAL(LOW); //enable low delay_1ms(5); //delay 5milisec ENABLE_SIGNAL(HIGH); // enable high
}
void LCD_WRITE_DATA(char lcd_char) { DATA_INST(HIGH); //D/I pin high LCD_COMMAND_SEND((int)lcd_char); ENABLE_SIGNAL(LOW); //enable pin low delay_1ms(5); //delay 5milisec ENABLE_SIGNAL(HIGH); //enable pin high }
can any one help me to solve this problem ,wil be very helpfull to me to solve all the problems
Thanks Suresh
www.danlhenry.com/.../keil_code.png
SEL_CS2(0); // chip slect second controller SEL_CS1(0); //chip select controller one LCD_COMMAND(PAGE_ADDRESS ); //passing the page address(0xB8) LCD_COMMAND(COLUMN_ADDRESS + 15); //passing the column address (0x40 + 15) LCD_WRITE_DATA(0xFF);
void LCD_COMMAND(int set) { DATA_INST(LOW); //D/I pin low LCD_COMMAND_SEND(set); //data into port ENABLE_SIGNAL(LOW); //enable low delay_1ms(5); //delay 5milisec ENABLE_SIGNAL(HIGH); // enable high } void LCD_WRITE_DATA(char lcd_char) { DATA_INST(HIGH); //D/I pin high LCD_COMMAND_SEND((int)lcd_char); ENABLE_SIGNAL(LOW); //enable pin low delay_1ms(5); //delay 5milisec ENABLE_SIGNAL(HIGH); //enable pin high }
Is that how you indent code? Did it look ok in the preview?
delay_1ms(5); //delay 5milisec
How will your code improve by having a comment that 100% duplicates the command? Shouldn't the comment instead explain why you need a 5ms delay?
ENABLE_SIGNAL(LOW); //enable low
I could probably not have guessed that the instruction changed an enable signal to low, without the comment :)
However, what I can't see from neither instruction, nor comment, is what happens when you draw the signal low. Does the display gets enabled? Does it get disabled? Does it latch any received data?
DATA_INST(HIGH); //D/I pin high
So what does it mean to put D/I pin high? Neither instruction, nor comment gives any information about that.
Why not several functions:
SelectDataMode(); SelectCommandMode();
or a single function with a parameter:
SetDisplayMode(CM_DATA); SetDisplayMode(CM_INSTRUCTIONS);
Wouldn't that make the code easier to read - without requiring the user to have access to the datasheet?