如何同时打开引脚13和12?部件

时间:2014-05-30 15:41:23

标签: assembly arduino led pins

如何同时打开引脚13和12?

ldi r18,0x20  ; bit 5 (pin 13) = high
out 5,r18     ; output to port B

ldi r18,0x10  ; bit 4 (pin 12) = high 
out 5,r18     ; output to port B

1 个答案:

答案 0 :(得分:1)

按位或将值一起设置为两者;

ldi r18,0x30  ; 0x20 (bit 5) OR 0x10 (bit 4) = 0x30 sets bit 4 and 5 high
out 5,r18     ; output to port B