
;*************************************************************** 
;* Project Name: 
;* Project Description :
; 
;* Author: 
;* Lab_group: <merocsoprt jele>
;* Last edited: <Enter the date here>  
;
;***************************************************************
;* "AVR ExperimentBoard" port assignment information:
;***************************************************************
;*
;* LED0(P):PortC.0          LED4(P):PortC.4
;* LED1(P):PortC.1          LED5(P):PortC.5
;* LED2(S):PortC.2          LED6(S):PortC.6
;* LED3(Z):PortC.3          LED7(Z):PortC.7        INT:PortE.4
;*
;* SW0:PortG.0     SW1:PortG.1     SW2:PortG.4     SW3:PortG.3
;* 
;* BT0:PortE.5     BT1:PortE.6     BT2:PortE.7     BT3:PortB.7
;*
;***************************************************************
;*
;* AIN:PortF.0     NTK:PortF.1    OPTO:PortF.2     POT:PortF.3
;*
;***************************************************************
;*
;* LCD1(VSS) = GND         LCD9(DB2): -
;* LCD2(VDD) = VCC         LCD10(DB3): -
;* LCD3(VO ) = GND         LCD11(DB4): PortA.4
;* LCD4(RS ) = PortA.0     LCD12(DB5): PortA.5
;* LCD5(R/W) = GND         LCD13(DB6): PortA.6
;* LCD6(E  ) = PortA.1     LCD14(DB7): PortA.7
;* LCD7(DB0) = -           LCD15(BLA): VCC
;* LCD8(DB1) = -           LCD16(BLK): PortB.5 (1=Backlight ON)
;*
;***************************************************************

.include "m128def.inc" ; Definition file for ATmega128 
;* Program Constants 
.equ const =$00 ; Generic Constant Structure example  
;* Program Variables Definitions 
.def temp =r16 ; Temporary Register example 

;*************************************************************** 
;* Reset & Interrupt Vectors  
.cseg 
.org $0000 ; Define start of Code segment 
	jmp RESET ; Reset Handler, jmp is 2 word instruction 

	reti ; INT0 Handler on $0002, dummy 
	nop 
	reti ; INT1 Handler, if INTn used, 'reti' and 'nop' 
	     ; will be replaced by 'jmp INTn_Handler_Address'
	nop 
	reti ; INT2 Handler 
	nop 
	reti ; INT3 Handler 
	nop 
	reti ; INT4 Handler 
	nop 
	reti ; INT5 Handler 
	nop 
	reti ; INT6 Handler 
	nop 
	reti ; INT7 Handler 
	nop 
	reti ; Timer2 Compare Match Handler 
	nop 
	reti ; Timer2 Overflow Handler 
	nop 
	reti ; Timer1 Capture Event Handler 
	nop 
	reti ; Timer1 Compare Match A Handler 
	nop 
	reti ; Timer1 Compare Match B Handler 
	nop 
	reti ; Timer1 Overflow Handler 
	nop 
	reti ; Timer0 Compare Match Handler 
	nop 
	reti ; Timer0 Overflow Handler 
	nop 
	reti ; SPI Transfer Complete Handler 
	nop 
	reti ; USART0 RX Complete Handler 
	nop 
	reti ; USART0 Data Register Empty Hanlder 
	nop 
	reti ; USART0 TX Complete Handler 
	nop 
	reti ; ADC Conversion Complete Handler 
	nop 
	reti ; EEPROM Ready Hanlder 
	nop 
	reti ; Analog Comparator Handler 
	nop 
	reti ; Timer1 Compare Match C Handler 
	nop
	reti ; Timer3 Capture Event Handler 
	nop 
	reti ; Timer3 Compare Match A Handler 
	nop 
	reti ; Timer3 Compare Match B Handler 
	nop 
	reti ; Timer3 Compare Match C Handler 
	nop 
	reti ; Timer3 Overflow Handler 
	nop 
	reti ; USART1 RX Complete Handler 
	nop 
	reti ; USART1 Data Register Empty Hanlder 
	nop 
	reti ; USART1 TX Complete Handler 
	nop 
	reti ; Two-wire Serial Interface Handler 
	nop 
	reti ; Store Program Memory Ready Handler 
	nop 
	
;*************************************************************** 
;* MAIN program, Initialisation part
.org $0046;
M_INIT:
RESET: 
;* Stack Pointer init, 
;  Set stack pointer to top of RAM 
	ldi temp, LOW(RAMEND) ; RAMEND = max address in RAM"
	out SPL, temp 	      ; RAMEND value in "m128def.inc" 
	ldi temp, HIGH(RAMEND) 
	out SPH, temp 

;< Insert your other initialisation code here> 

;*************************************************************** 
;* MAIN program, Endless loop part
 
M_LOOP: 

;< Insert your program code Here>

	jmp M_LOOP ; Endless Loop  


;*************************************************************** 
;* Subroutins, Interrupt routins













