-1
\$\begingroup\$

This is my LCD command can anyone know how to fix this and add busy flag void lcdinit() {
delay(100);

    command(0x01);// clear display screen
delay(500); 

    command(0x38);// 2 lines, 5X7 matrix
delay(500);

    command(0x06);// increment cursor
delay(500);

    command(0x0c);// display on, cursor off
delay(500);
delay(500);
delay(500);

}

void command(unsigned char x) { lcd=x; rs=0; en=1; delay(10); en=0; delay(20); }

void data1(unsigned char x) { lcd=x; rs=1; en=1; delay(10); en=0; delay(20); }

void lcd_write(char *p,unsigned char x) { int hj=0; if(x!='0') command(x);

 while(p[hj]!='\0')
 {  

  data1(p[hj]);
  hj++;
 }

} How can i fix this error "[HD44780] Controller received data whilst busy. [LCD1]
" and it's also shows the "controll received command whilst busy"

Source code

How can i fix this error "[HD44780] Controller received data whilst busy. [LCD1] " and it's also shows the "controll received command whilst busy" Please help me to fix this issue

\$\endgroup\$
8
  • 1
    \$\begingroup\$ Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. \$\endgroup\$
    – Community Bot
    Commented Sep 22, 2021 at 8:17
  • 2
    \$\begingroup\$ Please post the code in your question, not in your Google drive. To apply the code formatting select it and use the {} code formatting button to format it. Make sure it is indented correctly. Cropping your screengrab to the relevant part would help too. \$\endgroup\$
    – Transistor
    Commented Sep 22, 2021 at 8:21
  • \$\begingroup\$ You need to check the READY/BUSY status before sending data/command to the LCD. \$\endgroup\$
    – jay
    Commented Sep 22, 2021 at 17:20
  • \$\begingroup\$ If you cannot check the busy flag, you need to wait a bit before writing the next command or data. Delays are commonly documented in the data sheet. \$\endgroup\$ Commented Sep 23, 2021 at 8:53
  • \$\begingroup\$ Thank you @jay . It means this code will work on physically and this busy flag raise because of simulation problem. If not can you edit the code and re upload. Because it very much helpful to me \$\endgroup\$ Commented Sep 25, 2021 at 3:10

1 Answer 1

0
\$\begingroup\$

[HD44780] Controller received data whilst busy. [LCD1]

Datasheet:

  1. page 8:DB7 can be used as a busy flag.
  2. page 9: Busy Flag (BF) When the busy flag is 1, the HD44780U is in the internal operation mode, and the next instruction will not be accepted. When RS = 0 and R/W = 1 (Table 1), the busy flag is output to DB7. The next instruction must be written after ensuring that the busy flag is 0.
  3. Table 1:Register Selection
    RS R/W Operation
    0 1 Read busy flag (DB7) and address counter (DB0 to DB6)
  4. page 22: Interfacing to the MPU
    The busy flag must be checked (one instruction) after the 4-bit data has been transferred twice. Two more 4-bit operations then transfer the busy flag and address counter data.
  5. page 23: Initializing by Internal Reset Circuit
    The busy flag (BF) is kept in the busy state until the initialization ends (BF = 1). The busy state lasts for 10 ms after V CC rises to 4.5 V
  6. page 24: When an instruction is being executed for internal operation, no instruction other than the busy flag/address read instruction can be executed.
    Because the busy flag is set to 1 while an instruction is being executed, check it to make sure it is 0 before sending another instruction from the MPU.
    Note: Be sure the HD44780U is not in the busy state (BF = 0) before sending an instruction from the MPU to the HD44780U. If an instruction is sent without checking the busy flag, the time between the first instruction and next instruction will take much longer than the instruction time itself. Refer to Table 6 for the list of each instruction execution time.
  7. page27: Function Set
    Note: Perform the function at the head of the program before executing any instructions (except for the read busy flag and address instruction).
  8. page 29: Read Busy Flag and Address
    Read busy flag and address reads the busy flag (BF) indicating that the system is now internally operating on a previously received instruction. If BF is 1, the internal operation is in progress. The next instruction will not be accepted until BF is reset to 0. Check the BF status before the next write operation. At the same time, the value of the address counter in binary AAAAAAA is read out. This address counter is used by both CG and DDRAM addresses, and its value is determined by the previous instruction. The address contents are the same as for instructions set CGRAM address and set DDRAM address.
\$\endgroup\$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.