ATMega328P Microcontroller
atmega328Pis high performance, low power controller from Microchip. ATMEGA328P is an 8-bit microcontroller based on AVR RISC architecture. It is the most popular of all AVR controllers as it is used in ARDUINO boards.
ATMega328 Pinout Configuration
Atmega328p是28针芯片,如上图所示。这里的许多芯片都有多个功能。我们将在表中描述每个PIN的功能。
Pin No. |
Pin name |
描述 |
Secondary Function |
1 |
PC6(重置) |
Pin6 of PORTC |
Pin by default is used as RESET pin. PC6 can only be used as I/O pin when RSTDISBL Fuse is programmed. |
2 |
PD0(RXD) |
PORTD的引脚 |
RXD (Data Input Pin for USART) USART串行通信界面 [可用于编程] |
3 |
PD1 (TXD) |
PORTD的PIN1 |
TXD (Data Output Pin for USART) USART串行通信界面 [可用于编程] INT2( External Interrupt 2 Input) |
4 |
PD2 (INT0) |
Pin2 of PORTD |
外部中断源0 |
5 |
PD3 (INT1/OC2B) |
PORTD的PIN3 |
External Interrupt source1 OC2B(PWM-计时器/反2输出比较匹配B输出) |
6 |
PD4(XCK/T0) |
Pin4 of PORTD |
T0(Timer0外部计数器输入) XCK(USART外部时钟I/O) |
7 |
VCC |
连接到正电压 |
|
8 |
GND |
Connected to ground |
|
9 |
PB6(XTAL1/TOSC1) |
Pin6 of PORTB |
XTAL1 (Chip Clock Oscillator pin 1 or External clock input) TOSC1(计时器振荡器引脚1) |
10 |
PB7 (XTAL2/TOSC2) |
PORTB的PIN7 |
XTAL2 (Chip Clock Oscillator pin 2) TOSC2 (Timer Oscillator pin 2) |
11 |
PD5 (T1/OC0B) |
PORTD的PIN5 |
T1(Timer1 External Counter Input) OC0B(PWM - Timer/Counter0 Output Compare Match B Output) |
12 |
PD6 (AIN0/OC0A) |
Pin6 of PORTD |
AIN0(Analog Comparator Positive I/P) OC0A(PWM - Timer/Counter0 Output Compare Match A Output) |
13 |
PD7(AIN1) |
PORTD的PIN7 |
AIN1(Analog Comparator Negative I/P) |
14 |
PB0 (ICP1/CLKO) |
PORTB的引脚 |
ICP1(计时器/计数器1输入捕获引脚) CLKO (Divided System Clock. The divided system clock can be output on the PB0 pin) |
15 |
PB1(OC1A) |
PORTB的PIN1 |
OC1A (Timer/Counter1 Output Compare Match A Output) |
16 |
PB2(SS/OC1B) |
Pin2 of PORTB |
SS(SPI从选择输入)。当控制器充当奴隶时,该引脚很低。 [用于编程的串行外围界面(SPI)] OC1B (Timer/Counter1 Output Compare Match B Output) |
17 |
PB3 (MOSI/OC2A) |
PORTB的PIN3 |
MOSI (Master Output Slave Input). When controller acts as slave, the data is received by this pin. [Serial Peripheral Interface (SPI) for programming] OC2 (Timer/Counter2 Output Compare Match Output) |
18 |
PB4(味o) |
Pin4 of PORTB |
MISO(主输入从输出)。当控制器充当从属时,数据将通过此PIN通过此控制器发送给MASTER。 [用于编程的串行外围界面(SPI)] |
19 |
PB5(SCK) |
PORTB的PIN5 |
SCK(SPI总线串行时钟)。这是该控制器和其他系统之间共享的时钟,以进行准确的数据传输。 [用于编程的串行外围界面(SPI)] |
20 |
AVCC |
内部ADC转换器的功率 |
|
21 |
AREF |
Analog Reference Pin for ADC |
|
22 |
GND |
GROUND |
|
23 |
PC0 (ADC0) |
PORTC的引脚 |
ADC0(ADC输入通道0) |
24 |
PC1 (ADC1) |
PORTC的PIN1 |
ADC1(ADC输入通道1) |
25 |
PC2(ADC2) |
Pin2 of PORTC |
ADC2(ADC输入通道2) |
26 |
PC3 (ADC3) |
PORTC的PIN3 |
ADC3(ADC输入通道3) |
27 |
PC4 (ADC4/SDA) |
Pin4 of PORTC |
ADC4 (ADC Input Channel 4) SDA(两线串行总线数据输入/输出线) |
28 |
PC5 (ADC5/SCL) |
PORTC的PIN5 |
ADC5(ADC输入通道5) SCL (Two-wire Serial Bus Clock Line) |
Features
ATMEGA328P - 简化功能 |
|
中央处理器 |
8位AVR |
引脚数 |
28 |
操作电压(V) |
+1.8 V至 +5.5V |
Number of programmable I/O lines |
23 |
Communication Interface |
Master/Slave SPI串行界面(17,18,19引脚)[可用于编程此控制器] 可编程串行USART(2,3针)[可用于编程此控制器] Two-wire Serial Interface(27,28 PINS)[Can be used to connect peripheral devices like Servos, sensors and memory devices] |
JTAG Interface |
Not available |
ADC模块 |
6channels, 10-bit resolution ADC |
计时器模块 |
Two 8-bit counters with Separate Prescaler and compare mode, One 16-bit counter with Separate Prescaler,compare mode and capture mode. |
Analog Comparators |
1(12,13 PINS) |
DAC模块 |
Nil |
PWM channels |
6 |
外部振荡器 |
0-4MHz @ 1.8V to 5.5V 0-10MHz @ 2.7V to 5.5V 0-20MHz @ 4.5V to 5.5V |
内部振荡器 |
8MHz Calibrated Internal Oscillator |
程序内存类型 |
闪光 |
程序内存或闪存 |
32Kbytes[10000 write/erase cycles] |
CPU速度 |
1MIPS 1MHz |
RAM |
2Kbytes Internal SRAM |
EEPROM |
1Kbytes EEPROM |
看门狗计时器 |
箴grammable Watchdog Timer with Separate On-chipOscillator |
程序锁 |
Yes |
Power Save Modes |
Six Modes[Idle, ADC Noise Reduction, Power-save, Power-down, Standby and Extended Standby] |
工作温度 |
-40°C至 +105°C(+105绝对最大,-40是绝对最小值) |
Note:Complete technical details can be found in theatmega328P Datasheetlinked at the bottom of this page.
atmega328P Replacements
Atmega328p替代品
在哪里使用atmega328p
尽管我们有许多控制器Atmega328p,因为它的功能和成本是最受欢迎的。由于其功能,因此在该控制器上也开发了Arduino板。
- With program memory of 32 Kbytes ATMEGA328P applications are many.
- With various POWER SAVING modes it can work on MOBILE EMBEDDED SYSTEMS.
- With Watchdog timer to reset under error it can be used on systems with minimal human interference.
- 使用高级RISC架构,控制器可以快速执行程序。
- Also with in chip temperature sensor the controller can be used at extreme temperatures.
These all features add together promoting ATMEGA328P further.
How to Use ATMEGA328P
ATMEGA328与任何其他控制器类似。那里要做的就是编程。控制器只需在任何瞬间执行我们提供的程序即可。没有编程控制器,简单地将其放置而无需做任何事情。
As said, first we need to program the controller and that is done by writing the appropriate program file in the ATMEGA328P FLASH memory. After dumping this program code, the controller executes this code and provides appropriate response.
Entire process ofusing an ATMEGA328Pgoes like this:
- 列出要由控制器执行的功能。
- 在IDE程序中编写编程语言的功能。
您可以在公司网站中免费下载IDE程序。AVR控制器的IDE程序是“ Atmel Studio”。Atmel Studio的链接如下。
(Usually Atmel Studio 6.0 for Windows7 [http://atmel-studio.software.informer.com/6.0/],,
Windows10的Atmel Studio 7 [https://www.microchip.com/avr-support/atmel-studio-7)))
- ATMEGA328P编程也可以在Arduino IDE中完成。
- After writing the program, compile it to eliminate errors.
- Make the IDE generate HEX file for the written program after compiling.
- This HEX file contains the machine code which should be written in controller flash memory.
- 选择编程设备(通常是为AVR控制器制作的SPI程序员),该设备在PC和ATMEGA328P之间建立通信。您还可以使用Arduino Uno板对Atmega328p进行编程。
- 运行程序员软件并选择适当的十六进制文件。
- Burn the HEX file of written program in ATMEGA328P flash memory using this program.
- 断开程序员的连接,将适当的外围设备连接到控制器并启动系统。
如何使用Arduino使用Atmega328p
自从ATmega328P被使用Arduino Uno和Arduino nanoboards, you can directly replace the arduino board with ATmega328 chip. For that first you need to install theArduino引导加载程序into the chip (Or you can also buy a chip with bootloader – ATMega328P-PU). This IC with bootloader can be placed on Arduino Uno board and burn the program into it. Once Arduino program is burnt into the IC, it can be removed and used in place of Arduino board, along with a Crystal oscillator and other components as required for the project. Below is thepin mapping between Arduino Uno and ATmega328P chip.
Applications
There are hundreds of applications for ATMEGA328P:
- 用于Arduino Uno,Arduino Nano和Arduino Micro Boards。
- 工业控制系统。
- SMP和电源调节系统。
- 数字数据处理。
- 模拟信号测量和操作。
- 嵌入式系统,例如咖啡机,自动售货机。
- Motor control systems.
- 显示单元。
- 外围接口系统。
2D Model and Dimensions
所有测量均以毫米为单位。