Am I reading the busy flag correctly?

So based on HD44780 datasheet, I need to read the busy flag to prevent interruption on the current transfer of data. I implemented the busy flag check, but I am not sure whether I am getting the correct value i.e “1” when lcd is busy and “0” when it isn’t.

void send_data(uint8_t pData)
{
	while(read_busyflag == 1);
	
	digitalWrite(pins_control[RS], 1);
	digitalWrite(pins_control[RW], 0);
	for (uint8_t i = 0; i < 8; i++)
	{
		digitalWrite(pins_data[i], (pData >> i) & 0b00000001);
	}
	send_pulse();	
}

void send_pulse(void)
{
	digitalWrite(pins_control[EN], 1);
	delay(10);
	digitalWrite(pins_control[EN], 0);
}

void lcd_write(uint8_t *pChar)
{
	for(uint8_t i = 0; pChar[i] != '\0'; i++)
	{
		send_data(pChar[i]);
	}
}

uint8_t read_busyflag(void)
{
	uint8_t busy_flag;
	
	pinMode(pins_control[7], 0);
	digitalWrite(pins_control[RS], 0);
	digitalWrite(pins_control[RW], 1);
	
	busy_flag = digitalRead(pins_control[7]);
	
	return busy_flag;
}

Even without putting the busy flag check, my LCD still works…and I don’t even put delays.

Here’s the main sketch to test the library

#include <LCDinC.h>

void setup() {
lcd_set8bit(12, 11, 10, 9, 8, 2, 3, 4, 5, 6, 7);
lcd_init();
lcd_setCursor(7,0);
lcd_write("AIMAN");
}

void loop() {
}

Since read_busyflag is a function you need to invoke it and not just test it's address. i.e.

while(read_busyflag() == 1);

Ah I see. What a silly mistake…I overlooked that one.

Thanks stowite.