English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
所有分類

以下是自走車之程式之部分內容
Right: ;車向右轉
inc Rmotor
mov a,Rmotor
anl a,#00000111b
acall Motor_Phase_R
mov b,a
mov a,MOTOR
anl a,#11110000b
orl a,b
mov MOTOR,a
ret
Lift: ;車向左轉
inc Lmotor
mov a,Lmotor
anl a,#00000111b
acall Motor_Phase_L
mov b,a
mov a,MOTOR
anl a,#00001111b
orl a,b
mov MOTOR,a
ret
Motor_Phase_R:
mov dptr,#Motor_Table_R ;
movc a,@a+dptr ;
ret
Motor_Table_R:
db 00000110b
db 00000111b
db 00000101b
db 00001101b
db 00001001b
db 00001011b
db 00001010b
db 00001110b
Motor_Phase_L:
mov dptr,#Motor_Table_L ;
movc a,@a+dptr ;
ret
Motor_Table_L:
db 11100000b
db 10100000b
db 10110000b
db 10010000b
db 11010000b
db 01010000b
db 01110000b
db 01100000b
end
我不明白的是
為何anl a,#00000111b其中00000111b是代表何意?
為何 anl a,#11110000b 其中11110000b 是代表何意?

2007-01-11 09:54:08 · 1 個解答 · 發問者 ? 3 in 電腦與網際網路 軟體

1 個解答

ANL 就是邏輯AND的指令,其後的運算元,用0表示要將A內相對應的位元強制為0,用1表示將A內相對應的位元狀態保留原狀。
ORL 就是邏輯OR的指令,其後的運算元,用1表示要將A內相對應的位元強制為1,用0表示將A內相對應的位元狀態保留原狀。
在你的程式是,是利用ANL,ORL交互運用,合併出一個新的有效值

2007-01-12 03:17:14 · answer #1 · answered by 有兩把刷子的ㄚ超 5 · 0 0

fedest.com, questions and answers