Parallel LCD Not Working?

Status
Not open for further replies.
But if you just give him working code what will
wuchy have learned ?
 
But if you just give him working code what will
wuchy have learned ?

Your right I think I'll just go back to writing code for myself and let these forums go. Just read and stop posting


Op it's dead simple

First you let the micro warm up with a delay

Then you set ES low delay it said 40 ns but just to get a hang of what's going on make it 10ms

Load your data port with the cmd a simple 0b00001111 will work

Strobe the E pin

give it a 20ms delay

Set the ES high

delay 10ms

Load the data port with your letter 0

delay 10 ms

strobe the E pin and the lcd will have a 0 on it.

now your code needs to stop and wait here if it loops you'll be lucky if you see it blink on and off
 
Your right I think I'll just go back to writing code for myself and let these forums go. Just read and stop posting

I feel that way a lot of times.

But teaching people to fish is better then giving them the fish.... right ?
 
Alright boys. Sorry for the delay. No pun intended. Crazy weekend. Ne who.

I am now able to initialize and put whatever I want on the screen...send it commands...blah blah...now I'm bored Time to make the LCD do something useful.

Thanks for all the posts. As always you guys rule.

Here is my code and a pic of it working. Hopefully someone can learn how to fish like I did


Code:
 #define LCD_E RB7_bit
 #define LCD_RW RB6_bit
 #define LCD_RS RB5_bit

void MicroStrobe(void);


void main() {

  ANSEL  = 0;                                    // Configure AN pins as digital
  ANSELH = 0;
  C1ON_bit = 0;                                  // Disable comparators
  C2ON_bit = 0;

  TRISA = 0x00;
  TRISB = 0x00;
  TRISC = 0x00;
  TRISD = 0x00;

  PORTA = 0x00;
  PORTB = 0x00;
  PORTC = 0x00;
  PORTD = 0x00;

  



  /**********      INITIALIZATION     ***************************/
  LCD_RW = 0;
  LCD_RS = 0;
  PORTA = 0b00110000;
  MicroStrobe();
  Delay_ms(10);

  PORTA = 0b00110000;
  MicroStrobe();
  Delay_us(125);

  PORTA = 0b00110000;
  MicroStrobe();
  Delay_us(125);

  PORTA = 0b00111000;                 //Function Set
  MicroStrobe();
  Delay_us(60);

  PORTA = 0b00001000;                 //Display off
  MicroStrobe();
  Delay_us(60);

  PORTA = 0b00000001;                 //Display Clear
  MicroStrobe();
  Delay_ms(2);

  PORTA = 0b00000110;                 //Entry mode set
  MicroStrobe();
  Delay_us(60);

  PORTA = 0b00001111;                 //turning display, cursor, and blink ON
  MicroStrobe();
  Delay_us(60);
  
  PORTA = 0b00000010;                 //return to home
  MicroStrobe();
  Delay_ms(2);
  

  /********************   displaying text   *************************/
  
  LCD_RS = 1;
  while(1){
  PORTA = 0b00110000;            //Code for a "0"
  MicroStrobe();

  
  PORTA = 0b00110001;            //Code for a "1"
  MicroStrobe();

  
  PORTA = 0b00110010;            //Code for a "2"
  MicroStrobe();

  
  PORTA = 0b00110011;            //Code for a "3"
  MicroStrobe();

  
  PORTA = 0b00110100;            //Code for a "4"
  MicroStrobe();

  PORTA = 0b00110101;            //Code for a "5"
  MicroStrobe();


  PORTA = 0b00110110;            //Code for a "6"
  MicroStrobe();


  PORTA = 0b00110111;            //Code for a "7"
  MicroStrobe();
  
  PORTA = 0b00111000;            //Code for a "8"
  MicroStrobe();
  
  PORTA = 0b00111001;            //Code for a "9"
  MicroStrobe();
  
  Delay_ms(1000);
  


  }
}

void MicroStrobe(void){
     LCD_E = 1;
     Delay_ms(1);
     LCD_E = 0;
     }
 

Attachments

  • IMG00063-20101213-1310.jpg
    1.6 MB · Views: 137
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…