Re: [問題] 有關於MCU去改某顆IC暫存器之值

看板ASM作者 (達陸趁現在!)時間11年前 (2013/07/17 09:41), 編輯推噓1(103)
留言4則, 2人參與, 最新討論串3/4 (看更多)
如前題,這段時間在忙其他工作,尚未對MCU CODING 但是這段時間還是有陸續問有在接觸MCU的同學問問題, 也感謝之前K版友的詳細回覆,現在我目前想確認之前的 一些問題,如下網址裡面的圖,這是MCU欲控制的IC,這是 該IC裡面的一些暫存器(有包含位址跟讀寫,後面的SPEC 還有說明各BIT的作用) http://i.imgur.com/2iH0YFZ.jpg
寫C++時,我參考K版友的參考CODE後我定義了上述暫存器: #define SYSTEM (*(unsigned int *)0x01) #define SYSTEM_OPER (*(unsigned int *)0x02) #define EXTERNAL_MOS (*(unsigned int *)0x03) #define WAKE_UP_SOURCE_DFM_SET (*(unsigned int *)0x04) #define DFMONITOR (*(unsigned int *)0x05) #define WATCHDOG_CONF (*(unsigned int *)0x06) #define RESERVED_W (*(unsigned int *)0x07) #define LINBITS_SET (*(unsigned int *)0x08) #define DRV_SET (*(unsigned int *)0x09) #define RESRVED (*(unsigned int *)0x0A) #define TEST_STAT (*(unsigned int *)0x0B) #define WATCHDOG_REFRESH (*(unsigned int *)0x0F) #define WAKE_UP_SOURCE (*(unsigned int *)0x11) #define LAMP_STAT (*(unsigned int *)0x12) #define PH_SENSE (*(unsigned int *)0x13) #define WD_TS_RES_CNT (*(unsigned int *)0x14) #define DEVICE_INFO (*(unsigned int *)0x1F) 不知道這樣定義後對不對,假使是對的話,我就會開始用他們的 內建的SPI INTERFACE去讀寫該顆IC的暫存器的值, 不過要了解他們的library的SPI傳送資料的副程式又是另一個問 題了... -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.221.102.2

07/17 10:42, , 1F
不對,如果不是針對內部記憶體而只是單純的位置則不用這樣
07/17 10:42, 1F

07/17 10:42, , 2F
只需要 #define DEVICE_INFO 0x1F之類這樣即可
07/17 10:42, 2F

07/17 10:44, , 3F
之前寫是針對內部硬體的記憶體位址外部元件要看他用啥通訊
07/17 10:44, 3F

07/17 11:03, , 4F
好 了解
07/17 11:03, 4F
文章代碼(AID): #1HvVOsfI (ASM)
討論串 (同標題文章)
文章代碼(AID): #1HvVOsfI (ASM)