ARM處理器的工作模式 ARM處理器狀態(tài) ARM微處理器的工作狀態(tài)一般有兩種,并可在兩種狀態(tài)之間切換:第一種為ARM狀態(tài),此時處理器執(zhí)行32位的字對齊的ARM指令;第二種為Thumb狀態(tài),此時處理器執(zhí)行16位的、半字對齊的Thumb指令。在程序的執(zhí)行過程中,微處理器可以隨時在兩種工作狀態(tài)之間切換,并且,處理器工作狀態(tài)的轉(zhuǎn)變并不影響處理器的工作模式和相應(yīng)寄存器中的內(nèi)容。但ARM微處理器在開始執(zhí)行代碼時,應(yīng)該處于ARM狀態(tài)。 ARM處理器狀態(tài) 進入Thumb狀態(tài):當(dāng)操作數(shù)寄存器的狀態(tài)位(位0)為1時,可以采用執(zhí)行BX指令的方法,使微處理器從ARM狀態(tài)切換到Thumb狀態(tài)。此外,當(dāng)處理器處于Thumb狀態(tài)時發(fā)生異常(如IRQ、FIQ、Undef、Abort、SWI等),則異常處理返回時,自動切換到Thumb狀態(tài)。 進入ARM狀態(tài):當(dāng)操作數(shù)寄存器的狀態(tài)位為0時,執(zhí)行BX指令時可以使微處理器從Thumb狀態(tài)切換到ARM狀態(tài)。此外,在處理器進行異常處理時,把PC指針放入異常模式鏈接寄存器中,并從異常向量地址開始執(zhí)行程序,也可以使處理器切換到ARM狀態(tài)。ARM處理器模式 ARM微處理器支持7種運行模式,分別為:用戶模式(usr):ARM處理器正常的程序執(zhí)行狀態(tài)。快速中斷模式(fiq):用于高速數(shù)據(jù)傳輸或通道處理。外部中斷模式(irq):用于通用的中斷處理。管理模式(svc):操作系統(tǒng)使用的保護模式。數(shù)據(jù)訪問終止模式(abt):當(dāng)數(shù)據(jù)或指令預(yù)取終止時進入該模式,可用于虛擬存儲及存儲保護。系統(tǒng)模式(sys):運行具有特權(quán)的操作系統(tǒng)任務(wù)。定義指令中止模式(und):當(dāng)未定義的指令執(zhí)行時進入該模式,可用于支持硬件協(xié)處理器的軟件仿真。ARM處理器模式 ARM微處理器的運行模式可以通過軟件改變,也可以通過外部中斷或異常處理改變。大多數(shù)的應(yīng)用程序運行在用戶模式下,當(dāng)處理器運行在用戶模式下時,某些被保護的系統(tǒng)資源是不能被訪問的。 除用戶模式以外,其余的所有6種模式稱之為非用戶模式,或特權(quán)模式;其中除去用戶模式和系統(tǒng)模式以外的5種又稱為異常模式,常用于處理中斷或異常,以及需要訪問受保護的系統(tǒng)資源等情況。ARM寄存器 ARM處理器共有37個寄存器。其中包括:31個通用寄存器,包括程序計數(shù)器(PC)在內(nèi)。這些寄存器都是32位寄存器。以及6個32位狀態(tài)寄存器。 關(guān)于寄存器這里就不詳細(xì)介紹了,有興趣的人可以上網(wǎng)找找,很多這方面的資料。異常處理 當(dāng)正常的程序執(zhí)行流程發(fā)生暫時的停止時,稱之為異常,例如處理一個外部的中斷請求。在處理異常之前,當(dāng)前處理器的狀態(tài)必須保留,這樣當(dāng)異常處理完成之后,當(dāng)前程序可以繼續(xù)執(zhí)行。處理器允許多個異常同時發(fā)生,它們將會按固定的優(yōu)先級進行處理。當(dāng)一個異常出現(xiàn)以后,ARM微處理器會執(zhí)行以下幾步操作:進入異常處理的基本步驟:將下一條指令的地址存入相應(yīng)連接寄存器LR,以便程序在處理異常返回時能從正確的位置重新開始執(zhí)行。將CPSR復(fù)制到相應(yīng)的SPSR中。根據(jù)異常類型,強制設(shè)置CPSR的運行模式位。強制PC從相關(guān)的異常向量地址取下一條指令執(zhí)行,從而跳轉(zhuǎn)到相應(yīng)的異常處理程序處。如果異常發(fā)生時,處理器處于Thumb狀態(tài),則當(dāng)異常向量地址加載入PC時,處理器自動切換到ARM狀態(tài)。 ARM微處理器對異常的響應(yīng)過程用偽碼可以描述為: R14_ = Return LinkSPSR_= CPSRCPSR[4:0] = Exception Mode NumberCPSR[5] = 0 ;當(dāng)運行于 ARM 工作狀態(tài)時If == Reset or FIQ then;當(dāng)響應(yīng) FIQ 異常時,禁止新的 FIQ 異常CPSR[6] = 1PSR[7] = 1PC = Exception Vector Address異常處理完畢之后,ARM微處理器會執(zhí)行以下幾步操作從異常返回:將連接寄存器LR的值減去相應(yīng)的偏移量后送到PC中。將SPSR復(fù)制回CPSR中。若在進入異常處理時設(shè)置了中斷禁止位,要在此清除。
上傳時間: 2013-11-15
上傳用戶:hanbeidang
FeaturesThe following standard features are provided.• Choice of RTOS scheduling policy1. Pre-emptive:Always runs the highest available task. Tasks of identical priorityshare CPU time (fully pre-emptive with round robin time slicing).2. Cooperative:Context switches only occur if a task blocks, or explicitly callstaskYIELD().• Co-routines (light weight tasks that utilise very little RAM).• Message queues• Semaphores [via macros]• Trace visualisation ability (requires more RAM)• Majority of source code common to all supported development tools• Wide range of ports and examples
上傳時間: 2013-10-13
上傳用戶:13162218709
介紹了ATM 技術(shù)的特點以及深入分析了PowerPC MPC826o的ATM 步長控制器(APC)的原理,分析了VxW0rks網(wǎng)絡(luò)模塊. 給出了在VxWorks 實時操作系統(tǒng)下的END 模式的ATM 驅(qū)動程序設(shè)計.重點討論了ATM 驅(qū)動開發(fā)中需注意的特殊問題
標(biāo)簽: 8260 MPC ATM 驅(qū)動開發(fā)
上傳時間: 2013-10-11
上傳用戶:wwwwwen5
The PCA9541 is a 2-to-1 I2C-bus master selector designed for high reliability dual masterI2C-bus applications where system operation is required, even when one master fails orthe controller card is removed for maintenance. The two masters (for example, primaryand back-up) are located on separate I2C-buses that connect to the same downstreamI2C-bus slave devices. I2C-bus commands are sent by either I2C-bus master and are usedto select one master at a time. Either master at any time can gain control of the slavedevices if the other master is disabled or removed from the system. The failed master isisolated from the system and will not affect communication between the on-line masterand the slave devices on the downstream I2C-bus.
標(biāo)簽: master C-bus 9541 PCA
上傳時間: 2013-10-09
上傳用戶:3294322651
The PCA9544A provides 4 interrupt inputs, one for each channeland one open drain interrupt output. When an interrupt is generated byany device, it will be detected by the PCA9544A and the interruptoutput will be driven LOW. The channel need not be active fordetection of the interrupt. A bit is also set in the control byte.Bits 4 – 7 of the control byte correspond to channels 0 – 3 of thePCA9544A, respectively. Therefore, if an interrupt is generated byany device connected to channel 2, the state of the interrupt inputs isloaded into the control register when a read is accomplished.Likewise, an interrupt on any device connected to channel 0 wouldcause bit 4 of the control register to be set on the read. The mastercan then address the PCA9544A and read the contents of thecontrol byte to determine which channel contains the devicegenerating the interrupt. The master can then reconfigure thePCA9544A to select this channel, and locate the device generatingthe interrupt and clear it. The interrupt clears when the deviceoriginating the interrupt clears.
標(biāo)簽: 4channel multiple 9544A 9544
上傳時間: 2014-12-28
上傳用戶:潛水的三貢
8086指令系統(tǒng)目錄 概述 2.1節(jié) 目錄 2.1.1--2.1.5(傳送) 2.1.1 目錄:1~3 2.1.1-1 mov類例1 mov類例2 mov類例3 mov類例4(END) 2.1.1-2. xchg --3.XLAT 查表示意圖(end) 2.1.2堆棧操作指令(1) 堆棧操作指令(2) 堆棧操作指令(3) 堆棧操作指令(4) 堆棧操作指令(5)(END) 2.1.3標(biāo)志傳送指令(1) 標(biāo)志傳送指令(2)(end) 2.1.4地址傳送指令(1) 地址傳送指令(2) 地址傳送指令(3)(end) 2.1.5輸入輸出指令(1) 輸入輸出指令(2) 輸入輸出指令(3)(end) 2.2節(jié) 目錄 2.2.1--2.2.6(算術(shù)) 2.2.1加法指令(1) 加法指令(2) 加法指令(3) 加法指令(4) 加法指令5 end 2.2.2減法指令(1) 減法指令(2) 減法指令(3) 減法指令(4) 減法指令(5) 減法指令(6)(end) 2.2.3乘法指令(1) 乘法指令(2) 乘法指令(3)(end) 2.2.4除法指令(1) 除法指令(2)(end) 2.2.5符號擴展指令(end) 符號擴展說明 2.2.6十進制調(diào)整指令(1) 十進制調(diào)整指令(2) 十進制調(diào)整指令(3) 十進制調(diào)整指令(4) 十進制調(diào)整指令(5) 十進制調(diào)整指令(6) 十進制調(diào)整指令(7) 十進制調(diào)整指令(8) 十進制調(diào)整指令(9)(end) 2.3節(jié) 目錄 2.3.1--2. 3.3(位) 2.3.1 邏輯運算指令(1) 邏輯運算指令(2) 邏輯運算指令(3) 邏輯運算指令(4) 邏輯運算指令(END) 2.3.2 移位指令(1) 移位指令(2) 移位指令(3) 移位指令(4)(end) 2.3.3 循環(huán)移位指令(1) 循環(huán)移位指令(2)(end) 2.4節(jié) 目錄 2.4.1 無條件轉(zhuǎn)移指令(1) 短轉(zhuǎn)移的轉(zhuǎn)移范圍 無條件轉(zhuǎn)移指令(2) 無條件轉(zhuǎn)移指令(3) 無條件轉(zhuǎn)移指令(4)(end) 2.4.2 條件轉(zhuǎn)移指令(1) 條件轉(zhuǎn)移指令(2) 條件轉(zhuǎn)移指令(3) 條件轉(zhuǎn)移指令(4) 條件轉(zhuǎn)移指令(5)(end) 2.4.3 循環(huán)控制指令(1) 循環(huán)控制指令(2)(end) 2.4.4 子程序調(diào)用及返回指令(1) 子程序調(diào)用及返回指令(2) 子程序調(diào)用及返回指令(3) 子程序調(diào)用及返回指令(4) 子程序調(diào)用及返回指令(5) 子程序調(diào)用及返回指令(6) (end) 2.4.5 中斷控制指令(1) 中斷控制指令(2) 中斷控制指令(3) 中斷控制指令(4) 中斷控制指令(5) 中斷控制指令(6) 中斷控制指令(7) 中斷控制指令(8)(end) 2.4.6 系統(tǒng)功能調(diào)用(1) 系統(tǒng)功能調(diào)用(2) 系統(tǒng)功能調(diào)用(3)(end) 2.5節(jié) 目錄 1---6(串操作) 串操作(1)傳送 串操作(2) 串操作(3) 串操作(4)存串 串操作(5)讀串、比較 串操作(6)搜索、重復(fù)前綴 串操作(7)REP 串操作(8)REPZ/REPNZ 串操作(9)前綴注釋 串操作(10)例題 串操作(11)注釋(end) 2.6 處理機控制類指令(1)(end)
標(biāo)簽: 8086 指令系統(tǒng)
上傳時間: 2013-10-30
上傳用戶:大三三
所學(xué)的指令LD、LDI、OUT AND、ANI OR、 ORI LDP、 LDF、ANDP、ANDF、 ORP、 ORF ORB、 ANB MPS、 MRD、 MPP MC、 MCRSET RSTNOP END 自鎖電路觸點的動作發(fā)光二極管的工作原理。八段碼顯示是利用發(fā)光二極管的不同段碼組合來實現(xiàn)的,它可以實現(xiàn)0到F的顯示。搶答器的顯示就是利用八段碼顯示的特性,來完成幾個不同組別的顯示。用PLC實現(xiàn)八段碼顯示0~9組的3組以上搶答器的程序編寫,并完成以下要求:1)設(shè)計由PLC實現(xiàn)的八段碼顯示0~9組的3組以上搶答器的程序編寫,并完成以下要求: ①列出PLC的輸入輸出地址分配表 ②畫出PLC的輸入輸出接線圖(即I/O接線圖) ③設(shè)計PLC的梯形圖 ④根據(jù)梯形圖列寫指令表 2)按PLC控制I/O口(輸入/輸出)接線圖在模擬實驗設(shè)備上正確接線。
上傳時間: 2013-11-22
上傳用戶:lmeeworm
基于單片機的紅外門進控制系統(tǒng)設(shè)計與制作:我們所做的創(chuàng)新實驗項目“基于單片機的紅外門控系統(tǒng)”已基本完成,現(xiàn)將其工作原理簡要說明。該系統(tǒng)主要分為兩大部分:一是紅外傳感器部分。二是單片機計數(shù)顯示控制部分。基本電路圖如下:其中紅外傳感器部分我們采用紅外對管實現(xiàn),紅外對管平行放置,平常處于接收狀態(tài),經(jīng)比較器輸出低電平,當(dāng)有人經(jīng)過時,紅外線被擋住,接收管接收不到紅外線,經(jīng)比較器輸出高電平。這樣,當(dāng)有人經(jīng)過時便會產(chǎn)生一個電平的跳變。單片機控制部分主要是通過外部兩個中斷判斷是否有人經(jīng)過,如果有人經(jīng)過,由于電平跳變的產(chǎn)生,進入中斷服務(wù)程序,這里我們采用了兩對紅外傳感器接到兩個外部中斷口,中斷0作為入口,實現(xiàn)加1操作,中斷1作為出口,實現(xiàn)減1操作。另外,我們通過P0口控制室內(nèi)燈的亮暗,當(dāng)寄存器計數(shù)值為0時,熄燈,不為0時,燈亮。顯示部分,采用兩位數(shù)碼管動態(tài)顯示,如有必要,可以很方便的擴展為四位計數(shù)。精益求精!在實驗過程中,我們走了非常多的彎路,做出來的東西根本不是自己想要的,我們本想做成室內(nèi)只有一個門的進出計數(shù),原理已清楚,即在門的兩邊放置兩對紅外對管,進出時,擋住兩對對管的順序不同,因此,可判斷是進入還是出去,從而實現(xiàn)加減計數(shù),編程時,可分別在兩個中斷服務(wù)程序的入口置標(biāo)志位,根據(jù)標(biāo)志位判斷進出,詳細(xì)內(nèi)容在程序部分。理論如此,但在實際過程中,還是發(fā)現(xiàn)實現(xiàn)不了上述功能,我們初步判定認(rèn)為是程序掌握得不夠好,相信隨著自己對單片機了解的深入,應(yīng)該會做出更好的 (因為我們是臨時學(xué)的單片機),程序的具體內(nèi)容如下: $MOD52 ORG 0000H LJMP MAIN ORG 0003H LJMP 0100H ORG 0013H LJMP 0150H ORG 0050HMAIN: CLR A MOV 30H , A ;初始化緩存區(qū) MOV 31H , A MOV 32H , A MOV 33H , A MOV R6 , A MOV R7 , A SETB EA SETB EX0 SETB EX1 SETB IT0 SETB IT1 SETB PX1NEXT1: ACALL HEXTOBCDD ;調(diào)用數(shù)制轉(zhuǎn)換子程序 ACALL DISPLAY ;調(diào)用顯示子程序 LJMP NEXT1 ORG 0100H ;中斷0服務(wù)程序 LCALL DELY mov 70h,#2 djnz 70h,next JBC F0,NEXT SETB F0 CLR P0.0 LCALL DELY0 SETB P0.0 MOV A , R7 ADD A , #1 MOV R7, A MOV A , R6 ADDC A , #0 MOV R6 , A CJNE R6 , #07H , NEXT CLR A MOV R6 , A MOV R7 , ANEXT: RETI ORG 0150H ;中斷1服務(wù)程序 LCALL DELY mov 70h,#2 djnz 70h,next2 JBC F0,NEXT2 SETB F0 CLR P0.0 LCALL DELY0 SETB P0.0 CLR C MOV A , R7 SUBB A , #1 MOV R7, A MOV A , R6 SUBB A , #0 MOV R6 , A CJNE R6 , #07H , NEXT2 CLR A MOV R6 , A MOV R7 , ANEXT2: RETI ORG 0200HHEXTOBCDD:MOV A , R6 ;由十六進制轉(zhuǎn)化為十進制 PUSH ACC MOV A , R7 PUSH ACC MOV A , R2 PUSH ACC CLR A MOV R3 , A MOV R4 , A MOV R5 , A MOV R2 , #10HHB3: MOV A , R7 ;將十六進制中最高位移入進位位中 RLC A MOV R7 , A MOV A , R6 RLC A MOV R6 , A MOV A , R5 ;每位數(shù)加上本身相當(dāng)于將這個數(shù)乘以2 ADDC A , R5 DA A MOV R5 , A MOV A , R4 ADDC A , R4 DA A ;十進制調(diào)整 MOV R4 , A MOV A , R3 ADDC A , R3 DJNZ R2 , HB3 POP ACC MOV R2 , A POP ACC MOV R7 , A POP ACC MOV R6 , A RET ORG 0250HDISPLAY: MOV R0 , #30H MOV A , R5 ANL A , #0FH MOV @R0 , A MOV A , R5 SWAP A ANL A , #0FH INC R0 MOV @R0 , A MOV A , R4 ANL A , #0FH INC R0 MOV @R0 , A MOV A , R4 SWAP A ANL A , #0FH INC R0 MOV @R0 , A MOV R0 , #30H MOV R2 , #11111110BAGAIN: MOV A , R2 MOV P2 , A MOV A , @R0 MOV DPTR , #TAB MOVC A , @A+DPTR MOV P1 , A ACALL DELAY INC R0 MOV A , R2 RL A MOV R2 , A JB ACC.4 , AGAIN RETTAB: DB 03FH , 06H , 5BH , 4FH , 66H , 6DH , 7DH , 07H , 7FH , 6FH ;七段碼表DELY: MOV R1,#80D1: MOV R2,#100 DJNZ R2,$ DJNZ R1,D1 RET DELAY: MOV TMOD , #01H ;延時子程序 MOV TL0 , #0FEH MOV TH0 , #0FEH SETB TR0WAIT: JNB TF0 , WAIT CLR TF0 CLR TR0 RETDELY0: MOV R1, #200D3: MOV R2,#250 DJNZ R2,$ DJNZ R1,D3 RET END 該系統(tǒng)實際應(yīng)用廣泛。可用在生產(chǎn)線上產(chǎn)品數(shù)量統(tǒng)計、公交車智能計數(shù)問候(需添加語音芯片)、超市內(nèi)人數(shù)統(tǒng)計等公共場合。另外,添加串口通信部分便可實現(xiàn)與PC數(shù)據(jù)交換的功能。 由于,實驗簡化了,剩下不少零件和資金,所以我們又做了兩項其他的實驗。
標(biāo)簽: 單片機 紅外 控制系統(tǒng)設(shè)計 原理圖
上傳時間: 2013-12-22
上傳用戶:tangsiyun
The C500 microcontroller family usually provides only one on-chip synchronous serialchannel (SSC). If a second SSC is required, an emulation of the missing interface mayhelp to avoid an external hardware solution with additional electronic components.The solution presented in this paper and in the attached source files emulates the mostimportant SSC functions by using optimized SW routines with a performance up to 25KBaud in Slave Mode with half duplex transmission and an overhead less than 60% atSAB C513 with 12 MHz. Due to the implementation in C this performance is not the limitof the chip. A pure implementation in assembler will result in a strong reduction of theCPU load and therefore increase the maximum speed of the interface. In addition,microcontrollers like the SAB C505 will speed up the interface by a factor of two becauseof an optimized architecture compared with the SAB C513.Moreover, this solution lays stress on using as few on-chip hardware resources aspossible. A more excessive consumption of those resources will result in a highermaximum speed of the emulated interface.Due to the restricted performance of an 8 bit microcontroller a pin compatible solution isprovided only; the internal register based programming interface is replaced by a set ofsubroutine calls.The attached source files also contain a test shell, which demonstrates how to exchangeinformation between an on-chip HW-SSC and the emulated SW-SSC via 5 external wiresin different operation modes. It is based on the SAB C513 (Siemens 8 bit microcontroller).A table with load measurements is presented to give an indication for the fraction of CPUperformance required by software for emulating the SSC.
標(biāo)簽: synchronous Emulating serial
上傳時間: 2014-01-31
上傳用戶:z1191176801
All inputs of the C16x family have Schmitt-Trigger input characteristics. These Schmitt-Triggers are intended to always provide proper internal low and high levels, even if anundefined voltage level (between TTL-VIL and TTL-VIH) is externally applied to the pin.The hysteresis of these inputs, however, is very small, and can not be properly used in anapplication to suppress signal noise, and to shape slow rising/falling input transitions.Thus, it must be taken care that rising/falling input signals pass the undefined area of theTTL-specification between VIL and VIH with a sufficient rise/fall time, as generally usualand specified for TTL components (e.g. 74LS series: gates 1V/us, clock inputs 20V/us).The effect of the implemented Schmitt-Trigger is that even if the input signal remains inthe undefined area, well defined low/high levels are generated internally. Note that allinput signals are evaluated at specific sample points (depending on the input and theperipheral function connected to it), at that signal transitions are detected if twoconsecutive samples show different levels. Thus, only the current level of an input signalat these sample points is relevant, that means, the necessary rise/fall times of the inputsignal is only dependant on the sample rate, that is the distance in time between twoconsecutive evaluation time points. If an input signal, for instance, is sampled throughsoftware every 10us, it is irrelevant, which input level would be seen between thesamples. Thus, it would be allowable for the signal to take 10us to pass through theundefined area. Due to the sample rate of 10us, it is assured that only one sample canoccur while the signal is within the undefined area, and no incorrect transition will bedetected. For inputs which are connected to a peripheral function, e.g. capture inputs, thesample rate is determined by the clock cycle of the peripheral unit. In the case of theCAPCOM unit this means a sample rate of 400ns @ 20MHz CPU clock. This requiresinput signals to pass through the undefined area within these 400ns in order to avoidmultiple capture events.For input signals, which do not provide the required rise/fall times, external circuitry mustbe used to shape the signal transitions.In the attached diagram, the effect of the sample rate is shown. The numbers 1 to 5 in thediagram represent possible sample points. Waveform a) shows the result if the inputsignal transition time through the undefined TTL-level area is less than the time distancebetween the sample points (sampling at 1, 2, 3, and 4). Waveform b) can be the result ifthe sampling is performed more than once within the undefined area (sampling at 1, 2, 5,3, and 4).Sample points:1. Evaluation of the signal clearly results in a low level2. Either a low or a high level can be sampled here. If low is sampled, no transition willbe detected. If the sample results in a high level, a transition is detected, and anappropriate action (e.g. capture) might take place.3. Evaluation here clearly results in a high level. If the previous sample 2) had alreadydetected a high, there is no change. If the previous sample 2) showed a low, atransition from low to high is detected now.
標(biāo)簽: Signal Input Fall Rise
上傳時間: 2013-10-23
上傳用戶:copu
蟲蟲下載站版權(quán)所有 京ICP備2021023401號-1