I am looking at an ST7066U controller for a 2x16 LCD. The datasheet has these assembly instructions that I would like to change to C code.
CHK_BUSY: ;Check Busy Flag
CLR RS
SETB RW
SETB E
JB P1.7,$
CLR E
RET
What does JB P1.7, $
mean?
Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. It only takes a minute to sign up.
Sign up to join this communityI am looking at an ST7066U controller for a 2x16 LCD. The datasheet has these assembly instructions that I would like to change to C code.
CHK_BUSY: ;Check Busy Flag
CLR RS
SETB RW
SETB E
JB P1.7,$
CLR E
RET
What does JB P1.7, $
mean?
The JB instruction branches to the address specified in the second operand if the value of the bit specified in the first operand is 1. The bit that is tested is not modified. No flags are affected by this instruction.
Source: https://www.keil.com/support/man/docs/is51/is51_jb.htm
P1.7
is HIGH, then it shall go to the address in the second operand $
, however I didn't understand it in this context, which address does $
points to?
\$\endgroup\$
Nov 30, 2020 at 23:53
The ST7066U's datasheet has some example code for the 8051 MPU.
From the 8051's instruction set:
Operation: JB Function: Jump if Bit Set Syntax: JB bit addr, reladdr Instructions OpCode Bytes Flags JB bit addr,reladdr 0x20 3 None Description: JB branches to the address indicated by reladdr if the bit indicated by bit addr is set. If the bit is not set program execution continues with the instruction following the JB instruction.