BASEAVRATmega 128 Manual
BASEAVRATmega 128 Manual
BASEAVRATmega 128 Manual
Specifications
• Use MCU AVR family No.ATmega64, ATmega128 from
ATMEL 8BIT to be permanent MCU on board, and
XTAL 16 MHz. Moreover, this MCU has other
interesting specifications as following;
- Flash Memory 64 K Bytes for ATmega64 and 128
K Bytes for ATmega128, and RAM 4 K Bytes
- EEPROM 2K Bytes for ATmega64 and 4 K Bytes
for ATmega128, in this case, we can erase
and re-write data more than 100,000 times.
- Maximum 53 I/O Pins
- Circuit SPI Communication 1 Channel, I2C 1
Channel, Programmable Serial USARTs 2
Channel
- ADC 10-Bit 8 channel
- Timers/Counter 8-Bit 2 Channel,
Timers/Counter 16-Bit 2 Channel, 8-Bit PWM 2
Channel, Watchdog Timer, Real Time Counter
• 6 I/O Port 10PIN; PA,PB,PC,PD,PE, and PF
• Port ISP LOAD for program MCU (must use with ET-
AVR ISP or ISP Programmer that has the same type
of Pin arrangement).
• Line Driver for RS232 Serial Port Communication
2 Channel; one Port for interfacing with Signal
PE0(RXD0) and PE1(TXD0) and other one Port for
interfacing with Signal PD2(RXD1) and PD3(TXD1),
in this case, we can test connection of circuit
RS232 Serial Port Communication easier.
• Circuit for connecting with Character LCD
Display Monitor (ET-CLCD) and VR for contrasting
brightness of LCD, in this case, it is
Structure of Board
Connectors
Port PA 8 Bit
Port PB 8 Bit
Port PC 8 Bit
Port PD 8 Bit
Port PE 8 Bit
Port PF 8 Bit
1 2 3 4 5 6 7 8 9 10 11 12 13 14
GND +VCC VO RS RW EN D0 D1 D2 D3 D4 D5 D6 D7
NOTE:
- Default value = 1. It means that not program Fuse Bit
and not tick any mark [√] in front of Fuse Bit’ name.
- Default value = 0. It means that command to program
fuse Bit and must tick mark [√] in front of Fuse
Bit’s name.
- Should program Fuse Bit of CKOPT to run with
frequency range 1.0MHz-16.0MHz.
- Do not command to program Fuse Bit of CKSEL[3..0]
because the operation will be error. For example, if
we program all Fuse Bit of CKSEL[3..0] to be “0”,
after program PonyProg200 has already written default
value of Fuse Bit into CPU completely, we can not use
CPU with ETT Board and can not program through Serial
Programming Type. If we program all Fuse Bit of
CKSEL[3..0] to be “0”, it configures CPU to run with
External Clock, so External Crystal stops running and
CPU wait for receiving External Clock only but ETT
Board use only External crystal. So, we must modify
Fuse Bit of CPU by using Parallel first, and then we
can use CPU as usual.
- Fuse Bit’s Position of Lock[2..1] cab be configured
as required.
;*******************************************************
;* Examples Program For "ET-AVR STAMP ATmega64" Board *
;* Target MCU : Atmel ATmega16 *
;* Frequency : X-TAL : 16 MHz *
;* Compiler : AVR Studio 4.12 (AVR Assembler 2) *
;* Create By : ADISAK CHOOCHAN (WWW.ETT.CO.TH) *
;* Last Update : 1/September/2005 *
;* Description : Example LED Blink on Portb.0 *
;*******************************************************
.include "m64def.inc"
;************************
; Define Register
;************************
.def COUNTER1 = R16
.def COUNTER2 = R17
.def COUNTER3 = R18
.def TEMP = R19
;***********************
; Define I/O Port,Pin
;***********************
.equ LED = 0
;*******************
; Main Program
;*******************
.CSEG
.ORG 0
RJMP RESET ;Reset Handle
;/******************
; Delay time
;/******************
DELAY_1ms: LDI COUNTER1,16
DELAY_1ms_1: LDI COUNTER2,250
DELAY_1ms_2: NOP
DEC COUNTER2
BRNE DELAY_1ms_2
DEC COUNTER1
BRNE DELAY_1ms_1
RET
DEC COUNTER3
BRNE DELAY_200ms_1
RET
'*******************************************************
'* Examples Program For "ET-AVR STAMP ATmega64" Board *
'* Target MCU : Atmel ATmega16 *
'* Frequency : X-TAL : 16 MHz *
'* Compiler : BASCOM-AVR 1.11.7.9 *
'* Create By : ADISAK CHOOCHAN (WWW.ETT.CO.TH) *
'* Last Update : 1/September/2005 *
'* Description : Example LED Blink on Portb.0 *
'*******************************************************
$regfile="m64def.dat" 'ATmega16
$crystal=16000000 'X-TAL = 16 MHz
Do
Portb.0 = Not Portb.0 'Convert Portb.0
Waitms 200 'Wait 200 ms
Loop
End
//**********************************************/;
//*Hardware : ET-AVR STAMP (ATmega64 ) */;
//*CPU : ATMEL-ATmega64 */;
//* X-TAL : 16.00 MHz */;
//* Filename : Main.C */;
//*Complier : CodeVisionAVR V1.24.7d */;
//* Last Update : 9-12-2005 (ETT CO.,LTD) */;
//* : WWW.ETT.CO.TH */;
//*Description : Example LED Blink on Portb.0 */;
//**********************************************/;
//*CodeVisionAVR Complier Option Setting */;
//* Chip type : ATmega64 */;
//* Program type : Application */;
//*Clock frequency : 16.000000MHz */;
//* Memory model : Small */;
//*External SRAM size : 0 */;
//* Data Stack size : 1024 */;
//**********************************************/;
void main(void)
{
PORTB=0x00; // PB7..0 = 0
DDRB=0x01; // PB0 = Output