James, I just finished installing the LEDs. I increased wait(); to about 2=20 seconds instead of about 20ms. The e line goes high and low. The r/w=20 line goes high and low. The r/s line never goes high. Can I zip the code=20 and put it into pastebin? I have never used it before. We could go=20 private but then others will miss out on what we are doing here. Thanks, rich! On 10/23/2015 1:14 AM, James Cameron wrote: > Thanks. > > The LCD might not be properly initialised for communication, yet it > might still have a flashing or movable cursor? > > Is the PIC moving the cursor, or is the LCD doing it alone? > > I'm looking through a peephole at your code. My experience is better > suited to looking at all the code. Is there some reason you can't > share all the code each time? Too big? Use a GitHub Gist, or a > Pastebin and share the link by mail? > > Removing the check for busy doesn't sound like a good idea; if you > send anything while it is busy, it has the right to ignore you. > > The symptom you describe sounds like it is ignoring you. > > https://en.wikipedia.org/wiki/Pastebin > > On Thu, Oct 22, 2015 at 09:54:48PM -0500, Richard R. Pope wrote: >> James, >> I have never doubted your abilities and I have a lot of respect fo= r >> you and David. I have a flashing cursor on the LCD. I can also move the >> cursor around on the LCD. That is how I know that the LCD has been >> properly initialized. I have two o-scopes but I never thought of LEDs. >> I'm going to install the LEDs. That is a great idea. Here is what I am >> doing in main: >> lcd_initialize(i); //Initialize the LCD >> >> LCD_set_position(3); //move the cursor to the third position >> LCD_send_char('a'); >> //LCD_send_string("Hello!"); >> /*LCD_clear(); */ >> This is the routine to actually send the character >> to the LCD: >> extern void >> LCD_send_char(char char_) >> { >> //unsigned char character; >> //character =3D char_; >> LCD_data =3D char_; >> LCD_e =3D 1; //pulse the enable line >> //LCD_Send_data(character); >> wait_ms(5); //wait_ms for 5 milliseconds (us) >> LCD_e =3D 0; >> wait_ms(10); >> //read_busy_flag(); //wait for the LCD to finish >> } >> The commented out lines are where I have tried >> different ways of doing this. All to no avail. When I originally wrote >> this it was for a 16f84a. It ran on that PIC. But I have not been able >> to get it to work on this PIC. >> Thanks, >> rich! >> >> On 10/22/2015 9:17 PM, James Cameron wrote: >>> How are you assessing correct initialisation of the LCD? >>> >>> By "can't send" you mean the data is not displayed despite your >>> program sending it? >>> >>> Have you evidence, external to the PIC, to prove data is being sent? >>> >>> Probe the lines using whatever you have. I don't recall what >>> instruments you have, but I would use a logic sniffer, storage >>> oscilloscope, or LEDs. That will help you isolate likely causes. >>> >>> I also wonder if the LCD is busy after initialise, and how you are >>> checking if it is busy, and whether you are delaying the data until >>> the LCD says it is not busy. >>> >>> Yes, I've used LCDs with PICs before. >>> >>> On Thu, Oct 22, 2015 at 08:57:38PM -0500, Richard R. Pope wrote: >>>> David, >>>> This is how they are defined. It is LATxn, where x is the po= rt >>>> and n is the bit number. Such as: LATA0 for RA0. I still can't send da= ta >>>> to the LCD but all of my warnings went away and the LCD does initializ= e >>>> correctly. >>>> Thanks, >>>> rich! >>>> >>>> On 10/22/2015 8:47 PM, David Duffy (AVD) wrote: >>>>> Shouldn't those defines be: >>>>> >>>>> #define LCD_rs LATAbits.RA0 //Pin 2 LCD pin 4 >>>>> #define LCD_rw LATAbits.RA1 //Pin 3 LCD pin 5 >>>>> #define LCD_e LATAbits.RA2 //Pin 4 LCD pin 6 >>>>> >>>>> David... >>>>> >>>>> On 23/10/2015 11:32 AM, Richard R. Pope wrote: >>>>>> David, >>>>>> Sure. Here is the cmd and the data routines: >>>>>> extern void LCD_Send_cmd(unsigned c= har value) >>>>>> { >>>>>> LCD_data =3D value; >>>>>> LCD_rs =3D 0; >>>>>> LCD_rw =3D 0; >>>>>> LCD_e =3D 1; >>>>>> wait_ms(30); >>>>>> LCD_e =3D 0; >>>>>> } >>>>>> >>>>>> extern void LCD_Send_data(unsigned c= har value) >>>>>> { >>>>>> LCD_data =3D value; >>>>>> LCD_rs =3D 1; >>>>>> LCD_rw =3D 0; >>>>>> LCD_e =3D 1; >>>>>> wait_ms(30); >>>>>> LCD_e =3D 0; >>>>>> } >>>>>> You call them for sending either cmds or data to the LCD. T= he >>>>>> initialize routine uses the cmd routine. Feel free to ask whatever >>>>>> questions you think are necessary. I appreciate the help! >>>>>> Thanks, >>>>>> rich! >>>>>> >>>>>> On 10/22/2015 8:18 PM, David Duffy (AVD) wrote: >>>>>>> Can you give me a few lines of how you're using them in the code? >>>>>>> >>>>>>> On 23/10/2015 11:01 AM, Richard R. Pope wrote: >>>>>>>> David, >>>>>>>> Here are the pins used. >>>>>>>> #define LCD_rs RA0 //Pin = 2 LCD pin 4 >>>>>>>> #define LCD_rw RA1 //Pin 3= LCD pin 5 >>>>>>>> #define LCD_e RA2 //Pin = 4 LCD pin 6 >>>>>>>> #define LCD_data LATAD 19-22 and pins 27= -30 >>>>>>>> Notice that LATAD works with the LCD_data definition! I= don't get it. >>>>>>>> Thanks, >>>>>>>> rich! >>>>>>>> >>>>>>>> On 10/22/2015 7:45 PM, David Duffy (AVD) wrote: >>>>>>>>> Ah.... I hadn't been playing along. :) >>>>>>>>> >>>>>>>>> So, what actual port pin is RS on ? >>>>>>>>> David... >>>>>>>>> >>>>>>>>> On 23/10/2015 10:08 AM, Richard R. Pope wrote: >>>>>>>>>> David, >>>>>>>>>> Let's try this again. I decided to use a 18f4550 in= stead of the >>>>>>>>>> 16f877a. Sorry about that. The PIC and LCD initialize but I can'= t get >>>>>>>>>> the LCD to accept and display any data such as a or b or hello t= here and >>>>>>>>>> so forth. I have been discussing the 4550 all along and you were= under >>>>>>>>>> the impression that I was using a 877. My fault. >>>>>>>>>> >>>> >> --=20 >> --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .