Jan-Erik, The compiler doesn't like NOP; Any suggestions? Thanks, rich! On 10/20/2015 8:50 AM, Jan-Erik S=F6derholm wrote: > 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 Is= aac > 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 > --=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 .