If some one could check my code maybe i am using a function wrong or something but i am almost willing to bet that the timing of the pins high low states are correct, then again they may not be but i'll keep testing it to see. I had to use the nop() function for speed reasons and i had to set the pins i/o using PORTs.
Another question is has anyone ever used this and if so do i have to use the instruction "set display on/off", do i have to initially set the y address? Or should all i have to do is send data and it draws a line?
Yes i know there's a library for this for the arduino how ever i want to actually create the software instead of using some one else's and i have a hard time reading header files people make so that's why i am not using the lib as reference but it looks like i may have to, to see what that person did to get the lcd to work.
- Code: Select all | TOGGLE FULL SIZE
void setup(){
delay(3000);
DDRD = DDRD | B11111100;//pins 0-7
PORTD = B10101100;
DDRB = DDRB | B00011111;//pins 8-13 and crystal
PORTB = B00000000;
funcdatw();
}
void funcdatw(){
PORTD = B01101100;//after setup set e low
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");//delay 310 ns
PORTD = B01011000;//set rw, cs1 low rs high
__asm__("nop\n\t""nop\n\t""nop\n\t");//delay 140 ns
PORTD = B11011000;//set e high
PORTB = B00111111;//set the dat pins
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t");//delay tdsu 200
PORTD = B01011000;//set e low
__asm__("nop\n\t");//delay tdhw 10 ns for address and data hold time
PORTD = B01101100;//set everything back to setup standards except e
PORTB = B00000000;//^
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t");//delay before e goes high
PORTD = B11101100;
}
void loop(){
}