# 微算機 Chaper 1 ###### tags: `microcontroller` ## 電腦的組成 1. CPU 2. input device 3. output device 4. Memory ## 名詞解釋 ### Address 就跟 C 語言裡面的 address 一樣的意思,多用來表達 Memory 或是特定的 I/O device 的地址。 ### Arithmetic-logic unit(ALU) 一種數位電路,用來實作 arithmetic 或 logic 運算,多分成 8-bit , 16-bit , 32-bit 。 ### Bit size 代表在基礎的算術運算元件裡,能同時處理數字的 bit 數,而同時處理數字的bit數所形成的 group ,稱為一個 *word* ### CPU 裡面包含 registers ( fast memory element )、 an ALU (算術邏輯單元)、control unit。 ### Havard architecture 這是一種 CPU 的 architecture ,這種 architecture 特色是可以同時執行程式和讀取記憶體(兩者的 buses 是分開的) ### Big endian low memory address 儲存在 higher byte ,而 high memory address 儲存在 lower byte。 ### Little endian low memory address 儲存在 low byte ,而 high memory address 儲存在 high byte。 PIC18F 用 little endian 。 ### Pipelining 一種優化技術,在程式執行的當中可以同時去 fetch 下一個 instruction 。 ### Random-asscess memory(RAM) is a read/write memory. ### Read-only memory(ROM) a storage device whose contents can only be read. ### Reduce Instruction Set Computer(RISC) 較為簡單的instruction set,只要少量的transister就可以執行,成本較為便宜。 ### Complex Instruction Set Computer(CISC) 較為複雜的instruction set。 ### peripheral 通常指某個機器的外部設備,以這次PIC18F為例,就是timer , ADC(類比數位轉換器)。 ### zero extension 0xFF = 0x00FF unsigned number把8bit正數轉成16bit正數的方法,就是在前面補0 ### sign extension 0xFF = 0xFFFF 都是-1 signed number 就是在前面補1,但是好像只在數字原本就是負的時候,如果原本是正前面補0才會對? --- ## 兩數相加 ![](https://i.imgur.com/Bhu0Gca.png) 當兩個signed number相加時,若 $C_{f} \neq C_p$ ,代表加法產生了溢位。 在電路當中可以使用 $C_{f} \oplus C_{p}$ 來檢查相加結果是否正確。 --- ## ASCII and EBCDIC Codes - ASCII (American Sandard Code for Information Interchange) - EBCDIC (Extneded binary-coded-decimal interchange code)