(8051) Check if a single bit is set

前端 未结 2 381
时光取名叫无心
时光取名叫无心 2021-01-23 04:14

I\'m writing a program for a 8051 microcontroller. In the first part of the program I do some calculations and based on the result, I either light the LED or not (using CL

2条回答
  •  猫巷女王i
    2021-01-23 04:59

    The C here is the 8051's carry flag - called that because it can be used to hold the "carry" when doing addition operations on multiple bytes.

    It can also be used as a single-bit register - so (as here) where you want to move bits around, you can load it with a port value (such as P1.7) then store it somewhere else, for example:

    MOV C, P1.7
    MOV , C
    

    Then later you can branch on it using:

    JB , 

提交回复
热议问题