導航:首頁 > 操作系統 > 單片機中lockbits知識

單片機中lockbits知識

發布時間:2022-08-06 23:06:07

單片機中RAM與EPROM的區別

EPROM內資料的寫入要用專用的編程器。這種存儲器在斷電時將丟失其存儲內容,故主要用於存儲短時間使用的程序。
RAM
隨機存取存儲器
存儲單元的內容可按需隨意取出或存入,且存取的速度與存儲單元的位置無關的存儲器,解決了PROM晶元只能寫入一次的弊端。EPROM晶元有一個很明顯的特徵EPROM(Erasable
Programmable
ROM,可擦除可編程ROM)晶元可重復擦除和寫入,並且往晶元中寫內容時必須要加一定的編程電壓(VPP=12—24V,隨不同的晶元型號而定)。EPROM的型號是以27開頭的,如27C020(8*256K)是一片2M
Bits容量的EPROM晶元。EPROM晶元在寫入資料後,還要以不透光的貼紙或膠布把窗口封住,以免受到周圍的紫外線照射而使資料受損,可以看到其內部的集成電路,紫外線透過該孔照射內部晶元就可以擦除其內的數據,完成晶元擦除的操作要用到EPROM擦除器,透過該窗口,在其正面的陶瓷封裝上,開有一個玻璃窗口

⑵ avr編程器燒寫程序加密

AVR單片機系列齊全,可適用於各種不同場合的要求。AVR單片機有4個檔次:

1、低檔Tiny系列AVR單片機: 主要有Tiny11/12/13/15/26/28等;

2、中檔AT90S系列AVR 單片機: 主要有AT90S1200/2313/8515/8535等; (正在淘汰或轉型到Mega中)

3、高檔ATmega系列AVR單片機: 主要有ATmega8/16/32/64/128

4、最新的還有Xmega系列的AVR單片機:主要有A系列的Xmega16/32/64A4,帶LCD驅動的B系列Xmega如ATxmega64B等。

在晶元的數據手冊裡面,明確的說明,Lock bits是可以進行編輯的,也就是說是通過改寫Lock bits來進行加密的,一般來說不建議普通開發人員花時間在研究這個上面,因為現有的燒錄器廠商已經做了很人性化的設計和很直觀的按鈕來改寫一些寄存器,如截圖:

當你需要進行加密設置的時候,直接復選就可以了。

⑶ 跪求PLC 和51單片機的英文資料

Introction of Programmable controllers
From a simple heritage, these remarkable systems have evolved to not only replace electromechanical devices, but to solve an ever-increasing array of control problems in both process and nonprocess instries. By all indications, these microprocessor powered giants will continue to break new ground in the automated factory into the 1990s.
HISTORY
In the 1960s, electromechanical devices were the order of the day ass far as control was concerned. These devices, commonly known as relays, were being used by the thousands to control many sequential-type manufacturing processes and stand-along machines. Many of these relays were in use in the transportation instry, more specifically, the automotive instry. These relays used hundreds of wires and their interconnections to effect a control solution. The performance of a relay was basically reliable - at least as a single device. But the common applications for relay panels called for 300 to 500 or more relays, and the reliability and maintenance issues associated with supporting these panels became a very great challenge. Cost became another issue, for in spite of the low cost of the relay itself, the installed cost of the panel could be quite high. The total cost including purchased parts, wiring, and installation labor, could range from $30~$50 per relay. To make matters worse, the constantly changing needs of a process called for recurring modifications of a control panel. With relays, this was a costly prospect, as it was accomplished by a major rewiring effort on the panel. In addition these changes were sometimes poorly documented, causing a second-shift maintenance nightmare months later. In light of this, it was not uncommon to discard an entire control panel in favor of a new one with the appropriate components wired in a manner suited for the new process. Add to this the unpredictable, and potentially high, cost of maintaining these systems as on high-volume motor vehicle proction lines, and it became clear that something was needed to improve the control process – to make it more reliable, easier to troubleshoot, and more adaptable to changing control needs.
That something, in the late 1960s, was the first programmable controller. This first 『revolutionary』 system wan developed as a specific response to the needs of the major automotive manufacturers in the United States. These early controllers, or programmable logic controllers (PLC), represented the first systems that 1 could be used on the factory floor, 2 could have there 『logic』 changed without extensive rewiring or component changes, and 3 were easy to diagnose and repair when problems occurred.
It is interesting to observe the progress that has been made in the past 15 years in the programmable controller area. The pioneer procts of the late 1960s must have been confusing and frightening to a great number of people. For example, what happened to the hardwired and electromechanical devices that maintenance personnel were used to repairing with hand tools? They were replaced with 『computers』 disguised as electronics designed to replace relays. Even the programming tools were designed to appear as relay equivalent presentations. We have the opportunity now to examine the promise, in retrospect, that the programmable controller brought to manufacturing.
All programmable controllers consist of the basic functional blocks shown in Fig. 10. 1. We』ll examine each block to understand the relationship to the control system. First we look at the center, as it is the heart ( or at least the brain ) of the system. It consists of a microprocessor, logic memory for the storage of the actual control logic, storage or variable memory for use with data that will ordinarily change as a function power for the processor and memory. Next comes the I/O block. This function takes the control level signals for the CPU and converts them to voltage and current levels suitable for connection with factory grade sensors and actuators. The I/O type can range from digital (discrete or on / off), analog (continuously variable), or a variety of special purpose 『smart』 I/O which are dedicated to a certain application task. The programmer is shown here, but it is normally used only to initially configure and program a system and is not required for the system to operate. It is also used in troubleshooting a system, and can prove to be a valuable tool in pinpointing the exact cause of a problem. The field devices shown here represent the various sensors and actuators connected to the I/O. These are the arms, legs, eyes, and ears of the system, including push buttons, limit switches, proximity switches, photosensors, thermocouples, RTDS, position sensing devices, and bar code reader as input; and pilot lights, display devices, motor starters, DC and AC drives, solenoids, and printers as outputs.
No single attempt could cover its rapidly changing scope, but three basic characteristics can be examined to give classify an instrial control device as a programmable controller.
(1) Its basic internal operation is to solve logic from the beginning of memory to some specified point, such as end of memory or end of program. Once the end is reached, the operation begins again at the beginning of memory. This scanning process continues from the time power is supplied to the time it it removed.
(2) The programming logic is a form of a relay ladder diagram. Normally open, normally closed contacts, and relay coils are used within a format utilizing a left and a right vertical rail. Power flow (symbolic positive electron flow) is used to determine which coil or outputs are energized or deenergized.
(3) The machine is designed for the instrial environment from its basic concept; this protection is not added at a later date. The instrial environment includes unreliable AC power, high temperatures (0 to 60 degree Celsius), extremes of humidity, vibrations, RF noise, and other similar parameters.
General application areas
The programmable controller is used in a wide variety of control applications today, many of which were not economically possible just a few years ago. This is true for two general reasons: 1 there cost effectiveness (that is, the cost per I/O point) has improved dramatically with the falling prices of microprocessors and related components, and 2 the ability of the controller to solve complex computation and communication tasks has made it possible to use it where a dedicated computer was previously used.
Applications for programmable controllers can be categorized in a number of different ways, including general and instrial application categories. But it is important to understand the framework in which controllers are presently understood and used so that the full scope of present and future evolution can be examined. It is through the power of applications that controllers can be seen in their full light. Instrial applications include many in both discrete manufacturing and process instries. Automotive instry applications, the genesis of the programmable controller, continue to provide the largest base of opportunity. Other instries, such as food processing and utilities, provide current development opportunities.
There are five general application areas in which programmable controllers are used. A typical installation will use one or more of these integrated to the control system problem. The five general areas are explained briefly below.

Description
The AT89C51 is a low-power, high-performance CMOS 8-bit microcomputer with 4K bytes of Flash programmable and erasable read only memory (PEROM). The device is manufactured using Atmel』s high-density nonvolatile memory technology and is compatible with the instry-standard MCS-51 instruction set and pinout. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89C51 is a powerful microcomputer which provides a highly-flexible and cost-effective solution to many embedded control applications.
Function characteristic
The AT89C51 provides the following standard features: 4K bytes of Flash, 128 bytes of RAM, 32 I/O lines, two 16-bit timer/counters, a five vector two-level interrupt architecture, a full plex serial port, on-chip oscillator and clock circuitry. In addition, the AT89C51 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port and interrupt system to continue functioning. The Power-down Mode saves the RAM contents but freezes the oscillator disabling all other chip functions until the next hardware reset.
Pin Description
VCC:Supply voltage.
GND:Ground.
Port 0:
Port 0 is an 8-bit open-drain bi-directional I/O port. As an output port, each pin can sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as highimpedance inputs.Port 0 may also be configured to be the multiplexed loworder address/data bus ring accesses to external program and data memory. In this mode P0 has internal pullups.Port 0 also receives the code bytes ring Flash programming,and outputs the code bytes ring programverification. External pullups are required ring programverification.

Port 1
Port 1 is an 8-bit bi-directional I/O port with internal pullups.The Port 1 output buffers can sink/source four TTL inputs.When 1s are written to Port 1 pins they are pulled high by the internal pullups and can be used as inputs. As inputs,Port 1 pins that are externally being pulled low will source current (IIL) because of the internal pullups.Port 1 also receives the low-order address bytes ring Flash programming and verification.
Port 2
Port 2 is an 8-bit bi-directional I/O port with internal pullups.The Port 2 output buffers can sink/source four TTL inputs.When 1s are written to Port 2 pins they are pulled high by the internal pullups and can be used as inputs. As inputs,Port 2 pins that are externally being pulled low will source current, because of the internal pullups.Port 2 emits the high-order address byte ring fetches from external program memory and ring accesses to external data memory that use 16-bit addresses. In this application, it uses strong internal pullupswhen emitting 1s. During accesses to external data memory that use 8-bit addresses, Port 2 emits the contents of the P2 Special Function Register.Port 2 also receives the high-order address bits and some control signals ring Flash programming and verification.
Port 3
Port 3 is an 8-bit bi-directional I/O port with internal pullups.The Port 3 output buffers can sink/source four TTL inputs.When 1s are written to Port 3 pins they are pulled high by the internal pullups and can be used as inputs. As inputs,Port 3 pins that are externally being pulled low will source current (IIL) because of the pullups.Port 3 also serves the functions of various special features of the AT89C51 as listed below:

Port 3 also receives some control signals for Flash programming and verification.

RST
Reset input. A high on this pin for two machine cycles while the oscillator is running resets the device.
ALE/PROG
Address Latch Enable output pulse for latching the low byte of the address ring accesses to external memory. This pin is also the program pulse input (PROG) ring Flash programming.In normal operation ALE is emitted at a constant rate of 1/6 the oscillator frequency, and may be used for external timing or clocking purposes. Note, however, that one ALE pulse is skipped ring each access to external Data Memory.
If desired, ALE operation can be disabled by setting bit 0 of SFR location 8EH. With the bit set, ALE is active only ring a MOVX or MOVC instruction. Otherwise, the pin is weakly pulled high. Setting the ALE-disable bit has no effect if the microcontroller is in external execution mode.

PSEN
Program Store Enable is the read strobe to external program memory.When the AT89C51 is executing code from external program memory, PSEN is activated twice each machine cycle, except that two PSEN activations are skipped ring each access to external data memory.
EA/VPP
External Access Enable. EA must be strapped to GND in order to enable the device to fetch code from external program memory locations starting at 0000H up to FFFFH. Note, however, that if lock bit 1 is programmed, EA will be internally latched on reset.EA should be strapped to VCC for internal program executions.This pin also receives the 12-volt programming enable voltage(VPP) ring Flash programming, for parts that require12-volt VPP.

XTAL1
Input to the inverting oscillator amplifier and input to the internal clock operating circuit.
XTAL2
Output from the inverting oscillator amplifier.

Oscillator Characteristics
XTAL1 and XTAL2 are the input and output, respectively,of an inverting amplifier which can be configured for use as an on-chip oscillator, as shown in Figure 1.Either a quartz crystal or ceramic resonator may be used. To drive the device from an external clock source, XTAL2 should be left unconnected while XTAL1 is driven as shown in Figure 2.There are no requirements on the ty cycle of the external clock signal, since the input to the internal clocking circuitry is through a divide-by-two flip-flop, but minimum and maximum voltage high and low time specifications must be observed.

Figure 1. Oscillator Connections Figure 2. External Clock Drive Configuration

Idle Mode
In idle mode, the CPU puts itself to sleep while all the onchip peripherals remain active. The mode is invoked by software. The content of the on-chip RAM and all the special functions registers remain unchanged ring this mode. The idle mode can be terminated by any enabled interrupt or by a hardware reset.It should be noted that when idle is terminated by a hard ware reset, the device normally resumes program execution,from where it left off, up to two machine cycles before the internal reset algorithm takes control. On-chip hardware inhibits access to internal RAM in this event, but access to the port pins is not inhibited. To eliminate the possibility of an unexpected write to a port pin when Idle is terminated by reset, the instruction following the one that invokes Idle should not be one that writes to a port pin or to external memory.

Power-down Mode
In the power-down mode, the oscillator is stopped, and the instruction that invokes power-down is the last instruction executed. The on-chip RAM and Special Function Registers retain their values until the power-down mode is terminated. The only exit from power-down is a hardware reset. Reset redefines the SFRs but does not change the on-chip RAM. The reset should not be activated before VCC is restored to its normal operating level and must be held active long enough to allow the oscillator to restart and stabilize.

Program Memory Lock Bits
On the chip are three lock bits which can be left unprogrammed (U) or can be programmed (P) to obtain the additional features listed in the table below.

When lock bit 1 is programmed, the logic level at the EA pin is sampled and latched ring reset. If the device is powered up without a reset, the latch initializes to a random value, and holds that value until reset is activated. It is necessary that the latched value of EA be in agreement with the current logic level at that pin in order for the device to function properly.

⑷ 關於單片機的文章

單片機即單片微型計算機(Single-Chip Microcomputer),又稱單片機(Microcontroller),是把中央處理器、存儲器、定時/計數器(Timer/Counter)、各種輸入輸出介面等都集成在一塊集成電路晶元上的微型計算機。與應用在個人電腦中的通用型微處理器相比,它更強調自供應(不用外接硬體)和節約成本。它的最大優點是體積小,可放在儀表內部,但存儲量小,輸入輸出介面簡單,功能較低。由於其發展非常迅速,舊的單片機的定義已不能滿足,所以在很多應用場合被稱為范圍更廣的微控制器;由於單晶元微計算機常用於當控制器故又名single chip microcontroller,但是目前在中國大陸仍多沿用「單片機」的稱呼。概述絕大多數現在的單片機都是基於馮·諾伊曼結構的,這種結構清楚地定義了嵌入式系統所必需的四個基本部分:一個中央處理器內核,程序存儲器(只讀存儲器或者快閃記憶體)、數據存儲器(隨機存儲器),一個或者更多的定時/計時器,還有用來與外圍設備以及擴展資源進行通信的輸入/輸出埠——所有這些都被集成在單個集成電路晶元上。說單片機與通用型中央處理單元晶元不同是因為前者一般很容易配合最小型的外部支持晶元製成工作計算機。這樣就可以很容易的把單片機系統植入裝置內部來控制裝置了。近年來為了在指令和數據上使用不同的字寬,並提高處理器流水線速度,哈佛結構在單片機(Microcontrollers)和DSP也逐漸得到了廣泛的應用。傳統的微處理器是不允許這么做的。它要完成單片機的工作,就必須連接一些其他晶元。比如說,因為片上沒有數據存儲器,就必須要添加一些RAM的存儲晶元,雖然所添加存儲器的容量很靈活,但是至少還是要添加,另外還需要添加很多連線來傳遞晶元之間的數據。比如,一個典型的單片機只需要一個時鍾發生器和很少的RAM和ROM(或者EPROM, E2PROM)就可以在軟體和晶振下工作了。同時,單片機具有豐富的輸入輸出設備,像是模擬數字轉換(ADC),定時器,串口或者其他串列通訊介面(比如I2C,串列外圍介面(SPI),控制器區域網)。通常,這些集成在內部的設備可以通過特殊的指令來操作。
單片機時鍾頻率通常較同時代的計算機晶元低,但它價格低廉。提供充足的程序存儲器、豐富的片上介面。某些架構的單片機生產廠商眾多,,例如8051系列、Z80系列。一些現代的單片機支持一些內建的高級編程語言,比如BASIC語言。單片機的位數 根據匯流排的寬度,單片機又分為4位、8位、16位和32位單片機。4位單片機多用於冰箱、洗衣機、微波爐等家電控制中;8位、16位單片機主要用於一般的控制領域,一般不使用操作系統;32位用於網路操作、多媒體處理等復雜處理的場合,一般要使用嵌入式操作系統。常見的單片機 微芯公司的PIC系列出貨量居於業界領導者地位;Atmel的51系列及AVR系列種類眾多,受支持面廣; 德州儀器的MSP430系列以低功耗聞名,常用於醫療電子產品及儀器儀表中;瑞薩單片機在日本使用廣泛。ARM系列單片機Atmel(愛特梅爾公司) Atmel AT91 series (ARM THUMB architecture)AT90 series – AVR (Atmel Norway design)Atmel AT89 series (Intel 8051/MCS51 architecture)MARC4Cypress MicroSystems(賽普拉斯微系統公司) CY8C2xxxx (PSoC)Freescale Semiconctor(飛思卡爾半導體)8-bit 68HC05 (CPU05)68HC08 (CPU08)68HC11 (CPU11)16-bit 68HC12 (CPU12)68HC16 (CPU16)Freescale DSP56800 (DSPcontroller)32-bit Freescale 683XX (CPU32)MPC500MPC 860 (PowerQUICC)MPC 8240/8250 (PowerQUICC II)MPC 8540/8555/8560 (PowerQUICC III)Holtek(盛群半導體) HT48FXX Flash I/O typeHT48RXX I/O typeHT46RXX A/D typeHT49RXX LCD typeIntel(英特爾) 8-bit 8XC42MCS48MCS51 : [Intel 8051]系列歷史悠久,兼容產品眾多,使用廣泛8xC25116-bit MCS96系列MXS29632-bit i960Microchip(微芯公司)的PIC單片機系列 8-bit : PIC10 PIC12 PIC16 PIC1816-bit : PIC24F PIC24H dsPIC30 dsPIC3332bit : PIC32 (採用MIPS M4K 內核架構)National Semiconctor(美國國家半導體) COP8CR16NEC 78KNXP Semiconctors(恩智浦半導體,由飛利浦以 Philips Semiconctors 為班底新成立) LPC2000LPC900LPC700Parallax, Inc. BASIC StampRenesas瑞薩科技系列單片機 Renesas 16-bits Renesas M16C SeriesRenesas M32C SeriesRenesas R8C SeriesRenesas M16C/Tiny SeriesRenesas R8C/Tiny SeriesRenesas H8/Tiny SeriesSTMicroelectronics(意法半導體)SyncMOS新茂國際科技全系列單片機 SM59RXXA2 8-bits 1T(RISC)SM59DXXG2 8-bits 6T(ISP)SM59XX 8-bits 12T(ISP)SM89XX 8-bits 12T(Traditional 8051)SM79XX 8-bits 12T(Customization)ZiLOG Z8Z86E02其他系列的單片機 AVR系列單片機Msp430系列單片機8098、80196系列單片機AT8P5X系列單片機CZG8000系列單片機SyncMOS系列單片機STC系列單片機單片機的開發 單片機的軟體開發中一般使用匯編或C語言,又或者使用BASIC等更適合初學者的語言,部分集成開發環境支持C++。單片機的軟體調試需要使用單片機開發器或模擬器。隨著技術的發展,現在已經有很多單片機自帶了ISP(在線編程設計),徹底地改變了傳統的開發模式,開發單片機系統時不會損壞晶元的引腳,加速了產品的上市並降低了研發成本,縮短了從設計、製造到現場調試的時間,簡化了生產流程,大大提高了工作效率,這類單片機包括AT89S系列單片機,AVR系列單片機等。KEIL C PROTEUS Proteus軟體是初學者入門的首選軟體,它是Labcenter Electronics公司的一款商業版電路設計與模擬軟體,它包括ISIS、ARES等軟體模塊,ARES模塊主要用來完成PCB的設計,ISIS模塊用來完成電路原理圖的布圖與模擬。Proteus的軟體模擬基於VSM技術,它與其他軟體最大的不同也是最大的優勢就在於它能模擬大量的單片機晶元,比如MCS-51系列、PIC系列等等,甚至ARM處理器,以及單片機外圍電路,比如鍵盤、LED、LCD等等,該軟體附帶了一些案例和豐富的幫助文件。

⑸ 單片機 數字信號處理 dsp

好好學習 天天向上!

⑹ 關於單片機中的宏定義如何定義多條語句。

這個用法使用到了結構體,一定要在結構體後面才能使用,不然就會出錯

⑺ 在codevision中iom16v.h是什麼

Atmega16單片機的包含頭文件,在網路里有該款單片機的介紹!
如果你添加該包含文件結果沒有該文件,可能是你的頭文件庫里沒有該頭文件。

iom16v.h的主要內容是:
#ifndef __iom16v_h
#define __iom16v_h

#define uchar unsigned char
#define uint unsigned int

#ifndef BIT
#define BIT(x) (1 << (x))
#endif

/* ATmega16 header file for
* ImageCraft ICCAVR compiler
*/

/* 2 wire serial interface */
#define TWBR (*(volatile unsigned char *)0x20)
#define TWSR (*(volatile unsigned char *)0x21)
#define TWPS1 1
#define TWPS0 0
#define TWCR (*(volatile unsigned char *)0x56)
#define TWINT 7
#define TWEA 6
#define TWSTA 5
#define TWSTO 4
#define TWWC 3
#define TWEN 2
#define TWIE 0
#define TWAR (*(volatile unsigned char *)0x22)
#define TWGCE 0
#define TWDR (*(volatile unsigned char *)0x23)

/* ADC */
#define ADC (*(volatile unsigned int *)0x24)
#define ADCL (*(volatile unsigned char *)0x24)
#define ADCH (*(volatile unsigned char *)0x25)
#define ADCSR (*(volatile unsigned char *)0x26)
#define ADCSRA (*(volatile unsigned char *)0x26)
#define ADEN 7
#define ADSC 6
#define ADATE 5
#define ADFR 5 /*This definition was in old datasheet*/
#define ADIF 4
#define ADIE 3
#define ADPS2 2
#define ADPS1 1
#define ADPS0 0
#define ADMUX (*(volatile unsigned char *)0x27)
#define REFS1 7
#define REFS0 6
#define ADLAR 5
#define MUX4 4
#define MUX3 3
#define MUX2 2
#define MUX1 1
#define MUX0 0

/* Analog Comparator */
#define ACSR (*(volatile unsigned char *)0x28)
#define ACD 7
#define ACBG 6
#define ACO 5
#define ACI 4
#define ACIE 3
#define ACIC 2
#define ACIS1 1
#define ACIS0 0

/* USART */
#define UBRRHI (*(volatile unsigned char *)0x40)
#define UBRRH (*(volatile unsigned char *)0x40)
#define URSEL 7
#define UBRR (*(volatile unsigned char *)0x29)
#define UBRRL (*(volatile unsigned char *)0x29)
#define UCSRC (*(volatile unsigned char *)0x40)
#define URSEL 7
#define UMSEL 6
#define UPM1 5
#define UPM0 4
#define USBS 3
#define UCSZ1 2
#define UCSZ0 1
#define UCPOL 0
#define UCSRB (*(volatile unsigned char *)0x2A)
#define RXCIE 7
#define TXCIE 6
#define UDRIE 5
#define RXEN 4
#define TXEN 3
#define UCSZ2 2
#define RXB8 1
#define TXB8 0
#define UCSRA (*(volatile unsigned char *)0x2B)
#define RXC 7
#define TXC 6
#define UDRE 5
#define FE 4
#define DOR 3
#define OVR 3 /*This definition differs from the databook*/
#define PE 2
#define U2X 1
#define MPCM 0
#define UDR (*(volatile unsigned char *)0x2C)

/* SPI */
#define SPCR (*(volatile unsigned char *)0x2D)
#define SPIE 7
#define SPE 6
#define DORD 5
#define MSTR 4
#define CPOL 3
#define CPHA 2
#define SPR1 1
#define SPR0 0
#define SPSR (*(volatile unsigned char *)0x2E)
#define SPIF 7
#define WCOL 6
#define SPI2X 0
#define SPDR (*(volatile unsigned char *)0x2F)

/* Port D */
#define PIND (*(volatile unsigned char *)0x30)
#define DDRD (*(volatile unsigned char *)0x31)
#define PORTD (*(volatile unsigned char *)0x32)

/* Port C */
#define PINC (*(volatile unsigned char *)0x33)
#define DDRC (*(volatile unsigned char *)0x34)
#define PORTC (*(volatile unsigned char *)0x35)

/* Port B */
#define PINB (*(volatile unsigned char *)0x36)
#define DDRB (*(volatile unsigned char *)0x37)
#define PORTB (*(volatile unsigned char *)0x38)

/* Port A */
#define PINA (*(volatile unsigned char *)0x39)
#define DDRA (*(volatile unsigned char *)0x3A)
#define PORTA (*(volatile unsigned char *)0x3B)

/* EEPROM */
#define EECR (*(volatile unsigned char *)0x3C)
#define EERIE 3
#define EEMWE 2
#define EEWE 1
#define EERE 0
#define EEDR (*(volatile unsigned char *)0x3D)
#define EEAR (*(volatile unsigned int *)0x3E)
#define EEARL (*(volatile unsigned char *)0x3E)
#define EEARH (*(volatile unsigned char *)0x3F)

/* Watchdog Timer Control Register */
#define WDTCR (*(volatile unsigned char *)0x41)
#define WDTOE 4
#define WDE 3
#define WDP2 2
#define WDP1 1
#define WDP0 0

/* Timer/Counter 2 */
#define ASSR (*(volatile unsigned char *)0x42)
#define AS2 3
#define TCN2UB 2
#define OCR2UB 1
#define TCR2UB 0
#define OCR2 (*(volatile unsigned char *)0x43)
#define TCNT2 (*(volatile unsigned char *)0x44)
#define TCCR2 (*(volatile unsigned char *)0x45)
#define FOC2 7
#define WGM20 6
#define COM21 5
#define COM20 4
#define WGM21 3
#define CS22 2
#define CS21 1
#define CS20 0

/* Timer/Counter 1 */
#define ICR1 (*(volatile unsigned int *)0x46)
#define ICR1L (*(volatile unsigned char *)0x46)
#define ICR1H (*(volatile unsigned char *)0x47)
#define OCR1B (*(volatile unsigned int *)0x48)
#define OCR1BL (*(volatile unsigned char *)0x48)
#define OCR1BH (*(volatile unsigned char *)0x49)
#define OCR1A (*(volatile unsigned int *)0x4A)
#define OCR1AL (*(volatile unsigned char *)0x4A)
#define OCR1AH (*(volatile unsigned char *)0x4B)
#define TCNT1 (*(volatile unsigned int *)0x4C)
#define TCNT1L (*(volatile unsigned char *)0x4C)
#define TCNT1H (*(volatile unsigned char *)0x4D)
#define TCCR1B (*(volatile unsigned char *)0x4E)
#define ICNC1 7
#define ICES1 6
#define WGM13 4
#define WGM12 3
#define CS12 2
#define CS11 1
#define CS10 0
#define TCCR1A (*(volatile unsigned char *)0x4F)
#define COM1A1 7
#define COM1A0 6
#define COM1B1 5
#define COM1B0 4
#define FOC1A 3
#define FOC1B 2
#define WGM11 1
#define WGM10 0

/* Special Function I/O register */
#define SFIOR (*(volatile unsigned char *)0x50)
#define ADTS2 7
#define ADTS1 6
#define ADTS0 5
#define ADHSM 4
#define ACME 3
#define PUD 2
#define PSR2 1
#define PSR10 0

/* Oscillator Calibration */
#define OSCCAL (*(volatile unsigned char *)0x51)
/* On-Chip Debug register */
#define OCDR (*(volatile unsigned char *)0x51)

/* Timer/Counter 0 */
#define OCR0 (*(volatile unsigned char *)0x5C)
#define TCNT0 (*(volatile unsigned char *)0x52)
#define TCCR0 (*(volatile unsigned char *)0x53)
#define FOC0 7
#define WGM00 6
#define COM01 5
#define COM00 4
#define WGM01 3
#define CS02 2
#define CS01 1
#define CS00 0

/* MCU general */
#define MCUCSR (*(volatile unsigned char *)0x54)
#define MCUSR (*(volatile unsigned char *)0x54)
#define JTD 7
#define ISC2 6
#define JTRF 4
#define WDRF 3
#define BORF 2
#define EXTRF 1
#define PORF 0
#define MCUCR (*(volatile unsigned char *)0x55)
#define SM2 7
#define SE 6
#define SM1 5
#define SM0 4
#define ISC11 3
#define ISC10 2
#define ISC01 1
#define ISC00 0

/* SPM Conrol Register */
#define SPMCR (*(volatile unsigned char *)0x57)
#define SPMIE 7
#define RWWSB 6
#define RWWSRE 4
#define BLBSET 3
#define PGWRT 2
#define PGERS 1
#define SPMEN 0

/* Timer/Counter Interrupts */
#define TIFR (*(volatile unsigned char *)0x58)
#define OCF2 7
#define TOV2 6
#define ICF1 5
#define OCF1A 4
#define OCF1B 3
#define TOV1 2
#define OCF0 1
#define TOV0 0
#define TIMSK (*(volatile unsigned char *)0x59)
#define OCIE2 7
#define TOIE2 6
#define TICIE1 5
#define OCIE1A 4
#define OCIE1B 3
#define TOIE1 2
#define OCIE0 1
#define TOIE0 0

/* General Interrupts */
#define GIFR (*(volatile unsigned char *)0x5A)
#define INTF1 7
#define INTF0 6
#define INTF2 5
#define GICR (*(volatile unsigned char *)0x5B)
#define INT1 7
#define INT0 6
#define INT2 5
#define IVSEL 1
#define IVCE 0

/* Stack Pointer */
#define SP (*(volatile unsigned int *)0x5D)
#define SPL (*(volatile unsigned char *)0x5D)
#define SPH (*(volatile unsigned char *)0x5E)

/* Status REGister */
#define SREG (*(volatile unsigned char *)0x5F)

/* Port A bits */
#define PORTA7 7
#define PORTA6 6
#define PORTA5 5
#define PORTA4 4
#define PORTA3 3
#define PORTA2 2
#define PORTA1 1
#define PORTA0 0

#define DDA7 7
#define DDA6 6
#define DDA5 5
#define DDA4 4
#define DDA3 3
#define DDA2 2
#define DDA1 1
#define DDA0 0

#define PINA7 7
#define PINA6 6
#define PINA5 5
#define PINA4 4
#define PINA3 3
#define PINA2 2
#define PINA1 1
#define PINA0 0

/* Port B bits */
#define PORTB7 7
#define PORTB6 6
#define PORTB5 5
#define PORTB4 4
#define PORTB3 3
#define PORTB2 2
#define PORTB1 1
#define PORTB0 0

#define DDB7 7
#define DDB6 6
#define DDB5 5
#define DDB4 4
#define DDB3 3
#define DDB2 2
#define DDB1 1
#define DDB0 0

#define PINB7 7
#define PINB6 6
#define PINB5 5
#define PINB4 4
#define PINB3 3
#define PINB2 2
#define PINB1 1
#define PINB0 0

/* Port C bits */
#define PORTC7 7
#define PORTC6 6
#define PORTC5 5
#define PORTC4 4
#define PORTC3 3
#define PORTC2 2
#define PORTC1 1
#define PORTC0 0

#define DDC7 7
#define DDC6 6
#define DDC5 5
#define DDC4 4
#define DDC3 3
#define DDC2 2
#define DDC1 1
#define DDC0 0

#define PINC7 7
#define PINC6 6
#define PINC5 5
#define PINC4 4
#define PINC3 3
#define PINC2 2
#define PINC1 1
#define PINC0 0

/* Port D bits */
#define PORTD7 7
#define PORTD6 6
#define PORTD5 5
#define PORTD4 4
#define PORTD3 3
#define PORTD2 2
#define PORTD1 1
#define PORTD0 0

#define DDD7 7
#define DDD6 6
#define DDD5 5
#define DDD4 4
#define DDD3 3
#define DDD2 2
#define DDD1 1
#define DDD0 0

#define PIND7 7
#define PIND6 6
#define PIND5 5
#define PIND4 4
#define PIND3 3
#define PIND2 2
#define PIND1 1
#define PIND0 0

/* Lock and Fuse Bits with LPM/SPM instructions */

/* lock bits */
#define BLB12 5
#define BLB11 4
#define BLB02 3
#define BLB01 2
#define LB2 1
#define LB1 0

/* fuses low bits */
#define BODLEVEL 7
#define BODEN 6
#define SUT1 5
#define SUT0 4
#define CKSEL3 3
#define CKSEL2 2
#define CKSEL1 1
#define CKSEL0 0

/* fuses high bits */
#define OCDEN 7
#define JTAGEN 6
#define SPIEN 5
#define CKOPT 4
#define EESAVE 3
#define BOOTSZ1 2
#define BOOTSZ0 1
#define BOOTRST 0

/* Interrupt Vector Numbers */

#define iv_RESET 1
#define iv_INT0 2
#define iv_EXT_INT0 2
#define iv_INT1 3
#define iv_EXT_INT1 3
#define iv_TIMER2_COMPA 4
#define iv_TIMER2_COMP 4
#define iv_TIM2_COMP 4
#define iv_TIMER2_OVF 5
#define iv_TIM2_OVF 5
#define iv_TIMER1_CAPT 6
#define iv_TIM1_CAPT 6
#define iv_TIMER1_COMPA 7
#define iv_TIM1_COMPA 7
#define iv_TIMER1_COMPB 8
#define iv_TIM1_COMPB 8
#define iv_TIMER1_OVF 9
#define iv_TIM1_OVF 9
#define iv_TIMER0_OVF 10
#define iv_TIM0_OVF 10
#define iv_SPI_STC 11
#define iv_USART_RX 12
#define iv_USART_RXC 12
#define iv_USART0_RX 12
#define iv_USART0_RXC 12
#define iv_USART_DRE 13
#define iv_USART_UDRE 13
#define iv_USART0_DRE 13
#define iv_USART0_UDRE 13
#define iv_USART_TX 14
#define iv_USART_TXC 14
#define iv_USART0_TX 14
#define iv_USART0_TXC 14
#define iv_ADC 15
#define iv_EE_RDY 16
#define iv_EE_READY 16
#define iv_ANA_COMP 17
#define iv_ANALOG_COMP 17
#define iv_TWI 18
#define iv_TWSI 18
#define iv_INT2 19
#define iv_EXT_INT2 19
#define iv_TIMER0_COMPA 20
#define iv_TIMER0_COMP 20
#define iv_TIM0_COMP 20
#define iv_SPM_RDY 21
#define iv_SPM_READY 21

#endif

⑻ 單片機英文資料

非常好的辦法:在網上下載某一種單片機的中文手冊,再下載它的英文手冊就很容易了,兩者一對比,不就出來了嗎

閱讀全文

與單片機中lockbits知識相關的資料

熱點內容
安卓設計怎麼加入輸入框 瀏覽:184
主根伺服器什麼時候開始 瀏覽:738
奇門遁甲完整版pdf 瀏覽:900
app軟體怎麼用的 瀏覽:802
電子書pdf購買 瀏覽:193
浪潮伺服器如何做系統 瀏覽:111
冒險島img格式加密 瀏覽:596
我的世界手游如何復制命令 瀏覽:659
天刀自動彈琴腳本源碼 瀏覽:969
打開其它app微信怎麼收不到 瀏覽:447
安卓游戲耳機怎麼戴 瀏覽:18
不越獄怎麼去除app廣告 瀏覽:178
ipadminipdf閱讀 瀏覽:506
文件夾無限制壓縮會不會降低內存 瀏覽:412
榮耀怎樣創建文件夾 瀏覽:631
如何用本機登陸遠程伺服器地址 瀏覽:682
黃小鴨解壓文具盒 瀏覽:672
女程序員的轉行方法 瀏覽:884
東風啟辰車聯網安裝文件夾 瀏覽:526
華為怎麼設置app時間鎖 瀏覽:663