• 回复
  • 收藏
  • 点赞
  • 分享
  • 发新帖

指令请教

A. Define a General Register
R_0 == 0 ; Indirect addressing register
PSW == 3 ; Status register
PORT5 == 5
PORT6 == 6
R_E== 0XE ; Interrupt status register
B. Define a Control Register
IOC50 == 0X5 ; Control Register of Port 5
IOC60 == 0X6 ; Control Register of Port 6
C_INT== 0XF ; Interrupt Control Register
C. ADC Control Register
ADDATA == 0xB ; The contents are the results of ADC
AISR == 0x08 ; ADC input select register
ADCON == 0x9 ; 7 6 5 4 3 2 1 0 ; VREFS CKR1 CKR0 ADRUN ADPD ADIS2 ADIS1 ADIS0
D. Define Bits in ADCON
ADRUN == 0x4 ; ADC is executed as the bit is set
ADPD == 0x3 ; Power Mode of ADC
E. Program Starts
ORG 0 ; Initial address
JMP INITIAL ;
ORG 0x0C ; Interrupt vector
JMP CLRRE
;
;
;(User program section)
;
;
CLRRE:
MOV A,RE
AND A, @0BXX0XXXXX ; To clear the ADIF bit, “X” by application
MOV RE,A
BS ADCON, ADRUN ; To start to execute the next AD conversion
if necessary
RETI
INITIAL
MOV A,@0B00000001 ; To define P50 as an analog input
MOV AISR,A
MOV A,@0B00001000 ; To select P50 as an analog input channel, and
AD power on
MOV ADCON,A ; To define P50 as an input pin and set clock
rate at fosc/16
En_ADC:
MOV A, @0BXXXXXXX1 ; To define P50 as an input pin, and the others
IOW PORT5 ; are dependent on applications
MOV A, @0BXXXX1XXX ; Enable the ADWE wake-up function of ADC, “X”
by application
MOV RE,A
MOV A, @0BXXXX1XXX ; Enable the ADIE interrupt function of ADC,
“X” by application
IOW C_INT
ENI ; Enable the interrupt function
BS ADCON, ADRUN ; Start to run the ADC
; If the interrupt function is employed, the following three lines
may be ignored
;If Sleep:
SLEP
;
;(User program section)
;
or
;If Polling:
POLLING:
JBC ADCON, ADRUN ; To check the ADRUN bit continuously;
JMP POLLING ; ADRUN bit will be reset as the AD conversion
is completed
;
;(User program section)
请问谁知道这段指令中这句话


MOV A, @0BXXXX1XXX ; Enable the ADIE interrupt function of ADC,
“X” by application
IOW C_INT


怎么理解啊???
资料里说第4条明明说4. 如果使用中斷功能,置ADIE 位為“1”.可是他写着是给RF


按以下步驟完成AD 轉換:
1. 設置R8(AOSR)寄存器的4 位(ADE3:ADE0)來定義R5:數位I/O 引腳, 類比通道, 以
及參考電壓管腳.
2. 寫R9/ADCON 寄存器來設定AD 模組.
(a) 選擇A/D 輸入通道( ADIS1:ADIS0 );
(b) 定義A/D 轉換分頻比( CKR1:CKR0 );
(c) 選擇ADC 的參考電壓輸入源;
(d) 置ADPD 位為“1” 開始採樣.
3. 如果使用喚醒功能,置ADWE 位為“1”.
4. 如果使用中斷功能,置ADIE 位為“1”.
5 如果使用中斷功能,下ENI 指令.
6. 置ADRUN 位為“1”.
7. 下SLEP 指令或Polling.
8. 等待喚醒,ADRUN 位元清零,中斷標誌(ADIF)置“1”或ADC 中斷發生.
9. 讀轉換資料寄存器的ADDATA 或ADDATA1H 和ADDATA1L.如果ADC 輸入通道
同時變化,ADDATA, ADDATA1H, and ADDATA1L 值可被清“0”.
10. 清除中斷標誌位元(ADIF).
全部回复(0)
正序查看
倒序查看
现在还没有回复呢,说说你的想法