- #1
Alex_Sanders
- 73
- 0
Here's a couple of programs that I really couldn't figure out some of their lines:
This function checks if the 1602 is busy, I suppose it means whether data are being passed to the registers of 1602:
bit LCD_Check_Busy(void)
{
DataPort= 0xFF; // Dataport is P0. What does this do? Is this some kind of initialization? Couldn't you just leave P0 alone until you really start using it?
RS_CLR; // RS register set to 0
RW_SET; //R@ register set to 1 (write)
EN_CLR;
_nop_();
EN_SET; // Here, EN register set to 0 then set back to 1 again, thus forming a rising edge, but 1602 was enabled when a falling edge was detected? Maybe it's not trying to enable the 1602 at all? Or may be there is a "Not" logic in the circuit? But I checked the schematic, there is none?
return (bit)(DataPort & 0x80); // I have no idea how this very crucial line works.
}
I'd really appreciate your help, thanks in advance and, in case there is not sufficient information to answer those question, please let me know.
This function checks if the 1602 is busy, I suppose it means whether data are being passed to the registers of 1602:
bit LCD_Check_Busy(void)
{
DataPort= 0xFF; // Dataport is P0. What does this do? Is this some kind of initialization? Couldn't you just leave P0 alone until you really start using it?
RS_CLR; // RS register set to 0
RW_SET; //R@ register set to 1 (write)
EN_CLR;
_nop_();
EN_SET; // Here, EN register set to 0 then set back to 1 again, thus forming a rising edge, but 1602 was enabled when a falling edge was detected? Maybe it's not trying to enable the 1602 at all? Or may be there is a "Not" logic in the circuit? But I checked the schematic, there is none?
return (bit)(DataPort & 0x80); // I have no idea how this very crucial line works.
}
I'd really appreciate your help, thanks in advance and, in case there is not sufficient information to answer those question, please let me know.