Hi! 16-Mar-98 13:27 Steve Lawther wrote about "Re: Problem reading from LCD in 4 bit mode": >> Brain, >> Try the changes below - you read the data out of the LCD when E is >> asserted >> >> Steve Lawther >> >> >> Read_Data >> call Wait_Busy ;wait for LCD=20 >> bsf STATUS, RP0 ; Select Register page 1=20 >> movlw 0xF0 ; Set port to input >> iorwf LCD_DATA_TRIS,W ; Only set upper half of port=20 >> movwf LCD_DATA_TRIS >> bcf STATUS, RP0 ; Select Register page 0 >> bsf LCD_CNTL, RS ; Set LCD for Data mode=20 >> bsf LCD_CNTL, R_W ; Setup to read >> bsf LCD_CNTL, E ;toggle E for LCD=20 >> nop >> movf LCD_DATA, W ;******** >> bcf LCD_CNTL, E >> ;not here movf LCD_DATA, W ; Read upper=20 >> nibble data andlw 0xF0 ; Mask out=20 >> lower nibble movwf Temp >> bsf LCD_CNTL, E ;toggle E for LCD=20 >> nop >> swapf LCD_DATA, W ;********** >> bcf LCD_CNTL, E ..... Yes, Brian, it was the capacitance. After "BCF LCD_CNTL,E" the LCD's became hi-Z (and PIC's pins was hi-Z). So, you read "the memory cells made of cable capacitance etc." :). And this "cells" are discharged by LCD's pull-ups. This is not a specific problem of 4-bit mode. Steve insert NOP's after BSF LCD_CNTL,E. These *may* be unnecessary. Using short cable 4MHz PIC and LCD (I'd use 4-bit mode too) work without these NOP's according to datasheet and experiment. But when the cable length is about 30..50cm or greater (I mean usual ribbon cable) LCD's outputs can't drive long cable's capacitance and need extra time to recharge it. NOP's provide this time. Of course, these effects occurs only while reading LCD. AFAIK many people don't read LCD at all (including BUSY flag). -- Vladimir M. Klochko