<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設計應用 > 51單片機對SAA7113初始化和控制的程序

          51單片機對SAA7113初始化和控制的程序

          作者: 時間:2010-09-19 來源:網(wǎng)絡 收藏

            RET

            ;*******通過I2C總線讀出某一寄存器的數(shù)據(jù)*********

            I2C_READ: ACALL I2C_START

            MOV A, # DeviceaddressW ;調(diào)7113地址,寫入

            ACALL I2C_SEND_1BYTE

            ACALL CHECK_ACK

            JNB I2C_ERROR, RD200

            RD100: ACALL I2C_STOP

            RET

            RD200: MOV A, Subaddress ;調(diào)要讀的寄存器地址

            ACALL I2C_SEND_1BYTE ; 發(fā)送寄存器地址字節(jié)

            ACALL CHECK_ACK

            JB I2C_ERROR, RD100

            ACALL I2C_START ;重發(fā)起動信號

            MOV A, # DeviceaddressR ;調(diào)7113地址,讀

            ACALL I2C_SEND_1BYTE

            ACALL CHECK_ACK

            JB I2C_ERROR, RD100

            ACALL I2C_RECEIVE_1BYTE ;接收讀出的數(shù)據(jù)

            MOV DATA_I2C,A ;讀出數(shù)據(jù)轉(zhuǎn)存

            ACALL SEND_NOACK ;發(fā)送非應答位

            ACALL I2C_STOP ;停止

            RET

            ;***************化7113,配置各寄存器************************

            INIT_: MOV DPTR, #_Subaddress

            MOV R7, #28

            INIT100: MOV A, #0

            MOV C A, @A+DPTR

            MOV Subaddress, A ;調(diào)寄存器地址

            MOV A,#28

            MOVC A, @A+DPTR

            MOV DATA_I2C, A ;調(diào)寄存器配置數(shù)據(jù)

            INC DPTR

            ACALL I2C_WRITE ;配置1個寄存器

            JB I2C_ERROR, INIT200

            DJNZ R7,INIT100

            INIT200: RET

            ;***************寄存器化配置數(shù)據(jù)**********************

            SAA7113_Subaddress:

            DB 01H,02H,03H,04H,05H,06H,07H,08H,09H,0AH,0BH,0CH,0DH,0EH

            DB 0FH,10H,11H,12H,13H,15H,16H,17H,40H,58H,59H,5AH,5BH,5EH

            ;共28個

            I2C_REG_VALUE_AI11:

            DB 08H,0C0H,33H,00H,00H,0EBH,0E0H,0B8H,01H,7EH,46H,43H,01H,01H

            DB 0FH,00H,0CH,0A7H,00H,00H,00H,00H,02H,00H,54H,07H,80H,00H

            ;*************對SAA7113某一寄存器的改寫與讀出*******************

            WRITE_READ: MOV Subaddress, #0AH ; 設寄存器地址為0AH

            MOV DATA_I2C, #88H ;改寄存器的值為88H

            ACALL I2C_WRITE ;改寫

            ACALL I2C_READ ;讀出


          上一頁 1 2 3 下一頁

          評論


          相關推薦

          技術專區(qū)

          關閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();