导航:首页 > 操作系统 > 单片机中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知识相关的资料

热点内容
荣耀怎样创建文件夹 浏览:625
如何用本机登陆远程服务器地址 浏览:680
黄小鸭解压文具盒 浏览:670
女程序员的转行方法 浏览:881
东风启辰车联网安装文件夹 浏览:524
华为怎么设置app时间锁 浏览:660
后宫app视频怎么下载 浏览:525
如何把图片转换从PDF格式 浏览:259
重写和重载的区别java 浏览:233
expressvpnandroid 浏览:84
储存卡被加密怎么解除 浏览:169
地球怎么压缩直径 浏览:780
金铲铲之战服务器爆满怎么进 浏览:160
同仁堂pdf 浏览:935
如何编译原理课程教材 浏览:730
单片机控制显示器 浏览:776
顶好花app下载怎么找不到 浏览:989
手机命令大全 浏览:808
怎么下邮政银行app 浏览:250
不背单词app单词怎么学习 浏览:481