【正文】
FLASH FLASH 設(shè)備 是由 部分號(hào)碼中的 字母 “F ” 確定的 , 在過去數(shù)年非常流行 。他們通常比 ROM 更加昂貴。他們是嚴(yán)格的 ROM 設(shè)備,運(yùn)算 編程。因此,對(duì)于 8K 的設(shè)備,代碼運(yùn)行從 0E000h 到 0FFFFH, 6 萬(wàn)的設(shè)備,代碼運(yùn)行 從 01100h 到 0FFFFH。它是 閃存器件 唯一的硬 空格字符 的 ROM 空間。為 RAM 使用的一些經(jīng) 驗(yàn)法則: 開發(fā)者 需要謹(jǐn)慎,暫存器分配和堆棧的使用并不侵犯對(duì)方,或全局變量。 這些都是描述 在第 3 章。如果彈出一個(gè)空棧, SP 遷出 內(nèi)存,并且程序?qū)⑹ ?彈出相反。 1=結(jié)果發(fā)生溢出 0=結(jié)果沒發(fā)生溢出 其中四個(gè)標(biāo)志(溢出,負(fù), 進(jìn)位 和零)驅(qū)動(dòng)程序控制,通過指令,如 cmp(比較)和JZ(如果零標(biāo)志集 跳躍 )。 存儲(chǔ)器,外設(shè)和定時(shí)器都不被此位影響,此位作為一個(gè)節(jié)電功能 。這些標(biāo)志都是直接通過 代 碼訪問,并且 6 其中只有 3 個(gè)是 處理器本身自動(dòng) 更改 的 。(見例 )。在實(shí)施這一 做法 (即 匯編語(yǔ)言),程序員需要 記錄一些東西 : 永遠(yuǎn)做適當(dāng)范圍的檢查。put the switch value into R15 Cmp R15,8 。 )包括一些常見的 singlebit 產(chǎn)生常量值 (0001h,0002h,0004h,0008h)、零 (0000h),它的所有領(lǐng)域 0FFFFh(1)。 我在八個(gè)月前寫的代碼,廣泛的在R R9 和 R15 上執(zhí)行操作。他們使用的一些準(zhǔn)則: 盡可能使用這些寄存器。 CPU的特點(diǎn) ALU 該 39。幾乎一半的狀態(tài)寄存器仍然可以為未來(lái)的發(fā)展,大致外設(shè)寄存器空間的一半是未使用的,只有 6 位 16 位可用的特殊功能寄存器使用。 結(jié)構(gòu): CPU 和內(nèi)存 正如在第一章中所討論的, MSP430 的采用 16位 RISC 結(jié)構(gòu),這是在任何字節(jié)或字的處理指令的能力。3xx 和 39。 該 39。430 family have the added feature of information memory. This information memory acts as onboard EEPROM, allowing critical variables to be preserved through power down. It is divided into two 128byte segments. The first of these segments is located at addresses 01000h through 0107Fh, and the second is at 01080h through 010FFh. Code Memory Code memory is always contiguous at the end of the address space (. always runs to location 0FFFFh). So, for 8k devices, code runs from 0E000h to 0FFFFh, and for the 60k devices, the code runs from 01100h to 0FFFFh. All code, tables, and hardcoded constants reside in this memory space. Interrupt Vectors Interrupt vectors are located at the very end of memory space, in locations 0FFE0h through 0FFFEh. Programming and use of these are described in detail in Chapter 3. Memory Types The MSP430 is available with any one of several different memory types. The memory type is identified by the letter immediately following MSP430 in the part numbers. (Example: All MSP430Fxxx parts are flash decices). ROM 1 ROM devices, also known as masked devices, are identified by the letter C in the part numbers. They are strict ROM devices, shipped preprogrammed. They have the advantage of being very inexpensive, and may be the best solution for highvolume designs. However, due to high NRE (nonrecurring engineering) costs, masked ROM is only costefficient when hundreds of thousands (or more) devices are required. They should also only be used for stable designs. If bugs are found too late in the process, the NRE costs have the potential to be repeated. OTP OTP is an acronym for one time programmable, which pretty well describes the functionality of these devices. Identified by the letter P in the part number, OTP parts are a good promise between ROM and flash parts. OTPs are shipped blank, and can be programmed at any time. They are typically more expensive than ROM. They also require programming, which can be a hindrance in highvolume manufacturing environments. However, OTPs are ideal for low and medium volume applications, and can be a useful intermediate step when you are still uncertain about the stability of the design. EPROM TI offers windowed EPROM versions of several devices, intended for use in development. They are identified by the letter E in the part number. These devices are electrically programmable, and UVerasable. EPROM devices are only available for a few devices, and typically cost on the order of $50 each. They are not intended for production use, but make ideal platforms for emulating ROM devices in development. Flash Flash devices, identified by the letter F in the part number, have bee very popular in the past few years. They are more expensive, but code space can be erased and reprogrammed, thousands of times if necessary. This capability allows for features such as downloadable firmware, and lets the developer substitute code space for an external EEPROM. 2 利用 TI 的 MSP430 系列的嵌入式系統(tǒng)設(shè)計(jì) (節(jié)選 ) 這本書是寫給新進(jìn)入此領(lǐng)域的嵌入式工程師, 作為一個(gè)關(guān)于 微 控制器的開發(fā) 經(jīng)驗(yàn)的介紹和依據(jù) ,但新的 MSP430 系列的設(shè)備。PC goes to proper jump Jmp value0 Jmp value1 Jmp value2 Jmp value3 Jmp value4 Jmp value5 Jmp value6 Jmp value7 Outofrange Jmp RangeError This is a relatively mon approach, and most C pilers will implement switch statements with something similar. When implementing this manually (., in assembly language), the programmer needs to keep several things in mind: Always do proper range checking. In the example, we checked for conditions outside both ends of the valid range. If this is not performed correctly, the code can jump to an unintended location. Pay close attention to the addressing modes of the jump statements. The second doubling of R15, prior to the add statement, is added because the jump statement requires two words when symbolic mode addressing is used. Be careful that none of your interrupt handlers have the potential to affect your value register (R15 in the example). If the interrupt handler needs to use one of these registers, the handler needs to store the value to RAM first. The most mon procedure is to push the register to the stack at the beginning of the ISR, and to pop the register at the end of the ISR. (See Example .) Example Push/Pop Combination in ISR Timer_A_Hi_Interrupt Push R12 。t let this happen to you. No matter how obvious or trivial register use seems, document it anyway. Constant Generators R2 and R3 function as constant generators, so that register mode ma y be used instead of immediate mode for some mon constants. (R2 is a dual use register.