Richard, My LCD routines may give you some insight: They can be configured to use the busy flag or delays, and have other nice features. Cheers, Isaac Em 23/10/2015 15:16, Richard R. Pope escreveu: > Hello all, > Well I just hit another milestone. I am now using the busy flag=20 > instead of a delay loop. The busy flag won't vary no matter the speed of= =20 > the PIC. The delay loop is longer with lower clock speeds and shorter=20 > with higher clock speeds. Yeah! > Thanks, > rich! > > On 10/23/2015 5:24 AM, James Cameron wrote: >> Summary: in read_busy_flag you are switching the wrong TRIS >> >> That you removed the call to LCD_set_position and it worked suggests >> something that function does is wrong. >> >> Looking at that function, I'm puzzled by the first two lines; >> >> extern void LCD_set_position(unsigned char position) { >> unsigned int data; >> LCD_data =3D data; >> >> It doesn't seem necessary to write the uninitialised variable to the >> register. But it is probably harmless. >> >> Last thing in the function is to call read_busy_flag, a misnamed >> function because it does more than read, it loops until DB7 is >> true. >> >> Now since all bits in TRISD are cleared, and never set, the read of >> RD7 will fetch the output register bit only, which if it is LOW will >> loop at that point forever, but if it is HIGH will return from >> read_busy_flag prematurely, before the LCD has finished what you asked >> it to do. >> >> Perhaps you intended to modify TRISD instead of TRISA twice in >> read_busy_flag? >> >> --=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 .