;Sample code operates out of BANK0
MOVLW 0xF1;configure A/D
MOVWF ADCON0
BSF ADCON0, 1;start conversion
loop0 BTFSC ADCON0, 1;wait for ‘DONE’
GOTO loop0
MOVF ADRES, W;read result
MOVWF result0;save result
BSF ADCON0, 2;setup for read of;channel 1
BSF ADCON0, 1;start conversion
loop1 BTFSC ADCON0, 1;wait for ‘DONE’
GOTO loop1
MOVF ADRES, W ;read result
MOVWF result1;save result
BSF ADCON0, 3;setup for read of
BCF ADCON0, 2;channel 2
BSF ADCON0, 1;start conversion
loop2 BTFSC ADCON0, 1;wait for ‘DONE’
GOTO loop2
MOVF ADRES, W;read result
MOVWF result2;save result
个人各位第一行,第二行,是多余的,说白了,就是将ADCON0的最低位赋1;第三行一步都完成了,干嘛要写前面2步?
左边的LOOP1 2 也是多余的么?
谁帮忙解释一下?谢谢!
汇编表示看不懂,能转个C版本的就好了!
|