Or simply (as a test) add 3-4 NOPs between each bit operation. That is easier and doesn't need any new variables or program logic. It will certainly remove all RMW issues apart from the very worst, that you should not see with a LCD module anyway... Jan-Erik. -----Ursprungligt meddelande----- Fr=E5n: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] F=F6r Isaa= c Marino Bavaresco Skickat: den 20 oktober 2015 15:37 Till: Microcontroller discussion list - Public. =C4mne: Re: [PIC]: Trying to get a 16F877A to talk to an LCD! Richard, Did you try to avoid RMW issues by using a shadow for the I/O ports? It is possible to have RMW issues if then pin loading capacitance is too high or with other mysterious conditions. Instead of BCFing or BSFing the pins, do that in a file register and then copy its value to the port. eg.: unsigned char ShadowPortA =3D 0x04; // EN starts disabled (1) .... PORTA =3D ShadowPortA; TRISA =3D 0x00; .... ShadowPortA &=3D ~0x04; // Set EN =3D 0 PORTA =3D ShadowPortA; .... ShadowPortA |=3D 0x04; // Set EN =3D 1 PORTA =3D ShadowPortA; Do not forget that both CMCON and ADCON1 must be set to 0x07. Cheers, Isaac Em 20/10/2015 11:08, Richard R. Pope escreveu: > Issac, > I tried setting ADCON1 to 6 and 7 to no avail. Next? > Thanks, > rich! > > On 10/20/2015 7:54 AM, Isaac Marino Bavaresco wrote: >> Richard, >> >> >> In this PIC for the analog inputs to be off, you must write 0x06 or=20 >> 0x07 to ADCON1, not 0x00. >> >> >> Cheers, >> >> Isaac >> >> >> Em 20/10/2015 10:15, Richard R. Pope escreveu: >>> Issac, >>> Nicola pointed this out and I changed CMCON from 0 to 7. There=20 >>> is still no activity on the en or r/s pins. Any more thoughts. >>> Thanks, >>> rich! >>> >>> On 10/20/2015 7:05 AM, Isaac Marino Bavaresco wrote: >>>> Richard, >>>> >>>> >>>> Did you turn off the analog comparators? >>>> If not, do that with CMCON =3D 7; >>>> >>>> If the comparators are not disabled, RA0 through RA3 become analog=20 >>>> and they are read always as '0'. >>>> That would create RMW problem if you change each bit individually,=20 >>>> because this PIC doesn't have LAT register. >>>> >>>> >>>> Cheers, >>>> >>>> Isaac >>>> >>>> >>>> Em 20/10/2015 09:36, Richard R. Pope escreveu: >>>>> Issac, >>>>> The problem is going to be in the configuration of the 16f877a= .. >>>>> There is no activity on the en or the r/s pins. Argh! I thought=20 >>>>> that this might be the problem. The clock is running. I have every=20 >>>>> reason to believe that the pins are not set for digital I/O. Here=20 >>>>> is the setup >>>>> statements: >>>>> TRISD =3D 0; >>>>> TRISA =3D 0; >>>>> ADCON0 =3D 0; >>>>> ADCON1 =3D 0; >>>>> CMCON =3D 0; >>>>> Any more thoughts on this? >>>>> Thanks, >>>>> -- http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/chang= e your membership options at http://mailman.mit.edu/mailman/listinfo/piclist --=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 .