(Microsoft PowerPoint - 102_ASP TW_CH [\254\333\256e\274\322\246\241])

Size: px
Start display at page:

Download "(Microsoft PowerPoint - 102_ASP TW_CH [\254\333\256e\274\322\246\241])"

Transcription

1 102 ASP PIC18F 基礎課程 架構 架構 指令集 指令集 組合語言 組合語言 基本週邊 Microchip Technology Taiwan Slide 1

2 歡迎參加 102 ASP 教育訓練課程 使用軟體工具 MPLAB IDE v8.xx ( 或更新版本 ) MPASM, MPLINK, MPLIB 使用硬體工具 MPLAB ICD2 Microchip APP001 Workshop Board (PIC18F4520 inside) 參考書籍 ( 可以從網站上下載 ) MPASM User s Guide with MPLINK and MPLIB (DS33014J) MPLAB IDE User s Guide PIC18F4520 Data Sheet ( DS39631A ) Microchip Technology Taiwan Slide 2

3 PIC18F 系列 102 ASP 課程內容 PIC18F MCU 的架構 PIC18F MCU 指令集 PIC18F MCU 主要周邊功能 開發工具介紹與使用 撰寫 PIC18 系列組合語言 MPLAB-IDE 的基本設定及 ICD2 的實際除錯 練習一 : I/O 的操作 練習二 : 使用 Timer1 與中斷 練習三 : 使用 A/D 轉換器 練習四 : 使用 USART 練習五 : Table Read Microchip Technology Taiwan Slide 3

4 PIC18F452 最早的 PIC18Fxxx 元件, 目前 Silicon Revision C1 32KBytes Flash, 256B EEPROM, 1.5KB RAM Timer : Timer0, 1, 2, 3, Watch-Dog Timer 3 CCP modules I 2 C, SPI, USART, PSP 10-bit ADC with 8 Channel PBOR, PLVD, ICD, Self Programming 40-pin PDIP(44ML, 44PT) with 34 I/O pin 5V 新建議元件 PIC18F4520 Microchip Technology Taiwan Slide 4

5 新改良 PIC18Fxxxx ( 四碼 ) 基本架構仍是採用 PIC18F452 核心 Extended Instruction Sets for C18 Compiler Efficiency Support nano-watt Technology 內建 31KHz ~ 8MHz 自由切換的 RC 震盪器 快速 RC 啟動模式 雙速啟動模式 系統時脈監視 / 故障切換功能 Low-Power Watch-Dog Timer Ultra Low-Power Wake-Up 省電模式 : Idle, Sleep Microchip Technology Taiwan Slide 5

6 PIC18Fxxxx Enhanced PICmicro MCU 的架構及主要特色 Microchip Technology Taiwan Slide 6

7 PIC18Fxxxx PIC18 系列 MCU 的主要特色 提供較多的指令 (77 個基本指令 ) 更大的程式與資料記憶體的定址能力 Program Memory : Up to 2M Bytes Data Memory : Up to 4K 程式記憶體使用線性排列方式存取 提供 Access Bank 設計觀念 內建 PLL 4 倍頻線路, 用 10Mhz 就得到 10 MIPs 的執行效能 ( 100 ns 的指令執行時間 ) 有 8 * 8 的硬體乘法器 全系列提供 10 Bits 的 A/D 轉換器及 ICD 除錯功能 Microchip Technology Taiwan Slide 7

8 PIC18F4520 增加的功能 FLASH Program Memory 除了程式記憶體為 FLASH 外, CPU 可自我燒錄程式 10 萬次的寫入壽命 ICD Capability 支援 ICD 的介面 高燒錄效率,PIC18F4520 燒錄時間約 3 秒 ( 32KB 程式 ) 每個 CPU 都可視為一個 ICE Chip EEPROM PIC18F4520 都有內建 256 Bytes 的 EEPROM 100 萬次的寫入壽命 Microchip Technology Taiwan Slide 8

9 PIC18F4520 nanowatt 技術 什麼是 nano-watt 技術 Sleep Mode 下消耗功率低於 1uW 以下 PIC18F4520 Sleep Mode 下低於 0.1uA 內建的電源管理 內建 31KHz ~ 8MHz 自由切換的 RC 震盪器 快速 RC 啟動模式 雙速啟動模式 系統時脈監視 / 故障切換功能 Low-Power Watch-Dog Timer Ultra Low-Power Timer1 硬體設定或軟體控制的 Watch-Dog Timer 省電模式 : Idle (5.8uA), Sleep (0.1uA) Microchip Technology Taiwan Slide 9

10 一般 PICmicro 的架構比較 PIC 使用 使用 Harvard Architecture 經由相同的匯流排來存取指令與資料 指令與資料無法有效率的同時被處理 以及 MCU 的操作效率受到此結構影響而變差 使用兩個匯流排來存取程式碼和資料 增加處理資料的效能 Microchip Technology Taiwan Slide 10 使得 MCU 可以具有不同寬度的程式記憶 體與資料記憶體 ( 8 Bit 寬的 Data Memory, 12/14/16 Bit 寬的 Program Memory)

11 Instruction Pipelining ( 管線式的指令執行 ) 指令的提取與執行是同時進行的 ( 因為內部的 Bus 是分開的 ) 程式分支的有關指令 ( 例如 : GOTO, CALL 或 Write to PC) 則需要兩個指令周期 指令週期 MAIN 程式範例 程式範例 T0 T1 T2 T3 T4 T5 movlw 0x05 movwf REG1 rcall SUB1 addwf REG2 Fetch Execute Fetch Execute Fetch 此階段執行一般指令 Execute Fetch Flush T6 T7 此階段執行 rcall 指令並包含了放棄預提取指令 Fetch SUB1 SUB2 movf PORTB,w return movf PORTC,w return Fetch Execute Fetch Execute Fetch Flush Microchip Technology Taiwan Slide 11

12 預提取指令 Instruction Pipelining 執行指令 movlw 0x05 - 指令週期 MAIN 程式範例 movlw 0x05 movwf REG1 rcall SUB1 addwf REG2 T0 Fetch 51 SUB1 movf PORTB,w 52 return 53 SUB2 movf PORTC,w 54 return Microchip Technology Taiwan Slide 12

13 Instruction Pipelining 預提取指令 movwf REG1 執行指令 movlw 0x05 指令週期 MAIN 程式範例 movlw 0x05 movwf REG1 rcall SUB1 addwf REG2 T0 Fetch T1 Execute Fetch 51 SUB1 movf PORTB,w 52 return 53 SUB2 movf PORTC,w 54 return Microchip Technology Taiwan Slide 13

14 Instruction Pipelining 預提取指令 rcall SUB1 執行指令 movwf REG1 指令週期 MAIN 程式範例 movlw 0x05 movwf REG1 rcall SUB1 addwf REG2 T0 T1 T2 Fetch Execute Fetch Execute Fetch 此階段執行一般指令 51 SUB1 movf PORTB,w 52 return 53 SUB2 movf PORTC,w 54 return Microchip Technology Taiwan Slide 14

15 Instruction Pipelining 預提取指令 addwf REG2 執行指令 rcall SUB1 指令週期 MAIN 程式範例 movlw 0x05 movwf REG1 rcall SUB1 addwf REG2 T0 T1 T2 T3 Fetch Execute Fetch Execute Fetch Execute Fetch 51 SUB1 movf PORTB,w 52 return 53 SUB2 movf PORTC,w 54 return Microchip Technology Taiwan Slide 15

16 Instruction Pipelining 預提取指令 movf PORTB,w 執行指令 rcall SUB1 指令週期 MAIN 程式範例 movlw 0x05 movwf REG1 rcall SUB1 addwf REG2 T0 T1 T2 T3 T4 Fetch Execute Fetch Execute Fetch Execute Fetch Flush 放棄 rcall 指令, 重新提取下一個指令 51 SUB1 movf PORTB,w 52 return 53 SUB2 movf PORTC,w 54 return Microchip Technology Taiwan Slide 16 Fetch

17 Instruction Pipelining 預提取指令 return 執行指令 movf PORTB,w 指令週期 MAIN 程式範例 movlw 0x05 movwf REG1 rcall SUB1 addwf REG2 T0 T1 T2 T3 T4 T5 Fetch Execute Fetch Execute Fetch Execute Fetch Flush 51 SUB1 movf PORTB,w 52 return 53 SUB2 movf PORTC,w 54 return Microchip Technology Taiwan Slide 17 Fetch Execute Fetch

18 Instruction Pipelining 預提取指令 movf PORTC,w 執行指令 return 指令週期 MAIN 程式範例 movlw 0x05 movwf REG1 rcall SUB1 addwf REG2 T0 T1 T2 T3 T4 T5 T6 Fetch Execute Fetch Execute Fetch Execute Fetch Flush 51 SUB1 movf PORTB,w 52 return 53 SUB2 movf PORTC,w 54 return Microchip Technology Taiwan Slide 18 Fetch Execute Fetch Execute Fetch

19 Instruction Pipelining 預提取指令 addwf REG2 執行指令 return 指令週期 MAIN 程式範例 movlw 0x05 movwf REG1 rcall SUB1 addwf REG2 T0 T1 T2 T3 T4 T5 T6 T7 Fetch Execute Fetch Execute Fetch Execute Fetch Flush Fetch SUB1 SUB2 movf PORTB,w return movf PORTC,w return Fetch Execute Fetch Execute Fetch Flush Microchip Technology Taiwan Slide 19

20 PICmicro MCU 的架構 長指令寬度的編碼方式 (Long Word Instruction ) PIC 指令寬度有分成三種 12, 14 or 16-bits, 這種指令寬度稱為長指令 ( Long Word Instruction ) PIC 的資料匯流排 (Data Bus) 寬度是 8 bits, 所以 PIC 是一個 8-bit MCU 若於 PIC18Fxxxx 具備 2K x 16 words 的程式記憶體, 可完成的工作約相當於其他有 4K 記憶體的 MCU ( 80C51). 單一周期的指令運作使 MCU 的處理能力提高許多 Microchip Technology Taiwan Slide 20

21 PICmicro MCU 的架構 長指令寬度的編碼方式 (Long Word Instruction ) PIC MCU movlw #imm<8> k k k k k k k k MC68HC05 ldaa k k k k k k k k #imm<8> Microchip Technology Taiwan Slide 21

22 PIC18F452 基本架構圖 PORTA 21 Program Memory Table Pointer <2> Inc/dec logic Program Bus PCLATU PCLATH PCU PCH PCL Program Counter 31 Level Stack TABLELATCH 8 BSR Data RAM 12 (2) Address<12> 4 12 FSR0 FSR1 FSR2 Instruction Register 12 Data Bus BIT OP 8 PRODH PRODL 8 x 8 Multiply 8 WREG 8 ALU<8> MSSP PORTB PORTC PORTD PORTE OSC2/CLK0 OSC1/CLK1 VDD,VSS MCLR T1OS1 T1OSO Timing Generation 4X PLL Precision Voltage Reference Power-up Timer Oscillator Start-up Timer Power-on Reset Watchdog Timer Brown-out Reset In-circuit Debugger Instruction Decode and Control USART CCP TIMER A/D Microchip Technology Taiwan Slide 22

23 引用 引用 Register File 的觀念 w ALU f Data Memory (Register File) 07h 08h 09h SFR s 位於 Bank 15 所有指令皆可對任一暫存器操作, 無須切換 Bank d w f Data Bus 0Ah 0Bh 0Ch 0Dh 0Eh Long word 的指令讓各暫存器可被直接定址 MOVFF src, dest 0Fh WREG 10h 周邊暫存器及狀態暫存器皆為 Register files 的一部份 Opcode d a Address 指令解碼 結果儲存控制 資料來源的位址 與執行 Microchip Technology Taiwan Slide 23

24 Data Memory 架構 有 16 banks 的 Data Memory, 每個 Bank 由 256 Bytes 組成 ( Max. 4K Bytes ) Special Function Registers (SFRs) 被安排在 Bank 15 使用 BSR<3:0> 來選擇適當的 BANK 或使用 BANKSEL 來做切換 BANK 的工作 MOVFF 指令可免去切換 BANK 的工作, 但需 2 words 的指令空間來完成 使用 Access Bank 的暫存器, 無須做 Bank 的切換 000h 07Fh 080h 0FFh 100h 1FFh 200h 2FFh D00h DFFh E00h EFFh F00h F7Fh F80h FFFh Access RAM Bank 0 GPR Bank 1 GPR Bank 2 GPR Bank 13 GPR Bank 14 GPR Bank 15 GPR Access SFR PIC16F8F2520/4520 暫存器的分布 Access Bank Access RAM Access SFR 256 Bytes 00h 7Fh 80h FFh Microchip Technology Taiwan Slide 24

25 PIC18 系列的架構 Program Memory 最大可達 2M Bytes ( 21 bits) PC<20:0> 的程式空間 Reset Vector 位於程式位址 0x0000 高優先權中斷向量的位址位於 0008h CALL, RCALL, RETURN RETFIE, RETLW Stack Level 1 Stack Level 31 Reset Vector High Priority Interrupt Vector Low Priority Interrupt Vector 000h 008h 018h User Memory Space 低優先權中斷向量的位址位於 0018h On-Chip Programming 31 層獨立的位址堆疊區 Microchip Technology Taiwan Slide 25 Read 0 1FFFFFh h

26 豐富的內部與外部中斷來源 PIC18 系列的架構 Interrupt Overview 幾乎所有周邊皆有中斷 CPU 的能力 有些 I/O 的變化也可構成中斷條件 (PORTB) 每個周邊中斷可以被設定成具有高 / 低優先權 ( Hi/Low Priority) INT0 永遠為高優先權外部中斷 具相同優先權設定的中斷則可由軟體來決定其優先順序 有整體及各別的中斷致能控制位元 每個中斷都有其獨立的中斷旗標, 可用軟體詢問的方式 大部份的中斷可以用來喚醒處於 SLEEP 狀態的 PICmicro 中斷延遲固定為 3 個 cycle 容易以軟體來判斷中斷的經過時間 Microchip Technology Taiwan Slide 26

27 PIC18 系列的架構 高優先全中斷邏輯架構 TMR0IF TMR0IE TMR0IP RBIF RBIF RBIF INT0IF INT0IE INT1IF INT1IE INT1IP INT2IF INT2IE INT2IP Peripheral Interrupt Enabled bit Peripheral Interrupt Flag bit Peripheral Interrupt Priority bit Additional Peripheral Interrupts High Priority Interrupt Generation IPEN From (a) IPEN GIEL/PEIE IPEN Interrupt to CPU Vector to location 0008h (High Priority Interrupt Vector Address) GIEH/GIE High Priority Interrupt initialized (Disable low priority interrupts) To (c) From (b) Microchip Technology Taiwan Slide 27

28 PIC18 系列的架構低優先全中斷邏輯架構 Peripheral Interrupt Enabled bit Peripheral Interrupt Flag bit Peripheral Interrupt Priority bit Additional Peripheral Interrupts To (a) To (b) From (c) Wake-up (if in SLEEP mode) Interrupt to CPU Vector to Location 0018h (Low Priority Interrupt Vector Address) TMR0IF TMR0IE TMR0IP RBIF RBIF RBIF INT0IF INT0IE GIEH/GIE INT1IF INT1IE INT1IP INT2IF INT2IE INT2IP Microchip Technology Taiwan Slide 28

29 PIC18 系列的架構 Clocking Scheme 一個指令周期等於輸入 CPU 頻率的 1/4 若 CPU 操作於 40 Mhz 時, 其指令周期為 100 ns Fosc 振盪頻率 / 4 = Tosc 指令週期 指令週期 一般性的動作 解碼 讀取 執行 寫入 Microchip Technology Taiwan Slide 29

30 PIC18Fxxxx 定址模式 Microchip Technology Taiwan Slide 30

31 18Fxxxx 定址模式 四種基本的定址模式 立即定址模式 直接定址模式 間接定址模式 相對定址模式 Microchip Technology Taiwan Slide 31

32 PIC18 定址模式立即數的操作 8-bit 的常數值 (literal value) 被包含於程式碼之中 使用於 literal instructions, 例如 movlw, addlw, retlw, etc. OP CODE k k k k k k k k Microchip Technology Taiwan Slide 32

33 PIC18 定址模式 Data Memory: 直接定址 (Banked) Data Memory 總共有效位址為 12 Bits ( 4K Bytes ) 8-bit 的直接位址由指令中得到 其他高位的 4-bits 由 BSR<0..3> 獲得 BSR<7:4> BSR<3:0> OP CODE f f f f f f f f BSR<3:0> f f f f f f f f Microchip Technology Taiwan Slide 33

34 直接定址 範例 BSR 4-bits from BSR Register f Operand 8-bits Encoded in Instruction Effective Address = 120 MyReg equ 0x120 MyReg Access RAM Bank 0 Bank 1 AA Bank 2 120h movlw b movwf TRISB, a bsf PORTB, 0, a movlb 0x01 ; 選擇 BANK 1 movlw 0xAA movwf MyReg PORTB LATB TRISB BSR WREG Bank 15 Access SFR FE FF F0 FF FF F81h F8Ah F93h FE0h FE8h Microchip Technology Taiwan Slide 34

35 PIC18 定址模式 Data Memory : 直接定址 ( Non Banked) MOVFF src, dest ( RAM 對 RAM 的資料搬移 ) 2 Word 的指令, 直接指定兩個 4K 的位址 n n n n n n n n n n n n 來源位址 (Source) n n n n n n n n n n n n 目的位址 (Destination) 善用 Access BANK 或選擇 BANKED 的 Single Word 指令可增加執行效能及佔用較少的程式記憶體 Microchip Technology Taiwan Slide 35

36 PIC18 定址模式 Data Memory: 間接定址 (Indirect addressing) 三個 12-bit 寬的間接定址暫存器 FSR0, FSR1, FSR2 FSRn (File Select Register) 的內容可做以下調整 : Pre-Incremented : (PREINCx) 先被加一再存取其內容 Post-Incremented : (POSTINCx) 存取完 FSRn 所指內容後將 FSRn 加 1 Post-Decremented : (POSTDECx) 存取完 FSRn 所指內容後將 FSRn 減 1 Offset by WREG value (signed):(pluawx) FSRn 不變, 以 W 為偏移值相加後以產生新的索引指標 保持不變 : (INDFx) Microchip Technology Taiwan Slide 36 f f f f f f f f f f f f

37 PIC18 定址模式 Data Memory: 間接定址 (Indirect Addressing) 範例 : 清除由位址 0x000 to 0x5FF 的資料內容 間接位址被寫入 FSRn 中 每當 INDFn 被當成運算元 (operand) operand), 實際上被操作的位址乃是由 FSRn 內容所指的位址 類似 定址法, 但功能更齊全 _Loop movlw 0x05 ; Value to compare lfsr 1,0x000 ; Clear address from 0 clrf POSTINC1 ; Clear, increment FSR1 cpfsgt FSR1H ; FSR1H > 5? ( 0x600 ) goto _Loop ; NO, loop : ; YES, next instruction Microchip Technology Taiwan Slide 37

38 PIC18 定址模式相對定址使用方法 PIC18 系列的程式計數器為 21 Bits, 無法以 8 Bit 的 Data Bus 直接將其修改, 故以栓鎖 ( Latch Buffer ) 的架構來輔助以達成修改的工作 先將欲執行位址的高位元部份寫入 PCLATU 和 PCLATH 最後將低位元部份寫入 PCL, 此時存於此三個暫存器的 21-bit 內容將被一次寫入 Program Counter Microchip Technology Taiwan Slide 38

39 利用此方式就可以達到 GOTO 的位址計算, 直接修改 program counter 相對定址說明 PCLATU WREG bit Data Bus PCLATH 12 PCU PCH PCL FF FF 25 To write to PC: ❶ Write upper byte to PCLATU ❷ Write high byte to PCLATH ❸ Write low byte to PCL PC_OFFSET = movlw UPPER 0x movwf PCLATU movlw HIGH 0x movwf PCLATH movff PC_OFFSET, PCL 25 Microchip Technology Taiwan Slide 39

40 PC 相對定址 : 計算 GOTO 位址 計算 GOTO 位址, 使用索引查 表方式建立跳躍表格 org 0x JTS movlw UPPER JUMP_TABLE movwf 0x movlw HIGH JUMP_TABLE movwf PCLATH movlw 0x04 mulwf USER_INPUT movf PRODL W addwf PCL, f JUMP_TABLE goto DoUserInput0 goto DoUserInput1 goto DoUserInput2 goto DoUserInput3 goto DoUserInput4 Microchip Technology Taiwan Slide 40 USER_INPUT 02 WREG 08 PCLATU PCLATH FF FF FF PCU PCH PCL 計算跳躍的偏移量位址每一個 goto 指令佔 4 bytes: 所以要乘四後才可以得到正確的偏移位址

41 Top of Stack Registers PIC18 Return Address Stack STKPTR Register Program Counter TOSU TOSH TOSL STKOVF STKUNF SP4:SP0 PCU:PCH:PCL Events that push PC+2 onto the stack: PUSH CALL RCALL Interrupt Events that pop the top of the stack: POP RETURN RETLW RETFIE PCLATU 及 PCLATH 不受任何的 Return 指令影響 每層的堆疊寬度為 21-bit ( 整個 4M 位址 ) 只有 STKPTR 所指到的最上層的堆疊資料 (TOSU, TOSH, TOSL) 允許被程式讀取或修改 Microchip Technology Taiwan Slide Stack xxxxxx xxxxxx Stack Level xxxxxx 01 堆疊方向

42 PIC18FXXX 指令集 Microchip Technology Taiwan Slide 42

43 77 個指令 PIC18 系列 MCU 指令集 Instruction Set Overview 73 個是 Single Word 指令 4 個 two-word 指令 : MOVFF, LFSR, CALL, GOTO 55% 的指令只需 single cycle 即可完 4 個 two word 的指令須耗費 2 周期 10 個 branches, calls 會依情況耗費一或兩個周期 8 個對 Table 操做的指令為 2 周期 3 個 return 的指令需耗費 2 周期 10 個條件式的 SKIP 指令依狀況需耗費 1 or 2 周期 Microchip Technology Taiwan Slide 43

44 PIC18 系列 MCU 指令集 Instruction Set Overview 具有記憶體直接搬移的指令 Data memory 對 Data memory 的直接操作 Data memory 對 Program memory 的讀取或寫入 Single cycle 的 8 x 8 硬體乘法器 (100 ns) 完整的位元操作指令 單一執行周期的 bit set,clear 或 toggle 操作 直接可對所有暫存器做位元操作 ( 包括 I/O Port ) Microchip Technology Taiwan Slide 44

45 PIC18 系列 MCU 指令集 Summary (16-bit core) Byte-Oriented Operations ADDWF f, d, a Add WREG and f ADDWFC f, d, a Add WREG and f ANDWF f, d, a AND WREG and f CLRF f, a Clear f COMF f, d, a Complement f CPFSEQ f, a Compare f with WREG, skip = CPFSGT f, a Compare f with WREG, skip > CPFSLT f, a Compare f with WREG, skip < DECF f, d, a Decrement f DECFSZ f, d, a Decrement f, skip if zero DCFSNZ f, d, a Decrement f, skip if not zero INCF f, d, a Increment f INCFSZ f, d, a Increment f, skip if zero INFSNZ f, d, a Increment f, skip if not zero IORWF f, d, a Inclusive OR WREG and f MOVF f, d, a Move f MOVFF fs, fd Move fs (source) to fd (destination) MOVWF f, a Move WREG to f Byte -Oriented Operations MULWF f, a Multiple WREG with f NEGF f, a Negate f RLCF f, d, a Rotate left f through carry RLNCF f, d, a Rotate left f, no carry RRCF f, d, a Rotate right f through carry RRNCF f, d, a Rotate right f, no carry SETF f, a Set f SUBFWB f, d, a Subtract f from WREG with borrow SUBWF f, d, a Subtract WREG from f SUBWFB f, d, a Subtract WREG from f with borrow SWAPF f, d, a Swap nibbles of f TSTFSZ f, a Test f, skip if zero XORWF f, d, a Exclusive OR WREG and f f = File Register, d = destination (1=f, 0=WREG), a = access bank (0=access bank, 1=BSR) Microchip Technology Taiwan Slide 45

46 PIC18 系列 MCU 指令集 Summary (16-bit core) BCF BSF BTG BTFSC BTFSS Bit -Oriented Operations f, b, a Bit clear f f, b, a Bit set f f, b, a Bit toggle f f, b, a Bit test f, skip if clear f, b, a Bit test f, skip if set Data Memory <--> Program Memory Operations TBLRD* - Table Read TBLRD*+ - Table Read with post-inc. TBLRD*- - Table Read with post-dec. TBLRD+* - Table Read with pre-inc. TBLWT* - Table Write TBLWT*+ - Table Write with post-inc. TBLWT*- - Table Write with post-dec. TBLWT+* - Table Write with pre-inc. Literal Operations ADDLW k Add literal with WREG ANDLW k AND literal with WREG IORLW k Inclusive OR literal with WREG LFSR f, k Move literal to FSRn MOVLB k Move literal to BSR MOVLW k Move literal to WREG MULLW k Multiply literal to WREG RETLW k Return, place literal in WREG SUBLW k Subtract WREG from literal XORLW k Exclusive OR literal with WREG f = File Register, k = literal value (8-bit), b = bit address (0-7) Microchip Technology Taiwan Slide 46

47 Control Operations PIC18 系列 MCU 指令集 Summary (16-bit core) Control Operations BC n Branch if Carry (n is 8-bit) BN n Branch if Negative (n is 8-bit) BNC n Branch if No Carry (n is 8-bit) BNN n Branch if Not Negative (n is 8-bit) BNOV n Branch if No Overflow (n is 8-bit) BNZ n Branch if Not Zero (n is 8-bit) BOV n Branch if Overflow (n is 8-bit) BRA n Branch (n is 11-bit) BZ n Branch if Zero (n is 8-bit) CALL n, s Call subroutine (n is 20-bit) CLRWDT - Clear Watchdog Timer DAW - Decimal Adjust WREG GOTO n Go to address (n is 20-bit) NOP - No Operation POP - Pop top of return stack (TOS) PUSH - Push top of return stack (TOS) RCALL n Relative call (n is 11-bit) RESET - Software device reset RETFIE s Return from interrupt enable RETLW k Return, place literal in WREG RETURN s Return from subroutine SLEEP - Go into standby mode n = absolute address or address offset, k = literal value (8-bit), s = fast restore Microchip Technology Taiwan Slide 47

48 Byte-Oriented Operations ADDWF ADDWFC ANDWF CLRF COMF CPFSEQ CPFSGT CPFSLT DECF DECFSZ DCFSNZ INCF INCFSZ INFSNZ IORWF MOVF MOVFF MOVWF f, d, a f, d, a f, d, a f, a f, d, a f, a f, a f, a f, d, a f, d, a f, d, a f, d, a f, d, a f, d, a f, d, a f, d, a fs, fd f, a PIC18 系列 MCU 指令集 以位元組為操作的對象 16-bit Instruction for Byte Oriented Operations OP CODE d = Destination Bit d = 0 運算結果置於 W d = 1 運算結果置於 F (Default d=1) a = Access Bit a = 0 指定置於 Access Bank 的暫存器 (Default a=0, 或不寫 ) a = 1 實際的位址由 BSR 與 8-bit 的暫存器位址組成 d a f f f f f f f f f = 8-bit 暫存器位址 Example: ADDWF 0, 0 ADDWF f, d, a Microchip Technology Taiwan Slide 48

49 Byte-Oriented Operations MULWF NEGF RLCF RLNCF RRCF RRNCF SETF SUBFWB SUBWF SUBWFB SWAPF TSTFSZ XORWF f, a f, a f, d, a f, d, a f, d, a f, d, a f, a f, d, a f, d, a f, d, a f, d, a f, a f, d, a PIC18 系列 MCU 指令集 以位元組為操作的對象 16-bit Instruction for Byte Oriented Operations OP CODE d = Destination Bit d = 0 運算結果置於 W d = 1 運算結果置於 F a = Access Bit d a = 0 指定置於 Access Bank 的暫存器 a = 1 實際的位址由 BSR 與 8-bit 的暫存器位址組成 a f f f f f f f f f = 8-bit 的暫存器位址 Example: SUBWF VAR1, 0, 0 SUBWF AD_VALUE, 0, a Microchip Technology Taiwan Slide 49

50 Bit-Oriented Operations BCF BSF BTG BTFSC BTFSS f, b, a f, b, a f, b, a f, b, a f, b, a PIC18 系列 MCU 指令集 以位元組為操作的對象 16-bit Instruction for Bit Oriented Operations OP CODE b b = 3-Bit, 用來指定欲操作位元的位址 (Bit Number) a = Access Bit Example: BTFSC STATUS, C, 0 BTFSC FLAGS, BIT_0, a b b a = 0 指定置於 Access Bank 的暫存器 a = 1 實際的位址由 BSR 與 8-bit 的暫存器位址組成 a f f f f f f f f f = 8-bit 的暫存器位址 Microchip Technology Taiwan Slide 50

51 Literal Operations ADDLW ANDLW IORLW LFSR MOVLB MOVLW MULLW RETLW SUBLW XORLW Example: MOVLW MOVLW k k k f, k k k k k k k 0x5A CONST PIC18 系列 MCU 指令集 立即數操作 用來操作 FSR 的 16-bit, 2 Word 指令 LFSR f Microchip Technology Taiwan Slide 51 f = 2-bit FSR 的選擇位元 f k k k k K K K K k k k k k = 用來指定 FSRn 的 12-bit 立即值 其他操作常數運算元的 16-bit 指令 OP CODE k k = 8-bit Immediate Value k k k k k k k

52 Control Operations BC BN BNC BNN BNOV BNZ BOV BRA BZ CALL GOTO RCALL n n n n n n n n n n, s n n PIC18 系列 MCU 指令集 Control Operations 16-bit Instruction for CALL and GOTO OP CODE s n n n n n n n n OP CODE n n n n n n n n n n n n s = 1-bit 選擇是否使用 fast Save/Restore 的功能 k = 20-bit 位址的立即值 A0=0 16-bit Instruction for RCALL and BRA OP CODE PC<20:1> n n n n n n n n n n n k = 11-bit 位址的立即值 Microchip Technology Taiwan Slide 52

53 PIC18 系列 MCU 指令集 Control Operations Control Operations CLRWDT - DAW - NOP - POP - PUSH - RESET - SLEEP - RETURN - RETLW k RETURN s RETFIE s 16-bit Instruction for RETLW OP CODE k k = 欲置於 W 暫存器後返回的 8-bit 資料 16-bit Instruction for RETURN OP CODE s = 1- bit, 選擇是否使用 Fast Save/Restore 的功能 k k k k k k k s Microchip Technology Taiwan Slide 53

54 PIC18 系列 MCU 指令集 Data Memory <> Program Memory Table Pointer Operations TBLRD* - TBLRD*+ - TBLRD*- - TBLRD+* - TBLWT* - TBLWT*+ - TBLWT*- - TBLWT+* - 16-bit Instruction for TBLRD* or TBLWT* OP CODE nn = 00 * ( 指標不變 ) nn = 01 *+ ( 查表後指標加一 ) nn = 10 *- ( 查表後指標減一 ) n n nn = 11 +* ( 先將指標加一再查表 ) Microchip Technology Taiwan Slide 54

55 PIC18FXXX 加強的部份 Access BANK 的資料般移 BSR<3:0> = 0000b = 0001b = 0010b = 0011b = nnnnb Bank 0 Bank 1 Bank 2 Bank 3 Bank n 00h FFh 00h FFh 00h FFh 00h FFh 00h FFh Access RAM GPR GPR GPR GPR 000h 07Fh 080h 0FFh 100h 1FFh 200h 2FFh 300h 3FFh MOVF FREG,W,0(1) 當指令中的選項位元 a = 0, BSR 的內容將不被使用而以 Virtual RAM bank 來取代. Access Bank 前半部由 Bank 0 的部份一般暫存器組成, 而後半部則由特殊功能暫存器 (SFRs) 組合而成 ( from Bank 15 ) Access Bank Access RAM Access SFR 00h 7Fh 80h FFh = 1100b = 1101b = 1110b = 1111b Bank 12 Bank 13 Bank 14 Bank 15 00h FFh 00h FFh 00h FFh 00h FFh GPR or SFR GPR or SFR Access SFR Microchip Technology Taiwan Slide 55 C00h CFFh D00h DFFh E00h EFFh F00h F7Fh F80h FFFh Access RAM 與 Access SFR 的實際大小視不同的編號而有所差異 當指令中的選項位元 a =1, BSR 被用來配合指令中指定的位址一起形成 12 bits 的實際位址

56 PIC18FXXX 加強的部份 相當有彈性的資料指標 3 個資料指標, 各有五種操作模式 更方便且有效率的 Table Read/Write 功能 以 Byte 為操作單位 多種的指標更新選項 用簡單的指令集來支援複雜的架構 新的 MOVFF,BRA, 以及條件式分支指令 Microchip Technology Taiwan Slide 56

57 PIC18FXXX 加強的部份 資料指標 ( Data Pointer ) 總共有三個獨立的指標 FSR0, FSR1, FSR2 指標為 12 Bits, 可定址 4K 的資料空間 指標有兩個暫存器組成 ( 例 : FSR0L, FSR0H) 五種指標的操作方式 ( 使用不同的虛擬暫存器 ) INDFn : 直接操作指標所指的內容 POSTINCn : 操作指標所指內容後將指標加一 POSTDECn : 操作指標所指內容後將指標減一 PREINCn : 將指標先加一後再對指標所指位址操作 PLUSWn : 將 WREG 的內容作為 Offset 值與 FSRn 相加後以其結果為指標來存取記憶體 Microchip Technology Taiwan Slide 57

58 PIC18xxxx 特殊功能 Microchip Technology Taiwan Slide 58

59 PIC18 振盪器選擇 XT HS Standard frequency crystal oscillator High frequency crystal oscillator 100kHz - 4MHz DC - 40MHz HS+PLL High frequency crystal with 4x PLL 4MHz - 10MHz LP RC Low frequency crystal oscillator External RC oscillator 5kHz - 200kHz DC - 4MHz RCIO External RC oscillator, OSC2=RA6 DC - 4MHz INTRC Internal RC oscillator Various EC External Clock, OSC2=f osc /4 DC - 40MHz ECIO External Clock, OSC2=RA6 DC - 40MHz 提供多樣的振盪器選擇方式, 讓設計更加彈性 : LP 振盪模式提供了低功耗功能 RC 或 INTRC 振盪模式提供了低成本的效益 XT 提供一般使用的工作頻率 HS 提供需高速處理所需的工作頻率 速度範圍參考資料手冊所建議的範圍 Microchip Technology Taiwan Slide 59

60 設定 Configuration Word 的方式 直接在 MPLAB IDE 下設定 先確定 MPLAB IDE 使用的元件名稱 MPLAB IDE 目錄下 : Configure Configuration Bits 取消 Configuration Bits Set in code Microchip Technology Taiwan Slide 60

61 程式設定 Configuration Word 一般會建議利用程式內建 Config. 方式來設定 編譯過後,HEX 檔會有設定值的存在 避免燒錄時的人為設定上的選擇錯誤 舊版 MPASM 使用 config 方式, 新版已經改為 CONFIG 的語法 參考 C:\Program Files\Microchip\MPASM Suite\Template\Code 裡的 18f4520tmp.asm 裡的範例 相關設定的定義字參考 inc 檔 list p=18f4520 ; list directive to define processor #include <p18f4520.inc> ; processor specific variable definitions CONFIG OSC = LP, PWRT = ON, WDT = OFF Microchip Technology Taiwan Slide 61

62 什麼是 POR, OST, PWRT POR: 電源開機重置 MCLR 腳接到 VDD, 當 VDD 上升時會產生重置動作 (Reset) PWRT: 電源上電延遲計時器 偵測到電源開機後 (POR), 自動延遲 72mS 以確保 MCU 可以在工作電壓下執行 OST: 振盪器穩定計時器 HS,XT,LP 三種振盪模式的啟動穩定延遲, 自動計數 1024 的 Cycles 後送出振盪信號給 MCU ( 不適用在 RC 模式 ) 只在 POR 啟動後及喚醒睡眠模式下會做此動作確保頻率的穩定 Microchip Technology Taiwan Slide 62

63 睡眠模式 (Sleep Mode) 指微控制器可以執行 Sleep 指令進入休眠狀態節省消耗功率 系統主振盪時脈停止運作 處理器進入靜態的狀態 資料保持不變 Watch-Dog Timer 因使用特定的 RC 振盪可以持續工作不受影響 處理器進入最低耗電模式 通常是漏電流 ( µA typical) MCLR WDT INT TMR1 ADC CMP CCP PORTB SSP PSP 一些可以喚醒睡眠模式的外部觸發事件 Master Clear Pin Asserted (pulled low) Watchdog Timer Timeout INT Pin Interrupt Timer 1 Interrupt (or also TMR3 on PIC18) A/D Conversion Complete Interrupt Comparator Output Change Interrupt Input Capture Event PORTB Interrupt on Change Synchronous Serial Port (I 2 C Mode) Start / Stop Bit Detect Interrupt Parallel Slave Port Read or Write Microchip Technology Taiwan Slide 63

64 計時監視器 (Watchdog Timer) 以硬體方式監測軟體的故障並恢復運作 使用內建的獨立運作的 RC 振盪器 WDT 的時間計數器可以用 CLRWDT 指令歸零 使用 Config 硬體啟動 WDT 後無法用軟體方式關閉 WDT 發生計時溢位時會重置微處理控制器 (Reset MCU) 可程式控制計時溢位間 : 18ms to 3.0s 可以在 SLEEP Mode 下透過溢位來喚醒 CPU WDT Ripple Counter Postscaler WDTEN SWDTEN 8:1 Mux WDT Timeout Microchip Technology Taiwan Slide 64

65 串列燒錄功能 In-Circuit Serial Programming 燒錄時只用到兩支腳位 ( 請勿接電阻到地 ) RB6 PGC RB7 PGD Vpp 會有 13V 的觸發電壓輸入, 要使用 10K ohm 電阻接 Vdd, 最好不要再接電容到地以免影響 Vpp 上升時間造成燒錄錯誤 這種燒錄介面可以使用在 Microchip 所有的開發工具裏 ICD2, ICD3, Real ICE PICkit2, PM3 Pin V PP V DD V SS RB6 RB7 PIC18Fxxxx Function Programming Voltage = 13V Supply Voltage Ground Clock Input Data I/O & Command Input ICSP Connector Microchip Technology Taiwan Slide 65

66 掉電偵測功能 BOR Brown Out Reset 當工作電壓突然掉到所設定的低電壓門檻時,PIC 將會進入重置模式 避免一些奇怪及不可預期的運作 ( 電源不穩時所造成的誤動作 ) 功能像一般具延遲功能的 Reset 電路, 且偵測的電壓門檻是可以設定的以配合各種工作電壓的需求 BOR 功能一但被啟動就無法關閉, 如果要考慮極低的耗電時可能須關閉 BOR 功能 使用 BOR 功能可以防止系統開機不良的情形 短時間內 On, Off, On, Off, On 時所產生的當機 Microchip Technology Taiwan Slide 66

67 PBOR 可程式化掉電偵測功能 直接在 Configuration 設定 ( 燒錄前設定 ) 此功能無法用軟體方式開啟或關閉 可以設定的電壓門檻 BV DD : 2.5V 最低電壓門檻 V DD, 適用在 3.0V 工作電壓 2.7V 適用在 3.3V 工作電壓 4.2V 4.5V 適用在 5V 工作電壓 如果以上的電壓門檻值無法滿足的話, 請使用外加的 Reset 元件 Microchip s supervisor : MCP1xx, MCP8xx/TCM8xx, or TC12xx Microchip Technology Taiwan Slide 67

68 可程式化掉電偵測功能 當 V DD 電壓升高到臨界電壓點以上時, 能持續保持在重置 (Reset) 狀態, 並維持 72mS 的延遲計時 Microchip Technology Taiwan Slide 68

69 可程式化低電壓偵測功能 PLVD Programmable Low Voltage Detect 可以設定比 BOR 更早偵測出掉電 V DD LVDIN LVDCON 狀態, 進行重要資料的保存 (EEPROM) 16 種可以選擇電壓偵測位準 : 1.8V 到 4.5V 每一階為 0.1 到 0.2V 的步進電壓值 可使用外部類比電壓輸入 內建參考電壓元 V REF 16-bit Multiplexer LVDIF 此功能為類比架構消耗較多電流, 如考慮功耗可用軟體方式關閉 此模組 LVDIN V REF Microchip Technology Taiwan Slide 69

70 PIC18Fxxxx I/O 介紹與運用 Microchip Technology Taiwan Slide 70

71 PIC18 系列的周邊 : I/O Ports 輸入 / 輸出腳, 為一般 MCU 最基本的工作 PIC18 系列的 I/O 多了一個 LATx, 可有效解決所謂 Read- Modify-Write 指令動作帶來的困擾 每個 I/O Port 皆有三個獨立的控制暫存器 PORTx LATx TRISx Microchip Technology Taiwan Slide 71

72 I/O 的輸出入暫存器 Internal Data Bus Write PORTx Write LATx Read LATx Read PORTx LATx 拴鎖暫存器或 PORTx 輸出暫存器 PORTx I/O Pins Microchip Technology Taiwan Slide 72

73 為什麼加入 LATx 拴鎖暫存器 1. 如果工作在較低頻率或較小的負載電容環境 BSF PORTx,PINy Q4 BSF PORTx,PINz Q1 Q2 Q3 電壓的呈現在 PORTx,PINy V IL t Read-Modify-Write 操作時的取樣點 2. 如果工作在較高頻率或較大的負載電容環境 BSF PORTx,PINy BSF PORTx,PINz Q4 Q1 Q2 Q3 Q4 電壓的呈現在 PORTx,PINy V IL 此時電壓還沒升到 V IL 轉態點 t Read-Modify-Write 操作時的取樣點 Microchip Technology Taiwan Slide 73

74 如何解決 Read-Modify-Write 如果是對相同的 PORTx 連續操作 解決之道是在連續兩個 BSF/BCF 指令間加入適當個 NOP 指令 BSF NOP BSF PORTA,5 PORTA,0 使用 C18 則可加入 Nop( ) 的巨集 建議直接使用 LATx 的來取代 PORTx 的操作 這樣直接就對拴鎖暫存器操作, 而不是對外面的 PORT 操作也就沒有因電容所造成的延遲 BSF BSF LATA,5 LATA,0 Microchip Technology Taiwan Slide 74

75 I/O 輸出 / 輸入控制 I/O Pin 方向控制 TRISB PORTB In In In In Out Out Out Out TRISx 的每一獨立位元可單獨去控制相對應 PORTx 裡的位元的資料方向 (Reset 的初始定義為輸入功能 ) 1 = 輸入, 0 = 輸出 Microchip Technology Taiwan Slide 75

76 類比或數位腳位? 有些接腳是類比輸入與數位共用同一隻接腳 ( 內定為類比輸入 ) 類比輸入有 ADC 輸入與電壓比較器輸入 ADCON1 暫存器用來設定腳位是類比輸入還是數位 I/O Bit 7 Bit X X VCFG1 VCFG0 PCFG3 PCFG2 PCFG1 PCFG0 設定最低 4 bits 為 1 時, 關閉所有 ADC 輸入腳功能 Microchip Technology Taiwan Slide 76

77 PIC18 系列的周邊 : I/O Ports 最多可擁有 68 個標準輸入 / 輸出接腳 (PIC18F87 PIC18F8720) 某些接腳具有可設定為 : 周邊功能或一般接腳 接腳具有 25mA 的高驅動電流 (sink & source) 可直接驅動 LEDs 及耗電流較高的負載 每一接腳可直接做位元運算, 且只需一個指令時間 每一接腳均具有下列功能 : 程式設定其為輸入或輸出腳 資料閂鎖 ( 可直接進行 read-modify modify-writes 的功能 ) 輸入資料直接讀取輸入的腳位 每一接腳有獨立的 ESD 保護二極體 Microchip Technology Taiwan Slide 77

78 顯示與鍵盤 利用最少的外加零件及軟體來完成 : 點亮 4 個七節顯示器並掃瞄一個 4 X 4 的矩陣鍵盤 RB0 - RB7 為顯示字形的輸出, RA0 - RA3 控制欲被點亮的七節顯示器位置 每隔 5mS 點亮一個七節顯示器, 共 20mS 完成一周 在點亮七節顯示器一周後, 改變 RA0~RA3 為輸入關閉七節顯示器 100uS 以掃瞄鍵盤 RB0 - RB3 為輸出 pins,rb4 - RB7 為輸入 pins ( 內含 pull- up 電阻 ) PIC18 系列的周邊 : I/O Ports 典型的應用範例 Microchip Technology Taiwan Slide 78 PIC18FXXX Current Sink

79 PIC18 系列的周邊 I/O Ports PORTB 的特殊功能 : Interrupt on Change PORTB 的 RB4 至 RB7 可因為偵測到接腳電位的改變來產生中斷, 並喚醒 PICmicro Microchip Technology Taiwan Slide 79

80 PIC18 系列的周邊 : I/O Ports 的特殊功能 PIC18FXXX RB4 - RB7 內有 pull-up 電阻, 設定為輸入腳 RB0-RB3 為輸出腳並同時輸出低電位 對 PORTB 做一次假讀取以記錄 RB4-RB7 目前的電位並進入睡眠模式 當任一鍵被按下時,RB4 - RB7 會有一電位的改變進而產生中斷喚醒 MCU 對鍵盤進行掃瞄動作讀取按鍵值 Microchip Technology Taiwan Slide 80

81 正確的語法表達 ( 一 ) 數值 數字 ( 字元 ) 表示法 十進制表示 (Decimal): D < 十進制數目 > &. < 十進制數目 > MOVLW D 100 ; 載入常數 100 (10) to W Reg. MOVLW.100 ; 載入常數 100 (10) to W Reg. Const1 EQU D 200 ; Const1 = 200 ( 十進制 ) 十六進制表示 (Hexadecimal): H < 十六進制數目 > & 0x< 十六進制數目 > & < 十六進制數目 > h MOVLW MOVLW MOVLW Const1 EQU H 3F 0x3F 0FEh ; 載入常數 3F (16) to W Reg. ; 載入常數 3F (16) to W Reg. ; 載入常數 FE (16) to W Reg. H 5A ; Const1 = 5A ( 十六進制 ) Microchip Technology Taiwan Slide 81

82 正確的語法表達 ( 二 ) 數值 數字 ( 字元 ) 表示法 二進制表示 (Binary): B < 二進制數目 > Const1 EQU MOVLW B ; 載入常數 0xF0 to W Reg. B ; Const1 = ( 二進制 ) 字元 (ASCII): A < 字元 > & < 字元 > Const1 EQU MOVLW A R MOVLW c ; 載入字元 R to W Reg. ; 載入字元 c to W Reg. a ; Const1 = 小寫的字元 A Microchip Technology Taiwan Slide 82

83 必需要使用的虛擬指令 LIST - 目錄控制 (Listing Control) list p=pic18f4520 #INCLUDE - 加入一原始檔 定義檔或敘述檔 #include <18f4520.inc> EQU - 宣告常數 變數 ( 不可重新定位 ) memory equ count io_set equ 0x3f equ.100 B ORG - 設定程式組譯的起始位址 org 0x00 ; 組譯位址從 00h 開始 org 0x30 ; 組譯位址從 30h 開始 END - 程式結束 Microchip Technology Taiwan Slide 83

84 虛擬指令的使用範例 list #include ;***** 定義變數 常數 參數區 ****** p=18f4520 ; 定義使用的 MCU 為 PIC18F4520 <p18f4520.inc> ; 使用 18F4520 的標準定義檔 T_DELAY EQU D 100 ; 設定常數值 dly_count EQU H 00 ; 設定變數位址 ;********************************************************************** ; ORG 0x000 ; 設定程式執行位址從 0000 開始 clrf PCLATU clrf PCLATH goto main ORG 0x0008 ; 高優先權中斷向量進入位址 ;******* 中斷處理副程式區 ****** ; retfie s ; 中斷返回 main movlw T_DELAY ; 主程式開始 movwf dly_count ;** remaining code goes here END ; 程式結束 Microchip Technology Taiwan Slide 84

85 練習一 : I/O 的操作 本練習的程式 Ex1.asm 放在..\102_ASP_TW\exer\Ex1.asm 建立一個屬於這個練習的 Project 名稱定為 Ex1.mcp 修改這個練習, 使程式能依按鍵的選擇來控制 LED JP9 的 2 & 3 腳 ( 左側 ) 需用 Jumper 短路,LED 接地 設定 RB0, RA4 為輸入 設定 PORTD 為輸出 ( 驅動 LED ) 按 SW2 (RB0) 時, 點亮 LED0 LED3 按 SW3 (RA4) 時, 點亮 LED4 LED7 Microchip Technology Taiwan Slide 85

86 Timer & CCP Module 介紹 Microchip Technology Taiwan Slide 86

87 PIC18 系列的周邊 : Timer0 Timer0 可設定為 8-Bits 或 16-Bits 模式 16-bit mode 時, TMR0H 會在讀寫 TMR0L 時才真正的被讀出或寫入 Timer0 可準確的由 8-bit 的 Data Bus 來讀取 16-bit 的 Timer 值 計時器產生溢位時 FFh to 00h (FFFFh to 0000h), 即產生中斷 Microchip Technology Taiwan Slide 87

88 PIC18 系列的周邊 Timer1 and Timer3 16-bit 模式的計數器或計時器 由兩個可讀 / 寫的 8-bit 計數器串聯而成 預除器有四種選擇 : 1, 2, 4,or 8 三種功能 : 計時器, 同步模式計數器, 非同步模式計數器 ( 睡眠模式下使用非同步時序喚醒 ) 專用石英振盪電路可作為外部計數時序或第二系統時序 ( System Clock ) 選擇 當計數器或計時器產生溢位時 FFFFh to 0000h, 即產生中斷 Microchip Technology Taiwan Slide 88

89 PIC18 系列的周邊 Timer1 and Timer3 (continued) 加入 暫存器的 以獲得更精確的計數功能 同步計時模式 非同步計時模式 Microchip Technology Taiwan Slide 89

90 PIC18 系列的周邊 Timer1 and Timer3 as a Real-Time Clock 使用 khz 的石英振盪器作為 Timer1 或 Timer3 的計時訊號 系統的主振盪器可使用低價的 RC 振盪電路 睡眠模式下,Timer1 (Timer3) 繼續遞增 當 Timer1 (Timer3) 產生溢位時, 中斷會喚醒 MCU, 主振 盪器 (RC) 立即起振 可利用 KHz 的值來校正 RC 振盪 Microchip Technology Taiwan Slide 90

91 PIC18 系列的周邊 Timer2 8-bit 模式的計時器, 有預除器及後除器之功能 PWM 輸出模式下, 基本的頻率來源 TMR2 為一可讀 寫具有自動載入功能的計時器 TMR2 會自動加一並與設定的值相比 ; 若相等則送出訊號至後除器或產生中斷, 並自動將自己清除為零, 重新計時 MSSP (SPI ) 傳送速率的設定 Microchip Technology Taiwan Slide 91

92 Timer2 的方塊圖 PIC18 系列的周邊 Timer2 PR2 的內容為 Timer2 的週期 (0 255) Microchip Technology Taiwan Slide 92

93 PIC18 系列的周邊 Capture / Compare / PWM (CCP) Module CCP 模組可規劃為 : 脈波量測器 計時比較模式 脈衝寬度調變器 當起動脈波量測或計時比較功能時, 使用 TMR1 或 TMR3 (16-Bit Timer ) 當計時的基準 在脈衝寬度調變輸出模式下, 啟動 TMR2 當脈衝寬度 (Duty) 和週期 (Period) 的計時基準計時基準 Microchip Technology Taiwan Slide 93

94 定義 : PIC18 系列的周邊 Capture / Compare / PWM (CCP) Module (continued) Input Capture : 計算輸入脈衝的時間 寬度及頻率 ; 必須使用 16-bit 的 Timer1 為計時基準 Output Compare : 設定一 16-bit 的計時比較值與 16-bit 的 Timer1 相比, 若相等則依其設定來改變輸出 PWM (Pulse Width Modulation) : 頻率固定的方波, 藉由改變其脈衝寬度 (Duty) 來進行數值的調變 Microchip Technology Taiwan Slide 94

95 PIC18 系列的周邊 CCP Module: PWM Mode 最高可達 10-bit 的解析度 ( 當工作頻率為 40 Mhz ) 輸出頻率 khz 時, 解析度為 10-bit 40MHz / 1024 = 39.06KHz 輸出頻率 khz 時, 解析度為 8-bit 輸出頻率 khz 時, 解析度為 7-bit 脈衝寬度的最高解析度為 25 ns (@ 40 MHz, high-resolution mode) Microchip Technology Taiwan Slide 95

96 PIC18 系列的周邊 CCP Module: PWM Mode Period 由 PR2 設定 Duty Cycle 由 CCPR1H 決定 PWM 為 10-bit, 較低的兩個位元置於 CCP1CON 的 bit <5:4> 每一新的週期開始時, CCPR1L 的設定值就會重新被載入且正反器被設為 1 輸出 當 TMR2 = Duty Cycle (CCPR1H), 則正反器的輸出會被清除為零 Microchip Technology Taiwan Slide 96

97 PIC18 系列的周邊 Microchip Technology Taiwan Slide 97

98 PIC18 系列的周邊 當 16-bit CCPRx 暫存器的內容值等於計時器 TMR1 或 TMR3 時,CCPx 腳可經由事先的設定有以下之輸出變化 : 輸出 輸出 輸出不改變 比較值相等時, 也可產生中斷 亦可設定比較值相等時, 自動清除 TMR1 或啟動 A/D 轉換器 Microchip Technology Taiwan Slide 98

99 PIC18 系列的周邊 Microchip Technology Taiwan Slide 99

100 PIC18 系列的周邊 CCP Module: Input Capture Mode 當下列事件發生在輸入腳 CCPx 時,TMR1 或是 TMR3 目前的計數值 (16-Bit) 會直接被複製並儲存在 CCPRxH & CCPRxL 暫存器 每一上緣信號 ( 上緣或下緣觸發可設定 ) 每一下緣信號 每四個上緣或下緣信號 每十六個上緣或下緣信號 事件的觸發也可產生中斷 Microchip Technology Taiwan Slide 100

101 18F452 中斷處理 18F452 有兩個中斷向量點 高優先權 ==> 中斷向量位址 0x0008 低優先權 ==> 中斷向量位址 0x0018 每個中斷源均可選擇其中斷優先權 ( 二選一 ) 每個中斷源均有獨立的中斷旗標 (Flag) 中斷旗標的清除 ==> 自行用軟體清除 每個中斷源均可 Enable 或 Disable 當然 PIC18 系列也可設定與 PIC16Fxxx 系列的中斷相容 ( 關掉優先權的設定 ) Microchip Technology Taiwan Slide 101

102 PIC18F452 中斷邏輯架構 (High Priority Level) Microchip Technology Taiwan Slide 102

103 Shadow 暫存器 18F452 有 Shadow Register 的設計, 能提高中斷程式對事件的反應速度 高優先權中斷 W,BSR,STATUS,, 的存入 / 取出使用 Shadow Register 程式的返回 :retfie FAST 低優先權中斷 W,BSR,STATUS 的存入 / 取出則必需透過軟體方式 程式的返回 :retfie 0 Microchip Technology Taiwan Slide 103

104 Timer1 的中斷設定 有關 T1CON 的控制位元, 請參考 Page 105 ( PIC18F452) RCON 的 <IPEN> 位元 : 啟動高 低權位的中斷功能 GIEH : 允許高優先權中斷 GIEL : 允許低優先權中斷 TMR1IE : 打開 Timer1 的中斷設定 TMR1IP = 1, 設定 Timer1 為高優先權中斷 Microchip Technology Taiwan Slide 104

105 練習二 : 使用 Timer1 與中斷 使用 Timer1 外部的 KHz 並啟動 Timer1 的中斷 : 練習程式 : C:\W400 workshop\exercise Exercise\Ex2.asm Ex2.asm 設定 PIC18F452 的工作模式後, 進入主程式的永久迴圈 將 Timer1 設定為 500 ms 中斷 CPU 一次 ( 使用 Fosc / 1 ) 0.5Sec = Timer Value * ( 1 / 32768Hz) Timer Value =?? Timer1 每次中斷後, 必須將 LED ( PORTD ) 的輸出值加一 注意! 參考電路圖的設定 JP2 的設定是 3,5 及 4,6 短路 ; JP9 的設定是 1,2 短路 Microchip Technology Taiwan Slide 105

106 A/D 轉換器 & 電壓比較器 Microchip Technology Taiwan Slide 106

107 10-bit A/D 轉換器 8 組類比轉換多工輸入選擇,10 bits 解析度 類比輸入取樣時間 :20 µs ( 輸入阻抗 <10K) 類比輸入轉換時間 :19.2 µs (12 T AD ) 10-bit 解析度時, 只有一位元的誤差 允許使用外部參考電壓 : VREF+ & VREF- 轉換的結果允許自動向左 向右對齊修正向右對齊修正 完整的轉換時間共須 39.2 µs 如輸入腳位固定, 其轉換時間只需 :29.2 µs Microchip Technology Taiwan Slide 107

108 10 10-bit A/D bit A/D 方塊圖方塊圖方塊圖方塊圖方塊圖方塊圖方塊圖方塊圖 bit A/D bit A/D 方塊圖方塊圖方塊圖方塊圖方塊圖方塊圖方塊圖方塊圖 R IN Sampling SW Microchip Technology Taiwan Slide 108 C HOLD 120PF

109 ADCON0 Register A/D 控制暫存器 See Data Book ADCS1 ADCS0 CHS2 CHS1 CHS0 GO/DONE --- bit7 ADCON1 Register ADON bit0 ADFM ADCS PCFG3 PCFG2 PCFG1 PCFG XXXXXXXX XX ADMF= ADRESH ADRESL 10-bit Result A/D 轉換結果向左 向右調整向右調整 ADMF= XX XXXXXXXX ADRESH ADRESL 10-bit 向左靠齊 Microchip Technology Taiwan Slide bit 向右靠齊

110 A/D 轉換基本流程 切換輸入腳位 取樣時間延遲延遲 20uS 起動 A/D 轉換 No 轉換完成? Yes 儲存 A/D 轉換結果 Microchip Technology Taiwan Slide 110

111 PIC18 系列的周邊 Analog Comparator Module 兩組類比的比較器 內建可程式規劃的參考電壓源 8 種工作模式的選擇 允許在睡眠模式下工作, 比較器的輸出發生改變時可產生中斷來喚醒 MCU 比較器的輸出較器的輸出 輸入腳位可規劃成一般輸入腳位可規劃成一般 I/O 腳使用 Microchip Technology Taiwan Slide 111

112 PIC18 系列的周邊 有 段的電壓輸出設定如果關閉參考電壓源, 則 會自動關閉可做為簡易 轉換器可將參考電壓 可直接輸出於接腳上 Microchip Technology Taiwan Slide 112

113 練習三 : 使用 A/D 轉換器 使用 A/D 轉換器將 VR1 的電壓透過 AN0 的輸入腳進行 A/D 的電壓轉換 : 練習程式 : C:\W400 workshop\exercise Exercise\Ex3.asm Ex3.asm 有關 A/D 的設定, 請參考 ADCON0 及 ADCON1 兩個暫存器的設定說明 PIC18Fxx2 Data Sheet ( Page 179 & 180 ) A/D 轉換的結果, 向左調整後只取其最高的 8-bits ( 最低的兩個位元不予理會 ), 並將每次轉換後的結果顯示在 LED Microchip Technology Taiwan Slide 113

114 MSSP & USART Microchip Technology Taiwan Slide 114

115 同步串列通訊 ( 一 ) Master Synchronous Serial Port (MSSP) 可工作於 SPI 或 I 2 C 兩種模式之一 SPI (Serial Peripheral Interface) 模式 可程式化速率設定 最高速率 (@ 40 MHz) : Master 10.0 Mbps Slave 4.29 Mbps 可程式化設定接收 發送的時脈 (clock) 動作極性 支援兩種傳輸模式 Microwire TM 和 Motorola s SPI Microchip Technology Taiwan Slide 115

116 SPI 方塊圖 SDO: Serial Data Output SDI: Serial Data Input Internal data bus SCK: Serial Clock SS: Slave Select Master Mode: SCK is the clock output pin Microchip Technology Taiwan Slide 116

117 同步串列通訊 ( 二 ) I 2 C (Inter-Integrated Circuit) 模式 全硬體化設計, 支援下列三種 I 2 C 的操作模式 Master Mode Multi-master Mode Slave Mode 支援 7-bit 或 10-bit 位址模式 傳送及接收速度 :100kHz, 400kHz,1 MHz 支援通用位址 (General call) 模式 address=0x00 Microchip Technology Taiwan Slide 117

118 I 2 C Master 模式 模式方塊圖 SDA SCL Start bit, Stop bit Acknowledge Generate Start bit detect, Stop bit detect, Write collision detect Clock Arbitration State counter for end of XMIT/RCV Microchip Technology Taiwan Slide 118

119 I 2 C Slave 模式 模式方塊圖 RC3/SCK RC4/SDA Microchip Technology Taiwan Slide 119

120 I 2 C Master C Master 模式下模式下模式下模式下模式下模式下模式下模式下發送資料的時序發送資料的時序發送資料的時序發送資料的時序發送資料的時序發送資料的時序發送資料的時序發送資料的時序 Microchip Technology Taiwan Slide 120

121 PIC18 系列的周邊 Addressable USART (AUSART) 支援全雙工非同步串列傳輸, 半雙工同步串列傳輸 8-bit 或 9-bit 的資料格式 串列接收與發送採用雙資料緩衝器的設計 獨立的收 發中斷產生 資料的接收 傳送以 b0 為第一位元 獨立的速率產生器 在 20MHz 時的最高速率 : 同步串列傳輸模式 : 5 Mbaud 非同步串列傳輸模式 : Kbps ( 低速模式 ) 1.25 Mbps ( 高速模式 ) 支援 9-bit 位址或資料的判斷模式 Microchip Technology Taiwan Slide 121

122 PIC18 PIC18 PIC18 PIC18 PIC18 PIC18 PIC18 PIC18 系列的周邊系列的周邊系列的周邊系列的周邊系列的周邊系列的周邊系列的周邊系列的周邊 USART USART 的結構方塊圖的結構方塊圖的結構方塊圖的結構方塊圖的結構方塊圖的結構方塊圖的結構方塊圖的結構方塊圖 PIC18 PIC18 PIC18 PIC18 PIC18 PIC18 PIC18 PIC18 系列的周邊系列的周邊系列的周邊系列的周邊系列的周邊系列的周邊系列的周邊系列的周邊 USART USART 的結構方塊圖的結構方塊圖的結構方塊圖的結構方塊圖的結構方塊圖的結構方塊圖的結構方塊圖的結構方塊圖 Microchip Technology Taiwan Slide 122

123 TXIF & TRMT 的動作 假如 TXREG 的資料被載到 TSR, TXREG 會空出 ; 則 TXIF = 1 假如 TSR 的資料串列傳送完畢 ; 則 TRMT = 1 假設 TXREG 剛載入資料時 TMRT 為空的 (TMRT=1), 則這筆資料會立即被送到 TSR, 串列傳送會動作, 同時 TXIF = 1 TXIF 是可單獨使用, 即使 USART 的 TX 中斷是關閉的 (TXIE=0) 由以上動作可知偵測發送狀態 TXIF 會比 TMRT 來的快 Microchip Technology Taiwan Slide 123

124 RCIF 的動作 RSR 為一個移位器, 接收 8-bits 的串列資料及 start & stop bit. 接收到的串列資料會被載入到 RCREG FIFO 並將設定 RCIF 的動作 假設上一筆資料在 FIFO 中未被拿走此時又有一筆串列資料接收近來, 則這筆新的資料會被存在第二級的 FIFO 中 若兩級 FIFO 均有資料, 接收中斷產生將第一級資料提走, 中斷處理完畢後, 第二級 FIFO 的資料會立即產生中斷 2 deep FIFO Microchip Technology Taiwan Slide 124

125 PIC18 系列的周邊 RS-485 的功能說明 RS-485 適用於高雜訊 長距離通訊, 具有多個接收並聯的功能 : 採用差動式雙絞線傳送, 標準 UART 的傳輸格式 半雙工模式只需一組對絞線 ( 多點通訊 ) 全雙工模式需兩組對絞線 ( 點對點通訊 ) 利用第九個位元 (b8) 作為資料或命令的指引 當 b8 為 1 時, 表示該筆資料為命令, 啟動位址判斷 ; 只有被呼叫的接收器才會被允許接收下一筆的資料 b8=0 時, 該筆資料為一般的資料 Microchip Technology Taiwan Slide 125

126 PIC18 系列的周邊 RS-485 的功能說明 ADDEN 位元通知 USART 檢查串列資料的第九位元是否為零, 若為零則忽略此次的資料 : 此次接收無效, 勿須傳送至接收緩衝器中 不產生中斷 注意! 發送器的程式必須有效地控制第九位元 Microchip Technology Taiwan Slide 126

127 USART 速率的計算 PIC18F452 可設定 UART 的傳輸速率 BRGH = 0, 低速模式, Baud Rate = Fosc / [ 64 ( x + 1) ] BRGH = 1, 高速模式, Baud Rate = Fosc / [ 16 ( x + 1) ] 以 16MHz 的工作頻率為例 : 欲求出 9600 bps 的速率 Baud Rate = Fosc / [ 64 ( x + 1) ] 9600 = 16MHz / [ 64 ( x + 1) ] x = [ ( 16MHz / 9600 ) / 64 ) 1 x = SPBRG = 25 Microchip Technology Taiwan Slide 127

128 USART 相關的暫存器 傳送資料時可不必使用中斷傳送 BRGH = 0 傳送格式設為 : 9600,N,8,1 接收最好使用中斷方式接收 CREN = 1 ADDEN = 0 Microchip Technology Taiwan Slide 128 接收格式設為 : 9600,N,8,1

129 練習四 : 使用 USART 練習程式 : C:\W400 workshop\exercise Exercise\Ex4.asm Ex4.asm 設定 USART 的工作模式為 :9600,N,8,1 電腦的超級終端機設定使用 COM1 或 COM2, 通訊協定為 : 9600,N,8,1,Handshake : None 傳送資料 : 不採用中斷方式 接收資料 : 採用中斷即時接收方式 APP001 電路設定需將 J6 的 1&2 及 3&4 短路 連接 15-Pin 的 RS-232 Cable 到 PC 端 程式會每隔 1 秒 (Timer1) 將 A/D 的轉換結果 ( 10-bit ) 轉成 ASCII 碼後, 傳送到超級終端機上顯示 ( 每次傳送自動加入換行字元 ) PC 鍵盤按 P 鍵,18F452 停止傳送 A/D 值, 按 C 鍵則繼續傳送 Microchip Technology Taiwan Slide 129

130 PIC18FXXX Directive Instructions Internal Data EEPROM Table Read / Write Microchip Technology Taiwan Slide 130

131 常用的虛擬指令 -- #DEFINE #DEFINE <name> <string> 通常用來定義文字 標記 常數 在此定義中,<string> 所描述的文字用 <name> 為助憶文字, 在組合語言中可以用 <name> 來代替 <string> 以增加程式的閱讀性例如 : #DEFINE S_CLK PORTC,3 #DEFINE S_DATA PORTC,2 #DEFINE S_FLAG 0x30,7 list p=16f74 #include <p16f74.inc> ; val_ff equ 0Xf8 val_250 equ.80 count equ 0x20 ; #define m_flag count,6 #define clk PORTC,0 #define sda PORTC,1 : : bsf clk btfss sda goto sda_low call sda_hi Microchip Technology Taiwan Slide 131

132 常用的虛擬指令 -- CBLOCK & ENDC CBLOCK 宣告變數的區域段, 並設定該區域段在暫存器的起始位址 CBLOCK 所定義的第一個變數 ( 暫存器 ) 位址, 即是該起始位址, 下一個變數位址會自動加一 ENDC 是結束此變數區域段的宣告 cblock h'20' count, count_ms, led_count led_index led_buff endc : movlw 0x A movwf led_count DA loop_right rlf led_buff,f C rrf PORTB,f call delay_250ms BA decfsz led_count,f goto loop_right C goto loop_index Microchip Technology Taiwan Slide 132

133 常用的虛擬指令 MACRO & ENDM MACRO 一般稱之為巨集函數, 是用來制定自己的專用的指令, 並可傳遞參數給巨集函數內的指令 User_instru MACRO var_in1, var_in2, var_out 使用者定義的指令名稱 參數及變數傳遞 在巨集函數內, 如需執行 GOTO 指令可用 $ 符號做為跳躍的基準位址做加 ( 往下跳 ) 或減 ( 往上跳 ) 的短程跳躍 swap_led MACRO ENDM 是用來結束本巨集函數巨集函數 movlw h 8 movwf led_count rrf led_right,f rlf led_lift,f decfsz led_count goto $-6 ENDM 有 MACRO 的宣告就必須有 ENDM 的存在 Microchip Technology Taiwan Slide 133

134 MACRO & ENDM 的使用範例 portc_bfr equ 0x50 w_buffer equ 0x51 s_buffer equ 0x52 ; PUSH MACRO movwf w_buffer swapf w_buffer,f swapf STATUS,W movwf s_buffer ENDM ; POP MACRO swapf s_buffer,w movwf STATUS swapf w_buffer,w ENDM ; MOV MACRO regd,regs movf regs,w movwf regd ENDM ;******************************* ; Program start ;******************************* ; org 0x0 goto start ; org 0x04 ; Interrupt ; vector PUSH MOV portc_bfr,portc : POP retfie Microchip Technology Taiwan Slide 134

135 常用的虛擬指令 -- DB 標記 DB < 字元 >, < 字串 > 產生 8-bit 的固定資料存放在程式記憶體 此固定資料會以 Intel s HEX Code 型態與程式碼結合 因 PIC18Fxxxx 是 16-bit 的程式碼型態, 若資料長度為奇數則該字元組的偶數位元組 ( 較高的 Byte) 會自動補零 固定資料型態可為 : Hex code ASCII 字元 字串字串 0001DE 5B1B 4A String_0 db 0x1b,'[','2','J',0x00 ; Clear Terminal Screen 0001E String_1 db " Microchip Technology Taiwan ; Workshop 400",0x0a,0x0d,0x D F E68 6C6F 676F E61 3B F 736B 6F A30 000D Microchip Technology Taiwan Slide 135

136 内部資料 EEPROM PIC18F Bytes EEPROM 具有一百萬次的寫入或清除能力 Flash Program Memory 具有十萬次的寫入或清除能力 資料持久年限 : 超過 40 年 具備 EEPROM 寫入完成的成的中斷功能 EEPROM 具有全電壓範圍的燒錄 PIC18LF452 : 2.0V ~5.5V EEPROM 寫入時間 :4mS Microchip Technology Taiwan Slide 136

137 EEPROM 相關暫關暫存器 PIC18F452 EEDATA (0xFA8) 用以存放 EEPROM 寫入或讀取的資料 EEADR (0xFA9) 用以存放 EEPROM 的欲存取的欲存取的地址 ( 0x00 ~ 0xFF ) EECON1 (0xFA6) EEPROM 讀 / 寫控制控制暫存器 EECON2 (0xFA7) 特殊的物理上不存在的暫存器存器 讀出的結果全果全為 0 專用于 EEPROM 的寫入順序控制的操作 Microchip Technology Taiwan Slide 137

138 EECON1 寄存器 存取 存取 存取 存取 或 Microchip Technology Taiwan Slide 138

139 讀取 EEPROM 的資料 PIC18F452 把欲讀取 EEPROM 的位址寫到 EEADR 暫存器 清除 EEPGD 位元, EECON1<7> 清除 CFGS 位元, EECON1<6> 設定 RD 位元, EECON1<0> 等過了兩個兩個指令周期的指令周期的時間後, 資料會在 EEDATA 暫存器中就中就緒 Microchip Technology Taiwan Slide 139

140 讀取 EEPROM 資料的程式 READ_EEPROM: EEPROM 讀取副程式 ; ; movff Data_EE_Addr,EEADR bcf EECON1,EEPGD bcf EECON1,CFGS bsf EECON1,RD movf EEDATA,W return 將欲讀取的位址存入 EEADR 清除 EEPGD 位元清除 CFGS 位元啟動讀取 EEPROM 的動作讀取動作完成, 將資料存到 W Reg. 副程式返回 Microchip Technology Taiwan Slide 140

141 寫入資料到 EEPROM PIC18F452 把欲寫入 EEPROM 的位址寫到 EEADR 暫存器 把欲寫入 EEPROM 的資料寫到 EEDATA 暫存器 清除 EEPGD 位元, EECON1<7> 清除 CFGS 位元, EECON1<6> 設定 WREN 位元, EECON1<2> 關閉所有的中斷 寫 55h 到 EECON2 暫存器 寫 AAh 到 EECON2 暫存器 設定 WR ( EECON1<1> ), 以啟動寫入的動作 允許中斷 清除 WREN 位元, EECON1<1> Microchip Technology Taiwan Slide 141

142 寫資料到 EEPROM EEPROM 寫入副程式 設定欲寫入 EEPROM 的位址與資料 清除 EEPGD 位元 清除 CFGS 位元 設定 WREN 位元, 啟動寫入功能 ( 關閉所有的中斷, 以避免程序錯亂 ) 啟動寫入順序步驟 開始寫入 EEPROM ( 允許中斷功能 ) PIC18F452 Write_EE_Data: movff Data_EE_Addr,EEADR movff Data_EE_Data,EEDATA ; BCF EECON1,EEPGD BCF EECON1,CFGS BSF EECON1,WREN ; ; BCF INTCON,GIE MOVLW 0X55 MOVWF EECON2 MOVLW 0XAA MOVWF EECON2 BSF EECON1,WR ; BSF INTCON,GIE 測試是否寫入完成? 寫入完成, 關閉 EEPROM 寫入功能 Microchip Technology Taiwan Slide 142 LOOP BTFSS PIR2, EEIF GOTO LOOP ; BCF EECON1,WREN BCF PIR2,EEIF RETURN

143 讀取程式記憶體 PIC18F452 Table Read 指令讀取 Program Memory 中的資料至 Data Memory 中 程式查表, PIC16Cxx 系列並無此功能 PIC16F87x,16F7x,16C78x 則有 Table Latch 讀取功能 Program memory 以 Byte ( 位元組 ) 為單位, 以 22 bit 的 Table pointer 來指定其位址 ( TABPTRU:TABPTRH:TABPTRL ) 被讀入的資料將置於 TABLAT 暫存器中 PIC18Fxxxx 提供一共四種型態的 Table Read 指令 Microchip Technology Taiwan Slide 143

144 PIC18F452 的 Table Read 指令 四種 TABLE Read 的操作方式 TBLRD* : 直接讀取指標位址所指的內容 TBLRD*+ : 讀取指標位址位址所指的內容後將指標加一 TBLRD*- : 讀取指標位址位址所指的內容後將指標減一 TBLRD+* : 將指標先加一後再讀取指標位址位址所指的內容 Microchip Technology Taiwan Slide 144

145 程式記憶體的讀取範例 PIC18F452 LFSR FSR0, RAMBUFADDR ; 設定 22-bit 的程式位址 MOVLW UPPER(PROGMEMADDR) ; MOVWF TBLPTRU ; MOVLW HIGH(PROGMEMADDR) ; MOVWF TBLPTRH ; MOVLW LOW(PROGMEMADDR) ; MOVWF TBLPTRL ; TBLRD*+ ; 讀取目前位址的程式資料, 並將指標加一 ; MOVFF TABLAT, POSTINC0 ; 將資料取出存到 FSR0 所指到的 RAM ; 的位址後,FSR0 加一只到下一位址 Microchip Technology Taiwan Slide 145

146 寫入程式記憶體 PIC18F452 Table Write 指令允許資料由 Data Memory 寫入 Program Memory Program memory 以 Byte ( 位元組 ) 為單位, 以 22 bit 的 Table pointer 來指定其位址 TABPTRU : TABPTRH : TABPTLL TABLAT 暫存器存放欲寫入 Program Memory 的資料 PIC18Fxxxx 提供四種型態的 Table Write 指令 Microchip Technology Taiwan Slide 146

147 PIC18Fxxx 的 Table Write 指令 四種 TABLE Write 的操作方式 TBLWT* : 直接寫入資料到指標所指的位址 TBLWT*+ : 寫入資料到指標所指的位址後將指標加一 TBLWT*- : 寫入資料到指標所指的位址後將指標減一 TBLWT+* : 將指標先加一後再將資料寫入指標所指位址 Microchip Technology Taiwan Slide 147

148 程式記憶體的寫入範例 PIC18F452 : ; 將欲被用來結束 Long Write 程 : ; 序的中斷來源設定好 LFSR FSR0, RAMBUFADDR ; 將要寫入的位址寫入 22 Bits MOVLW UPPER(PROGMEMADDR) ; 的 Table Pointer 中 MOVWF TBLPTRU ; TABLPTRU,TABLPTRH,TABLPTRL MOVLW HIGH(PROGMEMADDR) ; MOVWF TBLPTRH ; MOVLW LOW(PROGMEMADDR) ; MOVWF TBLPTRL ; MOVFF POSTINC0, TABLAT ; 將要寫入程式記憶體的值寫入 ; TABLAT 暫存器 TBLWT*+ ; 寫入至 holding register MOVFF POSTINC0, TABLAT ; 載入第二個 byte TBLWT*+ ; 寫入至 MSB (odd address) ; 起始 long write 的程序 Microchip Technology Taiwan Slide 148

149 練習五 :Table Read 練習程式 : C:\W400 workshop\exercise Exercise\Ex5.asm Ex5.asm 將存在 ROM 的字串資料用 Table Read 的方式讀出後, 透過 RS-232 傳送到超級終端機顯示 通訊協定 :9600, N, 8, 1, None Handshake 程式會每隔 1 秒 (Timer1) 先傳送字串 The A/D Results are : 到終端機顯示後, 再將 A/D 的轉換結果 ( 10-bit ) 轉成 ASCII 碼後, 傳送到終端機上顯示 ( 每次傳送自動加入換行字元 ) PC 鍵盤按 P 鍵後, 停止傳送 A/D 值, 並將字串 The A/D is stopped conversion! 傳到終端機顯示 PC 鍵盤按 C 鍵則繼續傳送 A/D 值, 並將字串 The A/D is running! 傳到終端機顯示 Microchip Technology Taiwan Slide 149

150 附錄 A 開發工具介紹 Microchip Technology Taiwan Slide 150

151 開發工具介紹 APP001 多功能實驗版 MPLAB IDE v8.xx MPLAB ICD2, ICE2000 MPLAB Real ICE Microchip Technology Taiwan Slide 151

152 RS-232 APP001 v1.0 實驗板 A/D VR ICD2 Connecter DC 9V Input J6 (RS-232) J2 (32768Hz) Reset Button PIC16F877A 16MHz Crystal +5V S.P.S. LCD 亮度調整 PORTD LED 2 X 16 LCD Module Microchip Technology Taiwan Slide 152 J9 (LED) Button 16Mhz OSC

153 APP001 實驗板功能 練習 PIC16F877A 內部周邊的使用方法及典型的應用方式 40 Pin 的 PIC16Fxxx 與 PIC18Fxxx 腳位相容 直接與 MPLAB-ICD2 連接, 不須經由 Header Board 轉接 可練習的主要外接電路有 : LCD Module, 按鍵處理,I 2 C EEPROM, I 2 C 溫度存取 SPI,RS-232, RS-485, CAN Controller AD 轉換, PWM 與 I/O 控制 101ASP 課程使用的主要資源 PORTD 用以控制 8 個獨立的 LED RA0 : 使用於讀取可變電阻的電位值 (AN0) RA4 : 使用於按鍵控制 (SW3) Microchip Technology Taiwan Slide 153

154 MPLAB-IDE 功能介紹 高整合度的微處理器軟體 / 硬體研發及偵錯平台 採用專案管理模式 ( Project ) 多視窗原始程式編輯 修改 直接組譯 / 編譯原始程式 軟體模擬 具有輸入模擬功能 支援原始程式偵錯 支援 MPASM MPLINK 支援 C compiler Microchip Technology Taiwan Slide 154 硬體除錯工具 : ICE2000 Real ICE MPLAB ICD2 MPLAB ICD2 LE PICKit2 Debugger 程式燒錄工具 : PM-III PICSTART Plus MPLAB ICD2 PICKIT2 Debugger

155 MPLAB IDE IDE - 整合式的發展環境 內含多功能程式編輯器 語言工具 MPASM Assembler MPLAB Integrated Development Environment 軟體模擬 MPLAB SIM Sofware Simulator 單一系統專案管理模式 模擬器及除錯器 MPLAB REAL ICE 燒錄器 PICkit 1 PICSTART Plus 原始檔案程式偵錯功能 協力廠商支援工具 Compilers IAR, Hi-Tech, CCS, ME Labs, Green Hills MPLINK MPLIB MPLAB ICE 2000 & 4000 MPLAB PM3 Real-time Operating Systems CMX, Vector, Realogy, Express Logic MPLAB C18 MPLAB C30 MPLAB C32 PICkit 2 MPLAB ICD 2 MATLAB Live Devices, CMX, Momentum Data Systems Uniquely supporting 8, 16 and 32 bit MCUS within one integrated development Environment! Microchip Technology Taiwan Slide 155

156 MPLAB - ICE2000 連接 Host 到 Pod 的 Cable *Emulator Pod *Processor Module Flex Circuit Cable *Device Adapter * 每個元件可分開採購 *SOIC Transition Socket Microchip Technology Taiwan Slide 156

157 MPLAB ICE2000 支援所有 PICmicro MCU 系列的模擬 全速的模擬支援 Up to 25 MHz ( PIC18CXXX ) 將有支援 40 Mhz 以上的版本 支援低操作電壓環境的模擬 最低至 2.5 V 與 PC 使用 Parallel printer port 的界面 Software programmable clock ( 在 MPLAB-IDE 中可直接設定所需頻率 ) Microchip Technology Taiwan Slide 157

158 MPLAB ICE2000 改良甚多的 Trace 能力 可將中斷點設置於 internal registers/ram 可以 Trace internal registers/ram 32K * 128 bits Trace Buffer 以及 Logic analyzer 可記錄執行階段的時間標記 ( Time Stamp ) Four level conditional break/trace/trigger 可精確量測兩事件間的時間間隔 (Time between intervals ) Microchip Technology Taiwan Slide 158

159 MPLAB ICD 2 支援 FS-USB 介面 支援 PIC16F 裡具有 ICD 功能之 MCU 的除錯 支援 PIC18F, PIC24, dspic30,dspic33 & PIC32 可設定中斷點, 單步執行以及進行變數的觀察 32K Bytes (PIC18F4520) 的程式可於 3 秒內燒錄完成 Microchip Technology Taiwan Slide 159

160 Real ICE 基本配備 ICE 主機 Logic Probe ICSP Cable USB Cable USB 插座 ICSP 連接板 Microchip Technology Taiwan Slide 160

161 傳統 ICE 技術上的瓶頸 ICE 專用晶片價格昂貴 量少, 難以大量生產 需與量產元件同步上市, 困難度高 信號傳輸上時序與速度的誤差 CPU/ 記憶體超過 20MHz 時的存取限制 ICE 實際的線路距離與元件之間的規格差異 ICE 價格 速度越快, 價格越高 價格昂貴, 需要高速的外接硬體邏輯電路 FPGA & SRAM Microchip Technology Taiwan Slide 161

162 REAL ICE 功能 基本 功能 完全整合在 MPLAB IDE 的環境下 開發環境下可作為燒錄器 中斷功能 監看變數視窗功能 程式執行控制 Run Halt Single step Step into Step over Reset Microchip Technology Taiwan Slide 162

163 REAL ICE 進階功能 Advanced Features Breakpoints ( 軟體與硬體中斷設定 ) Stopwatch ( 程式執行計時碼表 ) Real time watch ( 即時變數觀測 ) Trace ( 追蹤 ) Program execution ( 追蹤程式執行 ) Variable values ( 追蹤變數值 ) Microchip Technology Taiwan Slide 163

164 REAL ICE 功能一覽表 PIC10F PIC12F PIC16F PIC18F dspic30f PIC24F PIC24H dspic33f Run, Halt Single Step Hardware Breakpoints Peripheral Freeze on Halt Break on Data Fetch or Write ( ) Break on Stack Error Stopwatch ( ) Pass Counter Break address or data match WDT Overflow ( ) Real Time Watch ( ) Software Breakpoints 1K 1K 1K 1K Trace Data and Program Flow Microchip Technology Taiwan Slide 164

165 APP001 實驗板功能 練習 PIC18F452 內部周邊的使用方法及典型的應用方式 40 Pin 的 PIC16Fxxx 與 PIC18Fxxx 腳位相容 直接與 MPLAB-ICD2 連接 可練習的主要外接電路有 : LCD Module, 按鍵處理,I 2 C EEPROM, I 2 C 溫度存取 SPI,RS-232, RS-485, CAN Controller AD 轉換, PWM 與 I/O 控制 WORKSHOP 400 使用的主要資源 PORTD 用以控制 8 個獨立的 LED RA0 : 使用於讀取可變電阻的電位值 (AN0) RA4 & RB0 : 使用於按鍵控制 (SW3 & SW2) Microchip Technology Taiwan Slide 165

166 使用 MPLAB IDE v8.xx Microchip Technology Taiwan Slide 166

167 安裝 MPLAB IDE V8.xx 安裝 MPLAB IDE v8.xx 之前已有安裝舊版的 MPLAB IDE, 需先移除 別忘了, 還要安裝 ICD2 的 USB 驅動軟體 C:\Program Files\Microchip\MPLAB IDE\ ICD2\Drivers\clnicd2.htm 裡的說明 如果有使用 ICE2000 還要再安裝驅動程式 C:\Program Files\Microchip\MPLAB IDE\ ICE 2000\Drivers\DDINSTXP.HTM 裡的說明 Microchip Technology Taiwan Slide 167

168 MPLAB IDE 畫面 工具圖示區 C 的原始程式 工作項目 設定中斷點 編譯輸出 暫存器顯示 變數觀察視窗 Microchip Technology Taiwan Slide 168 狀態顯示列

169 專案管理 ( Project Management ) MPLAB IDE 是採專案管理方式來完成軟體研發與設計, 所以在使用 MPLAB IDE 時, 就必需建立一個 Project Project 的附加檔案名稱是 xx.mcp, 最好與原始檔案放在同一個目錄以方便管理 一個 Project 可記錄眾多資訊 : 視窗位置 大小大小 個數 相關檔案的名稱 位置 相關偵錯訊息的設定值 組譯器 編譯器的選擇與設定 以 Project 觀念來保持一個完整的軟體設計, 以便日後程式的維護 修改修改 Microchip Technology Taiwan Slide 169

170 練習 : 建立新的專案 ( Project ) 執行 MPLAB IDE, 將顯示一初始的空白桌面 Microchip Technology Taiwan Slide 170

171 使用 Configure Select Device 來指定 MCU 為 PIC18F452 練習 : 建立新的專案 目前所選擇的元件所支援的燒錄器 目前所選擇的元件所支援的發展工具 Microchip Technology Taiwan Slide 171

172 練習 : 建立新的專案 使用 Configure Configuration Bits 來設定 IC 運作模式 除 Background Debug 設定為 Enabled 以便使用 MPLAB ICD 2 其他選項, 均設為 Disable Microchip Technology Taiwan Slide 172

173 練習 : 建立新的專案 使用 Project Project Wizard 來建立一新的 Project 元件的輸入方式可直接輸入或點選 Microchip Technology Taiwan Slide 173

174 練習 : 建立新的專案 設定語言工具 也可以在 Project Set Language Toolsuite 來設定使用 MPASM 來組譯 設定語言工具執行路徑 也可以用 Project Set Language Tool locations 來確定相關程 式所執行的位置 Microchip Technology Taiwan Slide 174

175 練習 : 建立新的專案 建立 Project 裡的 source code 及工作目錄 輸入專案名稱 Ex1.mcp 用 Browse 來指定目錄 Microchip Technology Taiwan Slide 175

176 練習 : 建立新的專案 加入 source code 到 Project 的工作目錄 Microchip Technology Taiwan Slide 176

177 練習 : 建立新的專案 Project 建立完成, 請在確認設定是否正確 Microchip Technology Taiwan Slide 177

178 練習 : 加入原始檔案方式 將滑鼠指到 Source Files 並按下滑鼠的右鍵 MPLAB IDE 將要求您加入檔案 Microchip Technology Taiwan Slide 178

179 練習 : 建立資料庫來源位置 Microchip Technology Taiwan Slide 179 使用 Project Build Options Project 啟動輸入視窗 該視窗是輸入資料庫 含入檔及連結描述檔的路徑位置, 一般是使用 C 語言及多檔案的組合語言才需要輸入 使用單一組合語言者無需輸入路徑資料

180 練習 : 組譯程式 使用 Project Build All 或 Ctrl+F10 來組譯程式 組譯成功 Microchip Technology Taiwan Slide 180

181 啟動基本 MPLAB-SIM 點選 Debugger Select Tool MPLAB SIM 以啟動內建的軟體模擬程式 Microchip Technology Taiwan Slide 181

182 MPLAB SIM 的基本除錯功能 Make Project 執行 單步執行 Reset Build All 停止 Step Over 利用 mouse 的右鍵來設定中斷點 利用 Stopwatch 視窗來量測程式執行所需的時間 Microchip Technology Taiwan Slide 182

183 Watch Window 的重要性 變數在 RAM 的位置是誰安排的 你知道怎樣才能看到變數的內容 MPLAB IDE 有專屬的變數觀察視窗 變數位置 變數名稱 變數內容 Microchip Technology Taiwan Slide 183

184 編譯程式與除錯 利用 Build All (Ctrl + F10) 來編譯程式 如有錯誤, 請參考錯誤訊息並加以修正 在錯誤訊息處按滑鼠兩次即能輕易切換至錯誤行 利用 Watch Window 來觀察變數 利用 Mouse 的右鍵來設定中斷點 熟悉 Reset,Run,Halt 功能 Step,Step Over 功能 RAM,SFR 視窗在組合語言下就不是那麼重要了? 其它的視窗可在 view 下開啟 Microchip Technology Taiwan Slide 184

185 使用 MPLAB ICD2 除錯 Microchip Technology Taiwan Slide 185

186 全速執行 單步執行 MPLAB-ICD2 功能 單 / 多點硬體中斷 變數觀察, 原始程式除錯等級 快速載入程式到模擬元件 可當模擬元件的燒錄工具 工作電壓 : 2.5V to 5.5V 頻率範圍 ; 32KHz to 40MHz RS-232 或 USB 介面 價格便宜 Microchip Technology Taiwan Slide 186

187 MPLAB-ICD2 配線圖 +9V Power Supply Cable 6-pin Phone Cable ICD2 Module APP001 實驗板 USB Cable Microchip Technology Taiwan Slide 187

188 啟動 ICD2 點選 Debugger Select Tool MPLAB ICD2 以啟動內建的軟體模擬程式 Microchip Technology Taiwan Slide 188

ICD ICD ICD ICD ICD

ICD ICD ICD ICD ICD MPLAB ICD2 MPLAB ICD2 PIC MPLAB-IDE V6.0 ICD2 usb PC RS232 MPLAB IDE PC PC 2.0 5.5V LED EEDATA MPLAB ICD2 Microchip MPLAB-IDE v6.0 Windows 95/98 Windows NT Windows 2000 www.elc-mcu.com 1 ICD2...4 1.1 ICD2...4

More information

PIC16F F MPLAB 08 16F LED 15 LED

PIC16F F MPLAB 08 16F LED 15 LED PIC16F877 PIC16F877 03 16F877 05 06 MPLAB 08 16F877 13 LED 15 LED 17 20 24 2 PIC16F877 PIC16F877 DIP VDD VSS CLOCK CPU :,AND,OR,XOR ROM: CPU ROM RAM: CPU,CPU I/O:CPU, CPU,, 16F877 RAM 512 128 Bank Bank

More information

第5章:汇编语言程序设计

第5章:汇编语言程序设计 第 5 章 : 汇编语言程序设计 程 汇编语言指令格式 系统伪指令 存储器选择方式 常用子程序 1 汇编语言程序设计 PIC 指令系统 语言系统 指 CPU 编 器语言 器语言 器语言 设计 用 语言 设计 语言 汇编语言 2 汇编语言指令格式 汇编语言指令格式 ( 指令 ) label opcode operand comment 指令 用 存 指令 指令语 3 汇编语言指令格式 1 指令 用 指令

More information

文件名

文件名 MICROCHIP PIC10F200/202/204/206 6 8 FLASH PIC10F200 PIC10F202 PIC10F204 PIC10F206 RISC CPU 33 12 8 8 4MHz 1 s 4MHz 1% TM ICSP TM ICD POR DRT WDT RC MCLR I/O /CMOS < 350 A @ 2V 4 MHz 100 na @ 2V FLASH 10000

More information

2.5 idlocs PIC idloc idloc 0x1234 ; 0x config idloc HEX errorlevel errorlevel Error (Warning) Message HEX 3-14 errorlevel

2.5 idlocs PIC idloc idloc 0x1234 ; 0x config idloc HEX errorlevel errorlevel Error (Warning) Message HEX 3-14 errorlevel 3.2.3 MPASM PIC 35 35 #include include #include MPASM include PIC MPLAB C:\Program Files\MPLAB IDE\MCHIP_Tools PIC.inc 3-01 #include ; PIC16F877A #include math.asm ; 3-01 MPASM MPLAB

More information

Microsoft PowerPoint - PIC18F_39th設計競賽 [相容模式]

Microsoft PowerPoint - PIC18F_39th設計競賽 [相容模式] 單晶片軟體設計講座 PIC18F4520 基礎課程 架構, 基本週邊及程式開發 Microchip Technology Taiwan Slide 1 開發 PIC18F4520 程式相關的 軟 / 硬體開發工具 使用軟體工具 ( 包含於 Microchip 產品 DVD 中 ) MPLAB IDE v8.xx ( 或更新版本 ) MPASM, MPLINK, MPLIB 使用硬體工具 MPLAB

More information

INCF SEC1,F ; 將 SEC1+1 作查表取回對應數字 MOVF SEC1,W banksel STRING1 banksel PORTB RETFIE run_sec2: MOVF SEC2,W SUBLW.5 GOTO run_min ; 將秒個位數歸 0 CLRF SEC1 MOVL

INCF SEC1,F ; 將 SEC1+1 作查表取回對應數字 MOVF SEC1,W banksel STRING1 banksel PORTB RETFIE run_sec2: MOVF SEC2,W SUBLW.5 GOTO run_min ; 將秒個位數歸 0 CLRF SEC1 MOVL ;************************************************ ; Null Clock REV:1.0 by Jed ; www.xuan.idv.tw ;************************************************ INCLUDE P16F84A.INC LIST P=16F84A,R=Dec CONFIG _XT_OSC&_WDT_OFF

More information

1-1 SH79F6431 A. 2( ) 9~15V ( 12V) U2 U3 3.3V SH79F B. 1(VCC/GND) SH79F6431 C. VDDIO SH79F6431 P4 P5 P0.6 P0.7 VDDIO VDDIO=5V D. 2 V 1.0

1-1 SH79F6431 A. 2( ) 9~15V ( 12V) U2 U3 3.3V SH79F B. 1(VCC/GND) SH79F6431 C. VDDIO SH79F6431 P4 P5 P0.6 P0.7 VDDIO VDDIO=5V D. 2 V 1.0 SH79F6431 1. SH79F6431 1T 8051 FLASH SH79F JET51 Keil µ vision JTAG 1.1. SH79F6431 LQFP64 1.2. (Target Board) SH79F6431 1 V 1.0 1-1 SH79F6431 A. 2( ) 9~15V ( 12V) U2 U3 3.3V SH79F6431 1 2 1 B. 1(VCC/GND)

More information

2 PIC PIC 1 / CPU PIC MCU PIC RC

2 PIC PIC 1 / CPU PIC MCU PIC RC 2 PIC PIC 1 /... 2-2 2... 2-3 3... 2-4 4... 2-4 5... 2-4 6 CPU... 2-5 7 PIC MCU... 2-6 8 PIC16... 2-6 9... 2-7 10... 2-7 11 RC... 2-7 12... 2-8 13... 2-8 14 NOP... 2-9 15 PMD... 2-9 16... 2-10 17 WDTWDT...

More information

USB解决方案.ppt

USB解决方案.ppt USB USB? RS232 USB USB HID U modem ADSL cable modem IrDA Silabs USB CP210x USB UART USB RS-232 USB MCU 15 USB 12 FLASH MCU 3 USB MCU USB MCU C8051F32x 10 ADC 1.5%, Vref CPU 25MIPS 8051 16KB Flash -AMUX

More information

ARM Cortex-M3 (STM32F) STMicroelectronics ( ST) STM32F103 Core: ARM 32-bit Cortex -M3 CPU 72 MHz, 90 DMIPS with 1.25 DMIPS/MHz Single-cycle multiplica

ARM Cortex-M3 (STM32F) STMicroelectronics ( ST) STM32F103 Core: ARM 32-bit Cortex -M3 CPU 72 MHz, 90 DMIPS with 1.25 DMIPS/MHz Single-cycle multiplica CP Chip Power ARM Cortex-M3 (STM32F) ARM Cortex-M3 (STM32F) STMicroelectronics ( ST) STM32F103 Core: ARM 32-bit Cortex -M3 CPU 72 MHz, 90 DMIPS with 1.25 DMIPS/MHz Single-cycle multiplication and hardware

More information

PROTEUS VSM

PROTEUS  VSM Proteus VSM-- 1/1 PROTEUS VSM Proteus VSM ISIS Prospice VSM Proteus PROSPICE ARM7 PIC AVR HC11 8051 CPU LCD RS232 LED IAR Keil Hitech C make 6000 SPICE SPICE DLL SPICE3F5 14 FM PROTEUS PCB LED/LCD / 300

More information

C PICC C++ C++ C C #include<pic.h> C static volatile unsigned char 0x01; static volatile unsigned char 0x02; static volatile unsigned cha

C PICC C++ C++ C C #include<pic.h> C static volatile unsigned char 0x01; static volatile unsigned char 0x02; static volatile unsigned cha CYPOK CYPOK 1 UltraEdit Project-->Install Language Tool: Language Suite----->hi-tech picc Tool Name ---->PICC Compiler Executable ---->c:hi-picinpicc.exe ( Command-line Project-->New Project-->File Name--->myc

More information

2 Keil µ vision 2.1 1) Keil µ vision2 V2.34 µ vision3 2) Sino_Keil.exe Keil c:\keil\ 3) JET51 USB PC C:\Keil\ USB PC 4) S-L

2 Keil µ vision 2.1 1) Keil µ vision2 V2.34 µ vision3 2) Sino_Keil.exe   Keil c:\keil\ 3) JET51 USB PC C:\Keil\ USB PC 4) S-L 1 SH88F516 8051 64K FLASH 1024 EEPROM SH88F516 JET51 S-Lab Keil µ vision ISP51 Keil µ vision ISP51 ISP51 PC RS232 MCU SH88F516 SH88F516 1.1 SH88F516 1.1 SH88F516 SH88Fxx: QFP44, DIP40 RAM Flash E2 ADC

More information

(Load Project) (Save Project) (OffLine Mode) (Help) Intel Hex Motor

(Load Project) (Save Project) (OffLine Mode) (Help) Intel Hex Motor 1 4.1.1.1 (Load) 14 1.1 1 4.1.1.2 (Save) 14 1.1.1 1 4.1.2 (Buffer) 16 1.1.2 1 4.1.3 (Device) 16 1.1.3 1 4.1.3.1 (Select Device) 16 2 4.1.3.2 (Device Info) 16 2.1 2 4.1.3.3 (Adapter) 17 2.1.1 CD-ROM 2 4.1.4

More information

目 录

目 录 1 Quick51...1 1.1 SmartSOPC Quick51...1 1.2 Quick51...1 1.3 Quick51...2 2 Keil C51 Quick51...4 2.1 Keil C51...4 2.2 Keil C51...4 2.3 1 Keil C51...4 2.4 Flash Magic...9 2.5 ISP...9 2.6...10 2.7 Keil C51...12

More information

Section1_16bit Arc.ppt

Section1_16bit Arc.ppt 16-bit Elite Program 2009 Summer Section-1 Microchip 16-bit 2005 Microchip Technology Incorporated. All Rights Reserved. Slide 1 MCU CPU (NOP),, (Data Memory), I/O CPU w. ALU/Working Reg. Data Mem. Data

More information

FM1935X智能非接触读写器芯片

FM1935X智能非接触读写器芯片 FM33A0xx MCU 2017. 05 2.0 1 (http://www.fmsh.com/) 2.0 2 ... 3 1... 4 1.1... 4 1.2... 4 1.3... 5 1.3.1... 5 1.3.2... 5 1.4... 8 1.4.1 LQFP100... 8 1.4.2 LQFP80... 9 1.4.3... 9 2... 15 2.1 LQFP100... 15

More information

AN579

AN579 深圳市英锐恩科技有限公司 单片机集成方案全方位解决服务商 优质智能电子产品 芯 方案解决商 Microchip 产品用户参考手册 深圳市英锐恩科技有限公司 ENROO-TECH(SHENZHEN)CO.,LTD 中国 深圳市福田区福华路嘉汇新城汇商中心 27 楼 2701 Enroo-Tech Technologies CO., Limited Light-Tech International Limited

More information

Tel:010-62981668-2930 1

Tel:010-62981668-2930  1 Access 93C46 with SPI function V1.0.0 Jan. 31, 2005 http://www.sunplusmcu.com Tel:010-62981668-2930 http://www.sunplusmcu.com E-mail:mcu@sunplus.com.cn 1 0 0...2 1...3 2...4 2.1...4 2.2...5 3...6 3.1 AT93C46...6

More information

1 TPIS TPIS 2 2

1 TPIS TPIS 2 2 1 1 TPIS TPIS 2 2 1. 2. 3. 4. 3 3 4 5 4 TPIS TPIS 6 5 350 Mark Coil F3/F6 350 M 150 M 25 M 7.12M 8 M F3 F6 F4 F7 F8 8M AA 7 350 28V 5V IC HCPL2731 0.5mA 6 8 (TPIS) TPIS 9 7 IC AT89C2051 AT89C2051 CMOS8

More information

33023A.book(31001A_cn.fm)

33023A.book(31001A_cn.fm) 1 第 1 章 简 介 简 介 目 录 本 章 包 括 下 面 一 些 主 要 内 容 : 1.1 简 介...1-2 1.2 本 手 册 的 宗 旨... 1-3 1.3 器 件 结 构... 1-4 1.4 开 发 支 持... 1-6 1.5 器 件 种 类... 1-7 1.6 格 式 和 符 号 的 约 定... 1-12 1.7 相 关 文 档... 1-14 1.8 相 关 应 用 笔

More information

2 14 PORTC.1 PORTB.3 PORTA.2/T0 GND PORTB.2 PORTA.0 PORTC.3 PORB.0/OSCO PORTB.1/OSCI PORTC.0 PORTC.2 SH69P21 /SOP PORTA

2 14 PORTC.1 PORTB.3 PORTA.2/T0 GND PORTB.2 PORTA.0 PORTC.3 PORB.0/OSCO PORTB.1/OSCI PORTC.0 PORTC.2 SH69P21 /SOP PORTA 1K 4 SH6610C 4 OTP ROM 1K X 16 RAM 88 X 4-24 - 64 2.4V-5.5V - fosc = 30kHz - 4MHz, = 2.4V - 5.5V - fosc = 4MHz - 8MHz, = 4.5V - 5.5V 11 CMOS I/O 4 ( ) 8 / - 0 PORTA.0 ( / / ) - 0 - PORTB ( ) ( ) - 32.768kHz,

More information

AN INTRODUCTION TO PHYSICAL COMPUTING USING ARDUINO, GRASSHOPPER, AND FIREFLY (CHINESE EDITION ) INTERACTIVE PROTOTYPING

AN INTRODUCTION TO PHYSICAL COMPUTING USING ARDUINO, GRASSHOPPER, AND FIREFLY (CHINESE EDITION ) INTERACTIVE PROTOTYPING AN INTRODUCTION TO PHYSICAL COMPUTING USING ARDUINO, GRASSHOPPER, AND FIREFLY (CHINESE EDITION ) INTERACTIVE PROTOTYPING 前言 - Andrew Payne 目录 1 2 Firefly Basics 3 COMPONENT TOOLBOX 目录 4 RESOURCES 致谢

More information

行业

行业 PCL-1800 PCL-1800 1.1...2 1.1.1 1K FIFO...2 1.1.2...2 1.1.3 16...3 1.1.4...3 1.1.5...3 1.1.6...3 1.2...3 1.3...4 1.4...5 2.1...5 2.2...6 2.2.1...6 2.2.2...6 2.2.3 D/A...7 2.2.4...7 2.2.5 TRIG0 GATE0...8

More information

目录

目录 ALTERA_CPLD... 3 11SY_03091... 3 12SY_03091...4....5 21 5 22...8 23..10 24..12 25..13..17 3 1EPM7128SLC.......17 3 2EPM7032SLC.......18 33HT46R47......19..20 41..20 42. 43..26..27 5151DEMO I/O...27 52A/D89C51...28

More information

untitled

untitled EDM12864-GR 1 24 1. ----------------------------------------------------3 2. ----------------------------------------------------3 3. ----------------------------------------------------3 4. -------------------------------------------------------6

More information

行业

行业 PCL-818HD/HG/L PCL-818HD/HG/L 1.1...2 1.1.1 /...2 1.1.2 ID...2 1.2...3 1.3...3 2.1...3 2.2...3 2.2.1...4 2.2.2...4 2.2.3 DMA...5 2.2.4...5 2.2.5 D/A...5 2.2.6...6 2.2.7 EXE.trigger GATE0...6 2.2.8 FIFO

More information

DPJJX1.DOC

DPJJX1.DOC 8051 111 2K 1 2 3 ' ' 1 CPU RAM ROM / A/D D/A PC CPU 40 68 10 20 8 51 PIII 8051 2 MCS51 8051 8031 89C51 8051 8031 89C51? MCS51 INTEL INTEL 8031 8051 8751 8032 8052 8752 8051 8051 8051 MCS51 8031 8031

More information

ATMEL AT90S8515 AVR CPU AVR AVR AVR ATMEL RISC 32 8 r0 r X Y Z R0 R1 R2 R13 R14 R15 R16 R17 R26 R27 R28 R29 R30 R31 0x00 0x

ATMEL AT90S8515 AVR CPU AVR AVR AVR ATMEL RISC 32 8 r0 r X Y Z R0 R1 R2 R13 R14 R15 R16 R17 R26 R27 R28 R29 R30 R31 0x00 0x 115 AVR W.V. Awdrey ATMEL AVR PIC AVR PIC AVR RISC AVR PIC AVR AVR AVR AVR AVR ATtiny15 AVR AVR AVR RAM ROM 121 116 122 ATMEL AT90S8515 AVR CPU AVR AVR AVR ATMEL RISC 32 8 r0 r31 3 16 X Y Z 6-1 118 7 0

More information

1 CPU

1 CPU 2000 Tel 82316285 82317634 Mail liuxd@buaa.edu.cn 1 CPU 2 CPU 7 72 A B 85 15 3 1/2 M301 2~17 : 3/4 1/2 323 IBM PC 1. 2. 3. 1. 2. 3. 1.1 Hardware Software 1.2 M3 M2 M1 1.2 M3 M1 M2 M2 M1 M1 M1 1.2 M3 M1

More information

Embargoed until May 4, 2004 EXPRESS 40 NI HQ 3000 1000 5000 ~ 500 10% / 500 85% NI LabVIEW 7 Express Express EXPRESS : #1 GPS Navigation PC/WWW/Email CD+RW Mobile Phone PDA DVD+RW Satellite Car Alarm/Radio

More information

ARM JTAG实时仿真器安装使用指南

ARM JTAG实时仿真器安装使用指南 ARM JTAG Version 1.31 2003. 11. 12 ARM JTAG ARM JTAG.3 ARM 2.1.4 2.2.4 ARM JTAG 3.1 18 3.2 18 3.2.1 Multi-ICE Server.18 3.2.2 ADS..21 ARM JTAG 4.1 Multi-ICE Server 33 4.1.1 Multi-ICE Server..... 33 4.1.2

More information

701PIC Introduction to PICMicro MCUs

701PIC Introduction to PICMicro MCUs 701 PIC PICmicro MCU 介绍 PIC16 系列产品的汇编编程 HANDS-ON Microchip Technology Incorporated. All Rights Reserved. 701 PIC PIC MCU - Introduction to Programming 1 日程 讲述部分 讲述 90 分钟 休息 20 分钟 实验部分 1 2 个实验 60 分钟 休息

More information

C语言的应用.PDF

C语言的应用.PDF AVR C 9 1 AVR C IAR C, *.HEX, C,,! C, > 9.1 AVR C MCU,, AVR?! IAR AVR / IAR 32 ALU 1KBytes - 8MBytes (SPM ) 16 MBytes C C *var1, *var2; *var1++ = *--var2; AVR C 9 2 LD R16,-X ST Z+,R16 Auto (local

More information

1 Project New Project 1 2 Windows 1 3 N C test Windows uv2 KEIL uvision2 1 2 New Project Ateml AT89C AT89C51 3 KEIL Demo C C File

1 Project New Project 1 2 Windows 1 3 N C test Windows uv2 KEIL uvision2 1 2 New Project Ateml AT89C AT89C51 3 KEIL Demo C C File 51 C 51 51 C C C C C C * 2003-3-30 pnzwzw@163.com C C C C KEIL uvision2 MCS51 PLM C VC++ 51 KEIL51 KEIL51 KEIL51 KEIL 2K DEMO C KEIL KEIL51 P 1 1 1 1-1 - 1 Project New Project 1 2 Windows 1 3 N C test

More information

51 C 51 isp 10 C PCB C C C C KEIL

51 C 51 isp 10   C   PCB C C C C KEIL http://wwwispdowncom 51 C " + + " 51 AT89S51 In-System-Programming ISP 10 io 244 CPLD ATMEL PIC CPLD/FPGA ARM9 ISP http://wwwispdowncom/showoneproductasp?productid=15 51 C C C C C ispdown http://wwwispdowncom

More information

12232A LED LED LED EL EL CCFL EL CCF

12232A LED LED LED EL EL CCFL EL CCF 12232A 0 50-20 +70-30 +85 LED LED LED EL EL CCFL EL CCF 122 x 32 1/32Duty 1/5Bias 6:00 STN( ), EL LED EL/100VAC 400HZ LED/4.2VDC 1 / VDD-VSS 0 6.5 V Ta=25 LCD VDD-V0 0 12.0 V V1 0 VDD V VDD-VSS - 4.75

More information

P4V88+_BIOS_CN.p65

P4V88+_BIOS_CN.p65 1 Main H/W Monitor Boot Security Exit System Overview System Time System Date [ 17:00:09] [Wed 12/22/2004] BIOS Version : P4V88+ BIOS P1.00 Processor Type : Intel (R) Pentium (R) 4 CPU 2.40 GHz Processor

More information

P4VM800_BIOS_CN.p65

P4VM800_BIOS_CN.p65 1 Main H/W Monitor Boot Security Exit System Overview System Time System Date [ 17:00:09] [Fri 02/25/2005] BIOS Version : P4VM800 BIOS P1.00 Processor Type : Intel (R) Pentium (R) 4 CPU 2.40 GHz Processor

More information

逢 甲 大 學

逢  甲  大  學 益 老 年 不 易更 例 不 異 列 - I - 錄 錄 流 錄 六 來 錄 - II - 錄 錄 錄 錄 錄 錄 參 料 錄 - III - 料 讀 讀 錄 讀 數 錄 錄 錄 錄 錄 - IV - 錄 錄 行 錄 錄 錄 錄 讀 錄 錄 錄 讀 錄 錄 - V - 了 說 力 兩 了 - 1 - 列 邏 路 列 不 不 FLEX 10K Devices at a Glance Feature

More information

EK-STM32F

EK-STM32F STMEVKIT-STM32F10xx8 软 件 开 发 入 门 指 南 目 录 1 EWARM 安 装... 1 1.1 第 一 步 : 在 线 注 册... 1 1.2 第 二 步 : 下 载 软 件... 2 1.3 第 三 步 : 安 装 EWARM... 3 2 基 于 STMEVKIT-STM32F10xx8 的 示 例 代 码 运 行... 6 2.1 GPIO Demo... 6 2.2

More information

RESET OSCO OSCI OSC CPU WDTEN RC RESET PRESCALER PORTA (4-BITS) WATCHDOG TIMER Power on PORTB (4-BITS) PORTA [0:3] PORTB [0:3] LPD PORTC (4-BITS) LPDO

RESET OSCO OSCI OSC CPU WDTEN RC RESET PRESCALER PORTA (4-BITS) WATCHDOG TIMER Power on PORTB (4-BITS) PORTA [0:3] PORTB [0:3] LPD PORTC (4-BITS) LPDO 4K / I/O 4 SH6610C 4 OTPROM 4K X 16 SH69P25 MASK ROM 4K X 16 SH69K25 RAM 192 X 4-32 - 160 2.4V - 5.5V 5.0V 22 I/O 4 8 / PORTA-PORTF / - Timer0 - PORTB & PORTC / - 32.768kHz 4MHz - 400kHz 4MHz - RC 400kHz

More information

投影片 1

投影片 1 2 理 1 2-1 CPU 2-2 CPU 理 2-3 CPU 類 2 什 CPU CPU Central Processing Unit ( 理 ), 理 (Processor), CPU 料 ( 例 ) 邏 ( 例 ),, 若 了 CPU, 3 什 CPU CPU 了, 行, 利 CPU 力 來 行 4 什 CPU 5 2-2-1 CPU CPU 了 (CU, Control Unit) / 邏

More information

1.1 ML_ONOFF = 1 Q 3 Q 8 C 0.3V M 2 L 1 ML_ONOFF = 0 Q 3 Q 8 C 1. + R31 VCC R21 10K ML_ONOFF R15 0:off 1:on 1K Green Light VCC=5V L1 Q VDD=12V C

1.1 ML_ONOFF = 1 Q 3 Q 8 C 0.3V M 2 L 1 ML_ONOFF = 0 Q 3 Q 8 C 1. + R31 VCC R21 10K ML_ONOFF R15 0:off 1:on 1K Green Light VCC=5V L1 Q VDD=12V C AUTOMATIC TROLLEY H K Hwang K K Chen J-S Lin S-C Wang M-L Li C-C Lin W-B Lin Dept. Of Electrical Engineering Far East College ABSTRACT This paper proposes an automatic trolley which can move automatically

More information

The golden pins of the PCI card can be oxidized after months or years

The golden pins of the PCI card can be oxidized after months or years Q. 如何在 LabWindows/CVI 編譯 DAQ Card 程式? A: 請參考至下列步驟 : 步驟 1: 安裝驅動程式 1. 安裝 UniDAQ 驅動程式 UniDAQ 驅動程式下載位置 : CD:\NAPDOS\PCI\UniDAQ\DLL\Driver\ ftp://ftp.icpdas.com/pub/cd/iocard/pci/napdos/pci/unidaq/dll/driver/

More information

行业

行业 PCI-1710 1.1...2 1.1.1...2 1.1.2...2 1.1.3 FIFO( )...2 1.1.4...2 1.1.5...2 1.1.6 16 16...3 1.1.7...3 1.2...3 1.3...3 2.1...3 2.2...4 2.2.1...4 2.2.2...5 2.3...9 2.3.1...10 2.3.2... 11 2.3.3...12 2.3.4...12

More information

MPLAB ICE PROMATE II MPLAB MPLAB ICE 2 3 Microchip MPLAB ICE ICSP PROMATE II AC44 MPLAB ICE MICROCHIP 2 Socket Module 3 4 4 (Transition Socket) SOIC SSOP PQFP TQFP PRO MATEII PRO MATEII DV73 PC ICD ICD2

More information

Microsoft PowerPoint - CA_02 Chapter5 Part-I_Single _V2.ppt

Microsoft PowerPoint - CA_02 Chapter5 Part-I_Single _V2.ppt Chapter5- The Processor: Datapath and Control (Single-cycle implementation) 臺大電機系吳安宇教授 V. 3/27/27 V2. 3/29/27 For 27 DSD Course 臺大電機吳安宇教授 - 計算機結構 Outline 5. Introduction 5.2 Logic Design Conventions 5.3

More information

SPHE8202R Design Guide Important Notice SUNPLUS TECHNOLOGY CO. reserves the right to change this documentation without prior notice. Information provi

SPHE8202R Design Guide Important Notice SUNPLUS TECHNOLOGY CO. reserves the right to change this documentation without prior notice. Information provi SPHE8202R Design Guide V2.0 JUN, 2007 19, Innovation First Road Science Park Hsin-Chu Taiwan 300 R.O.C. Tel: 886-3-578-6005 Fax: 886-3-578-4418 Web: www.sunplus.com SPHE8202R Design Guide Important Notice

More information

untitled

untitled 8086/8088 CIP /. 2004.8 ISBN 7-03-014239-X.... TP313 CIP 2004 086019 16 100717 http://www.sciencep.com * 2004 8 2004 8 1 5 500 787 1092 1/16 16 1/2 391 000 1 2 ii 1 2 CAI CAI 3 To the teacher To the student

More information

Bus Hound 5

Bus Hound 5 Bus Hound 5.0 ( 1.0) 21IC 2007 7 BusHound perisoft PC hound Bus Hound 6.0 5.0 5.0 Bus Hound, IDE SCSI USB 1394 DVD Windows9X,WindowsMe,NT4.0,2000,2003,XP XP IRP Html ZIP SCSI sense USB Bus Hound 1 Bus

More information

System Design and Setup of a Robot to Pass over Steps Abstract In the research, one special type of robots that can pass over steps is designed and se

System Design and Setup of a Robot to Pass over Steps Abstract In the research, one special type of robots that can pass over steps is designed and se 8051 8051 System Design and Setup of a Robot to Pass over Steps Abstract In the research, one special type of robots that can pass over steps is designed and setup. This type of robot uses two kinds of

More information

1

1 磁軌式讀卡機 1288 系列 使用手冊 Version 1.0 1 2 3 4 5 6 7 8 9 10 11 12 1288 MSR Micro controller : With Decoder Open Visual COM port to read data (UART Interface) From 1288 Or direct control 1288 by sending Command

More information

第 15 章 程 式 編 写 語 言 15.1 程 式 編 写 語 言 的 角 色 程 式 編 寫 語 言 是 程 式 編 寫 員 與 電 腦 溝 通 的 界 面 語 法 是 一 組 規 則 讓 程 式 編 寫 員 將 字 詞 集 合 起 來 電 腦 是 處 理 位 元 和 字 節 的 機 器, 與

第 15 章 程 式 編 写 語 言 15.1 程 式 編 写 語 言 的 角 色 程 式 編 寫 語 言 是 程 式 編 寫 員 與 電 腦 溝 通 的 界 面 語 法 是 一 組 規 則 讓 程 式 編 寫 員 將 字 詞 集 合 起 來 電 腦 是 處 理 位 元 和 字 節 的 機 器, 與 程 式 編 写 語 言 在 完 成 這 章 後, 你 將 能 夠 了 解 程 式 編 写 語 言 的 功 能 了 解 高 階 語 言 和 低 階 語 言 之 間 的 分 別 知 道 翻 譯 程 式 的 意 義 和 能 夠 把 翻 譯 程 式 分 類 為 : 匯 編 程 式 編 譯 程 式 和 解 譯 程 式 認 識 不 同 翻 譯 程 式 的 優 點 和 缺 點 程 式 是 指 揮 電 腦 的 指

More information

Microsoft PowerPoint - C15_LECTURE_NOTE_05.ppt

Microsoft PowerPoint - C15_LECTURE_NOTE_05.ppt 8088/8086 MICROPROCSOR PROGRAMMING INTEGER INSTRUCTIONS AND COMPUTATIONS The MOVE The move (MOV) instruction is used to transfer a byte or a word of data from a source operand to a destination operand

More information

四位微控制器ML64168_ _.doc

四位微控制器ML64168_ _.doc SSSC /4168P 2005 8 4 4, (ADC), LCD Driver, (Buzzer), 1 3 CPU17 CPU 26 33 42 45 48 73 79 85 89 A/D 92 111 125 128 131 SSU4168P 133 143 A: / 153 B: 156 C: 158 D: 160 E: 161 F: 163 G: PAD 167 2 ,, 11 4 CMOS

More information

(Guangzhou) AIT Co, Ltd V 110V [ ]! 2

(Guangzhou) AIT Co, Ltd V 110V [ ]! 2 (Guangzhou) AIT Co, Ltd 020-84106666 020-84106688 http://wwwlenxcn Xi III Zebra XI III 1 (Guangzhou) AIT Co, Ltd 020-84106666 020-84106688 http://wwwlenxcn 230V 110V [ ]! 2 (Guangzhou) AIT Co, Ltd 020-84106666

More information

untitled

untitled MODBUS 1 MODBUS...1 1...4 1.1...4 1.2...4 1.3...4 1.4... 2...5 2.1...5 2.2...5 3...6 3.1 OPENSERIAL...6 3.2 CLOSESERIAL...8 3.3 RDMULTIBIT...8 3.4 RDMULTIWORD...9 3.5 WRTONEBIT...11 3.6 WRTONEWORD...12

More information

ARK-14013/14017/14018

ARK-14013/14017/14018 ARK-24017F 8 ARK-24017F : 8 2 ii 1997~2000,,,,,, 1...3 1.1 ARK...3 1.2 ARK-24017F...3 ARK-24017F?...3 ARK-24017F...3 ARK-24017F...3 ARK-24017F...5 ARK-24017F...6...7 2.1...7 2.2...7 ARK...7...8...8...8...9

More information

Cube20S small, speedy, safe Eextremely modular Up to 64 modules per bus node Quick reaction time: up to 20 µs Cube20S A new Member of the Cube Family

Cube20S small, speedy, safe Eextremely modular Up to 64 modules per bus node Quick reaction time: up to 20 µs Cube20S A new Member of the Cube Family small, speedy, safe Eextremely modular Up to 64 modules per bus de Quick reaction time: up to 20 µs A new Member of the Cube Family Murrelektronik s modular I/O system expands the field-tested Cube family

More information

68369 (ppp quickstart guide)

68369 (ppp quickstart guide) Printed in USA 04/02 P/N 68369 rev. B PresencePLUS Pro PC PresencePLUS Pro PresencePLUS Pro CD Pass/Fails page 2 1 1. C-PPCAM 2. PPC.. PPCAMPPCTL 3. DB9D.. STPX.. STP.. 01 Trigger Ready Power 02 03 TRIGGER

More information

<4D F736F F D20B3E6B4B9A4F930365F32A443AC71C5E3A5DCBEB9B1B1A8EE2E646F63>

<4D F736F F D20B3E6B4B9A4F930365F32A443AC71C5E3A5DCBEB9B1B1A8EE2E646F63> 七段顯示器控制電路四位數 _ 使用解碼器驅動 +5 V 10 uf 8.2 k 12 MHz 20 pf 1 2 3 4 5 6 7 8 9 P1.0 P1.1 P1.2 P1.3 P1.4 P1.5 P1.6 P1.7 RESET 10 P3.0 11 12 13 14 15 16 17 18 19 20 P3.1 P3.2 P3.3 P3.4 P3.5 P3.6 P3.7 XTAL2 XTAL1

More information

邏輯分析儀的概念與原理-展示版

邏輯分析儀的概念與原理-展示版 PC Base Standalone LA-100 Q&A - - - - - - - SCOPE - - LA - - ( Embedded ) ( Skew ) - Data In External CLK Internal CLK Display Buffer ASIC CPU Memory Trigger Level - - Clock BUS Timing State - ( Timing

More information

General Description: Preliminary TTP916 Consumer IC VCD/DVD LCD Green mode Stand-by mode( 1W ) Features: 2.2V-5.5V LCD RAM read condition 2.6V-5.5V RC

General Description: Preliminary TTP916 Consumer IC VCD/DVD LCD Green mode Stand-by mode( 1W ) Features: 2.2V-5.5V LCD RAM read condition 2.6V-5.5V RC General Description: IC VCD/DVD LCD Green mode Stand-by mode( 1W ) Features: 2.2V-5.5V LCD RAM read condition 2.6V-5.5V RC 15K 300pF 256KHZ default on 32 function key Built-in TT6221/TT6222 decoder Provide

More information

JTAG ICE PC JTAG ICE JTAG ISP... 5 IDE AVR STUDIO JTAGICE JTAGICE... 12

JTAG ICE PC JTAG ICE JTAG ISP... 5 IDE AVR STUDIO JTAGICE JTAGICE... 12 ... 3... 3... 3... 3... 4 1JTAG ICE PC... 4 2JTAG ICE... 4 3... 4 4... 4 5JTAG... 5 6ISP... 5 IDE... 6 1 AVR STUDIO... 6 2 JTAGICE... 6 3JTAGICE... 12 4.... 16 5.... 17 6. JTAG ICE... 19 ISP... 20 1PonyProg2000...

More information

Microsoft Word - MSP430 Launchpad 指导书.docx

Microsoft Word - MSP430 Launchpad 指导书.docx Contents 3... 9... 14 MSP430 LAUNCHPAD 指导书 3 第一部分第一个工程 New Project File > New > CCS Project Project name: ButtonLED Device>Family: MSP430 Variant: MSP430G2553 Project templates and examples : Empty Project

More information

untitled

untitled niosii H:\DB2005\project\niosDK\Example\NiosSmall QuartusII4.2 File -> New Project Wizard Diectory,Name,Top-Level Entity Add Files EDA Tools Setting Finish, OK H:\DB2005\project\niosDK\Example\NiosSmall

More information

Ác Åé å Serial ATA ( Sil3132) S A T A (1) SATA (2) BIOS SATA (3)* RAID BIOS RAID (4) SATA (5) SATA (a) S A T A ( S A T A R A I D ) (b) (c) Windows XP

Ác Åé å Serial ATA ( Sil3132) S A T A (1) SATA (2) BIOS SATA (3)* RAID BIOS RAID (4) SATA (5) SATA (a) S A T A ( S A T A R A I D ) (b) (c) Windows XP Serial ATA ( Sil3132)...2 (1) SATA... 2 (2) B I O S S A T A... 3 (3) RAID BIOS RAID... 6 (4) S A T A... 10 (5) S A T A... 12 Ác Åé å Serial ATA ( Sil3132) S A T A (1) SATA (2) BIOS SATA (3)* RAID BIOS

More information

行业

行业 PCI-1711/1711L 1.1...2 1.1.1...2 1.1.2...2 1.1.3 FIFO...2 1.1.4...2 1.1.5 16 16...3 1.2...3 2.1...3 2.2...3 2.2.1... 2.2.2...8 2.3...10 2.3.1...10 2.3.2... 11 2.3.3...12 2.3.4...13 2.4.5...14 3.1...16

More information

行业

行业 PCI-1716/1716L 1.1...2 1.1.1...2 1.1.2 / /SD*/BU*...2 1.1.3 FIFO( )...2 1.1.4...2 1.1.5 16 16...3 1.1.6...3 1.1.7 ID...3 1.2...3 2.1...3 2.2...4 2.2.1...4 2.2.2...6 2.3... 11 2.3.1... 11 2.3.2...12 2.3.3...13

More information

audiogram3 Owners Manual

audiogram3 Owners Manual USB AUDIO INTERFACE ZH 2 AUDIOGRAM 3 ( ) * Yamaha USB Yamaha USB ( ) ( ) USB Yamaha (5)-10 1/2 AUDIOGRAM 3 3 MIC / INST (XLR ) (IEC60268 ): 1 2 (+) 3 (-) 2 1 3 Yamaha USB Yamaha Yamaha Steinberg Media

More information

: WICE-PIC 1.1 WICE-PIC 1.2 WICE-PIC : WICE-PIC WICE-PIC 2.5 WICE-PIC 2.6 : : : : A. B.E.V.Board 1. Internet Internet WWW: http//

: WICE-PIC 1.1 WICE-PIC 1.2 WICE-PIC : WICE-PIC WICE-PIC 2.5 WICE-PIC 2.6 : : : : A. B.E.V.Board 1. Internet Internet WWW: http// : WICE-PIC 1.1 WICE-PIC 1.2 WICE-PIC : WICE-PIC 2.1 2.2 2.3 2.4 WICE-PIC 2.5 WICE-PIC 2.6 : : : : A. B.E.V.Board 1. Internet Internet WWW: http//www.leap.com.tw 2. : TEL: 886-2-7884800 FAX: 886-2-6512307

More information

untitled

untitled (100V 120V 220V 230V) i ii ! (Return Lead) iii iv 1....... 1 1-1.... 1 1-2.... 2 2..... 4 3..... 3-1.... 3-2.... 3-3....... 4..... 9 5......... 5-1.LCD..... 5-2.... 5-3.... 5-4.... 6..... 6-1.... 6-2....

More information

untitled

untitled FBC0409 V1.0 1.0 05.06.22 SIA 2005 SIA SIA SIA SIA SIA 114 86-24-23970133 HTTP://WWW.SIA.CN YANG@SIA.CN 2 ...5...5...6 PIN...6...7 1 CPU...8 2...8 4...8 5 DMA...9 7....9 8...9 9...10 A...10 B...10...11.

More information

Microsoft Word - LD5515_5V1.5A-DB-01 Demo Board Manual

Microsoft Word - LD5515_5V1.5A-DB-01 Demo Board Manual Subject LD5515 Demo Board Model Name (5V/1.5A) Key Features Built-In Pump Express TM Operation Flyback topology with PSR Control Constant Voltage Constant Current High Efficiency with QR Operation (Meet

More information

Microsoft PowerPoint - 701_PIC-CHN_Attendee.ppt

Microsoft PowerPoint - 701_PIC-CHN_Attendee.ppt 701 PIC PICmicro MCU 介绍 PIC16 系列产品的汇编编程 HANDS-ON 日程 讲述部分 讲述 90 分钟 休息 20 分钟 实验部分 1 2 个实验 60 分钟 休息 60 分钟 实验部分 2 10 4 个实验 2 小时 休息 20 分钟 讲述部分的内容 架构 存储器 指令集 开发软件 (MPLAB IDE) 实验和演示部分的内容 Labs 在 MPLAB IDE 创建项目

More information

untitled

untitled XZL024 http://item.taobao.com/item.htm?id=6321822194 1 1 1.1 1.2 1.3 1.4 2 2.1 2.2 2.3 3 USBee Suite 3.1 3.2 3.3 3.4 4 RS232 RS485 RS422 CAN http://item.taobao.com/item.htm?id=6321822194 2 1 XZL024 PC

More information

Microsoft PowerPoint - C15_LECTURE_NOTE_04.ppt

Microsoft PowerPoint - C15_LECTURE_NOTE_04.ppt MACHINE LANGUAGE CODING AND THE DEBUG SOFTWARE DEVELOPMENT PROGRAM OF THE PC MACHINE LANGUAGE CODING AND THE DEBUG SOFTWARE DEVELOPMENT PROGRAM OF THE PC 4.1 Converting Assembly Language Instructions to

More information

User ID 150 Password - User ID 150 Password Mon- Cam-- Invalid Terminal Mode No User Terminal Mode No User Mon- Cam-- 2

User ID 150 Password - User ID 150 Password Mon- Cam-- Invalid Terminal Mode No User Terminal Mode No User Mon- Cam-- 2 Terminal Mode No User User ID 150 Password - User ID 150 Password Mon- Cam-- Invalid Terminal Mode No User Terminal Mode No User Mon- Cam-- 2 Mon1 Cam-- Mon- Cam-- Prohibited M04 Mon1 Cam03 Mon1 Cam03

More information

PIC16F87X基本指令說明

PIC16F87X基本指令說明 PIC16F87X 基本指令說明 ADDLW K 是 Add Literal and W 縮寫,ADDLW K 此指令是將 W 的內容與數值 K 相加, 並將加完結果存於 W 內 即 (W)+K (W) 例 :W=0X11,K=0X15, 執行 ADDLW K 之後, 結果為 W=0X26,K=0X15 ADDWF 是 Add W and f 縮寫,ADDWF F,d 此指令是將 W 之內容與 RAM(file)

More information

P3B-F Pentium III/II/Celeron TM

P3B-F Pentium III/II/Celeron TM P3B-F Pentium III/II/Celeron TM 1999 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 13 R PS2 KBMS USB COM1 COM2 JTPWR ATXPWR PWR_FAN CPU_FAN Row 0 1 2 3 4 5 6 7 DSW JP20

More information

Microsoft PowerPoint - C15_LECTURE_NOTE_04.ppt

Microsoft PowerPoint - C15_LECTURE_NOTE_04.ppt MACHINE LANGUAGE CODING AND THE DEBUG SOFTWARE DEVELOPMENT PROGRAM OF THE PC General instruction format for machine code 611 37100 微處理機原理與應用 Lecture 04-4 MACHINE LANGUAGE CODING AND THE DEBUG SOFTWARE

More information

技 术 支 持 电 话 1.800.283.5936 1.801.974.3760 传 真 1.801.977.0087 电 子 邮 件 网 址 CONVERGE PRO 880/880T/840T/8i, CON

技 术 支 持 电 话 1.800.283.5936 1.801.974.3760 传 真 1.801.977.0087 电 子 邮 件 网 址  CONVERGE PRO 880/880T/840T/8i, CON CONVERGE PRO 880 880T 840T 8i TH20 CONVERGE SR 1212 专 业 会 议 系 统 安 装 和 操 作 手 册 技 术 支 持 电 话 1.800.283.5936 1.801.974.3760 传 真 1.801.977.0087 电 子 邮 件 tech.support@clearone.com 网 址 www.clearone.com CONVERGE

More information

52C-14266-5

52C-14266-5 逻 辑 分 析 仪 基 础 知 识 入 门 手 册 www.tektronix.com.cn/logic_analyzers 15 入 门 手 册 目 录 引 言 3-4 起 源 3 数 字 示 波 器 3 逻 辑 分 析 仪 4 逻 辑 分 析 仪 操 作 5-13 连 接 被 测 系 统 5 探 头 5 设 置 逻 辑 分 析 仪 7 设 置 时 钟 模 式 7 设 置 触 发 7 采 集 状

More information

untitled

untitled 0755 85286856 0755 82484849 路 4.5V ~5.5V 流 @VDD=5.0V,

More information

PowerPoint 簡報

PowerPoint 簡報 微算機原理與實驗 (UEE 2301/1071 ) Chap 5. MCS-51 Addressing Modes 宋開泰 Office:EE709 Phone:5731865( 校內分機 :31865) E-mail:ktsong@mail.nctu.edu.tw URL:http://isci.cn.nctu.edu.tw 1 Addressing Modes Addressing mode is

More information

MODEL 62000H SERIES 5KW / 10KW / 15KW 0 ~ 375A 0 ~ 1000V/2000V( ) : 200/220Vac, 380/400Vac, 440/480Vac 3U/15KW / & 150KW / ( 10 ms ~ 99 hours)

MODEL 62000H SERIES 5KW / 10KW / 15KW 0 ~ 375A 0 ~ 1000V/2000V( ) : 200/220Vac, 380/400Vac, 440/480Vac 3U/15KW / & 150KW / ( 10 ms ~ 99 hours) MODEL 62000H SERIES 5KW / 10KW / 15KW 0 ~ 375A 0 ~ 1000V/2000V( ) : 200/220Vac, 380/400Vac, 440/480Vac 3U/15KW / &150KW / ( 10 ms ~ 99 hours) 10 100 / PROGRAMMABLE DC POWER SUPPLY MODEL 62000H SERIES USB

More information

典型自编教材

典型自编教材 河 南 科 技 大 学 计 算 机 实 验 教 学 中 心 1. 计 算 机 文 化 基 础 实 验 指 导 书 2. 数 据 结 构 实 验 指 导 书 3. 操 作 系 统 实 验 指 导 书 4. 面 向 对 象 程 序 设 计 实 验 指 导 书 5. 数 据 库 原 理 实 验 指 导 书 6. 编 译 原 理 实 验 指 导 书 7. JAVA 程 序 设 计 实 验 指 导 书 8.

More information

Microsoft PowerPoint - C15_LECTURE_NOTE_05.ppt

Microsoft PowerPoint - C15_LECTURE_NOTE_05.ppt 8088/8086 MICROPROCESSOR PROGRAMMING INTEGER INSTRUCTIONS AND COMPUTATIONS 8088/8086 MICROPROCESSOR PROGRAMMING INTEGER INSTRUCTIONS AND COMPUTATIONS 5.1 Data-Transfer Instructions 5.2 Arithmetic Instructions

More information

Microsoft Word - AP1515V02

Microsoft Word - AP1515V02 Document No. Rev.: V0.20 Page: 1 of 9 Revision History Rev. DRN # History Initiator Effective Date V01 V02 Initial document 黃宗文 Add second package description 葉宗榮 2014/05/15 2015/09/08 Initiator: 雷晨妤 (DCC)

More information

学习MSP430单片机推荐参考书

学习MSP430单片机推荐参考书 MSP430 16 MSP430 C MSP430 C MSP430 FLASH 16 1 CPU 16 ALU 16 PC SP SR R4~R15 2 3 00-FFH 100-1FFH 4 5 1 2 51 24 27 6 1 2 3 4 5 6 4 12 SR SP SR CPU SR CPU C Z N GIE CPUOff CPU OscOff SCG0 SCG1 CPU EXIT SP

More information

2005.book

2005.book ...4... 4... 7...10... 10... 10... 10... 10... 11... 11 PCC... 11 TB170... 12 /... 12...13... 13 BP150 / BP151 / BP152 / BP155... 14...15... 15... 15... 15... 15... 15... 15... 16 PS465 / PS477... 17 PS692

More information

Microsoft PowerPoint - C15_LECTURE_NOTE_11

Microsoft PowerPoint - C15_LECTURE_NOTE_11 INTERRUPT INTERFACE OF THE 8088 AND 8086 MICROPROCESSOR INTERRUPT INTERFACE OF THE 8088 AND 8086 MICROPROCESSOR 11.1 Interrupt Mechanism, Types and Priority 11.2 Interrupt Vector Table 11.3 Interrupt Instructions

More information

A Preliminary Implementation of Linux Kernel Virus and Process Hiding

A Preliminary Implementation of Linux Kernel Virus and Process Hiding 邵 俊 儒 翁 健 吉 妍 年 月 日 学 号 学 号 学 号 摘 要 结 合 课 堂 知 识 我 们 设 计 了 一 个 内 核 病 毒 该 病 毒 同 时 具 有 木 马 的 自 动 性 的 隐 蔽 性 和 蠕 虫 的 感 染 能 力 该 病 毒 获 得 权 限 后 会 自 动 将 自 身 加 入 内 核 模 块 中 劫 持 的 系 统 调 用 并 通 过 简 单 的 方 法 实 现 自 身 的

More information