
;CodeVisionAVR C Compiler V2.05.0 Evaluation
;(C) Copyright 1998-2010 Pavel Haiduc, HP InfoTech s.r.l.
;http://www.hpinfotech.com

;Chip type                : ATmega162
;Program type             : Application
;Clock frequency          : 11,059200 MHz
;Memory model             : Small
;Optimize for             : Speed
;(s)printf features       : int, width
;(s)scanf features        : int, width
;External RAM size        : 0
;Data Stack size          : 256 byte(s)
;Heap size                : 0 byte(s)
;Promote 'char' to 'int'  : Yes
;'char' is unsigned       : Yes
;8 bit enums              : Yes
;global 'const' stored in FLASH: Yes
;Enhanced core instructions    : On
;Smart register allocation     : On
;Automatic register allocation : On

	#pragma AVRPART ADMIN PART_NAME ATmega162
	#pragma AVRPART MEMORY PROG_FLASH 16384
	#pragma AVRPART MEMORY EEPROM 512
	#pragma AVRPART MEMORY INT_SRAM SIZE 1279
	#pragma AVRPART MEMORY INT_SRAM START_ADDR 0x100

	#define CALL_SUPPORTED 1

	.LISTMAC
	.EQU UDRE=0x5
	.EQU RXC=0x7
	.EQU USR=0xB
	.EQU UDR=0xC
	.EQU SPSR=0xE
	.EQU SPDR=0xF
	.EQU EERE=0x0
	.EQU EEWE=0x1
	.EQU EEMWE=0x2
	.EQU EECR=0x1C
	.EQU EEDR=0x1D
	.EQU EEARL=0x1E
	.EQU EEARH=0x1F
	.EQU WDTCR=0x21
	.EQU MCUCSR=0x34
	.EQU MCUCR=0x35
	.EQU EMCUCR=0x36
	.EQU GICR=0x3B
	.EQU SPL=0x3D
	.EQU SPH=0x3E
	.EQU SREG=0x3F

	.DEF R0X0=R0
	.DEF R0X1=R1
	.DEF R0X2=R2
	.DEF R0X3=R3
	.DEF R0X4=R4
	.DEF R0X5=R5
	.DEF R0X6=R6
	.DEF R0X7=R7
	.DEF R0X8=R8
	.DEF R0X9=R9
	.DEF R0XA=R10
	.DEF R0XB=R11
	.DEF R0XC=R12
	.DEF R0XD=R13
	.DEF R0XE=R14
	.DEF R0XF=R15
	.DEF R0X10=R16
	.DEF R0X11=R17
	.DEF R0X12=R18
	.DEF R0X13=R19
	.DEF R0X14=R20
	.DEF R0X15=R21
	.DEF R0X16=R22
	.DEF R0X17=R23
	.DEF R0X18=R24
	.DEF R0X19=R25
	.DEF R0X1A=R26
	.DEF R0X1B=R27
	.DEF R0X1C=R28
	.DEF R0X1D=R29
	.DEF R0X1E=R30
	.DEF R0X1F=R31

	.EQU __SRAM_START=0x0100
	.EQU __SRAM_END=0x04FF
	.EQU __DSTACK_SIZE=0x0100
	.EQU __HEAP_SIZE=0x0000
	.EQU __CLEAR_SRAM_SIZE=__SRAM_END-__SRAM_START+1

	.MACRO __CPD1N
	CPI  R30,LOW(@0)
	LDI  R26,HIGH(@0)
	CPC  R31,R26
	LDI  R26,BYTE3(@0)
	CPC  R22,R26
	LDI  R26,BYTE4(@0)
	CPC  R23,R26
	.ENDM

	.MACRO __CPD2N
	CPI  R26,LOW(@0)
	LDI  R30,HIGH(@0)
	CPC  R27,R30
	LDI  R30,BYTE3(@0)
	CPC  R24,R30
	LDI  R30,BYTE4(@0)
	CPC  R25,R30
	.ENDM

	.MACRO __CPWRR
	CP   R@0,R@2
	CPC  R@1,R@3
	.ENDM

	.MACRO __CPWRN
	CPI  R@0,LOW(@2)
	LDI  R30,HIGH(@2)
	CPC  R@1,R30
	.ENDM

	.MACRO __ADDB1MN
	SUBI R30,LOW(-@0-(@1))
	.ENDM

	.MACRO __ADDB2MN
	SUBI R26,LOW(-@0-(@1))
	.ENDM

	.MACRO __ADDW1MN
	SUBI R30,LOW(-@0-(@1))
	SBCI R31,HIGH(-@0-(@1))
	.ENDM

	.MACRO __ADDW2MN
	SUBI R26,LOW(-@0-(@1))
	SBCI R27,HIGH(-@0-(@1))
	.ENDM

	.MACRO __ADDW1FN
	SUBI R30,LOW(-2*@0-(@1))
	SBCI R31,HIGH(-2*@0-(@1))
	.ENDM

	.MACRO __ADDD1FN
	SUBI R30,LOW(-2*@0-(@1))
	SBCI R31,HIGH(-2*@0-(@1))
	SBCI R22,BYTE3(-2*@0-(@1))
	.ENDM

	.MACRO __ADDD1N
	SUBI R30,LOW(-@0)
	SBCI R31,HIGH(-@0)
	SBCI R22,BYTE3(-@0)
	SBCI R23,BYTE4(-@0)
	.ENDM

	.MACRO __ADDD2N
	SUBI R26,LOW(-@0)
	SBCI R27,HIGH(-@0)
	SBCI R24,BYTE3(-@0)
	SBCI R25,BYTE4(-@0)
	.ENDM

	.MACRO __SUBD1N
	SUBI R30,LOW(@0)
	SBCI R31,HIGH(@0)
	SBCI R22,BYTE3(@0)
	SBCI R23,BYTE4(@0)
	.ENDM

	.MACRO __SUBD2N
	SUBI R26,LOW(@0)
	SBCI R27,HIGH(@0)
	SBCI R24,BYTE3(@0)
	SBCI R25,BYTE4(@0)
	.ENDM

	.MACRO __ANDBMNN
	LDS  R30,@0+(@1)
	ANDI R30,LOW(@2)
	STS  @0+(@1),R30
	.ENDM

	.MACRO __ANDWMNN
	LDS  R30,@0+(@1)
	ANDI R30,LOW(@2)
	STS  @0+(@1),R30
	LDS  R30,@0+(@1)+1
	ANDI R30,HIGH(@2)
	STS  @0+(@1)+1,R30
	.ENDM

	.MACRO __ANDD1N
	ANDI R30,LOW(@0)
	ANDI R31,HIGH(@0)
	ANDI R22,BYTE3(@0)
	ANDI R23,BYTE4(@0)
	.ENDM

	.MACRO __ANDD2N
	ANDI R26,LOW(@0)
	ANDI R27,HIGH(@0)
	ANDI R24,BYTE3(@0)
	ANDI R25,BYTE4(@0)
	.ENDM

	.MACRO __ORBMNN
	LDS  R30,@0+(@1)
	ORI  R30,LOW(@2)
	STS  @0+(@1),R30
	.ENDM

	.MACRO __ORWMNN
	LDS  R30,@0+(@1)
	ORI  R30,LOW(@2)
	STS  @0+(@1),R30
	LDS  R30,@0+(@1)+1
	ORI  R30,HIGH(@2)
	STS  @0+(@1)+1,R30
	.ENDM

	.MACRO __ORD1N
	ORI  R30,LOW(@0)
	ORI  R31,HIGH(@0)
	ORI  R22,BYTE3(@0)
	ORI  R23,BYTE4(@0)
	.ENDM

	.MACRO __ORD2N
	ORI  R26,LOW(@0)
	ORI  R27,HIGH(@0)
	ORI  R24,BYTE3(@0)
	ORI  R25,BYTE4(@0)
	.ENDM

	.MACRO __DELAY_USB
	LDI  R24,LOW(@0)
__DELAY_USB_LOOP:
	DEC  R24
	BRNE __DELAY_USB_LOOP
	.ENDM

	.MACRO __DELAY_USW
	LDI  R24,LOW(@0)
	LDI  R25,HIGH(@0)
__DELAY_USW_LOOP:
	SBIW R24,1
	BRNE __DELAY_USW_LOOP
	.ENDM

	.MACRO __GETD1S
	LDD  R30,Y+@0
	LDD  R31,Y+@0+1
	LDD  R22,Y+@0+2
	LDD  R23,Y+@0+3
	.ENDM

	.MACRO __GETD2S
	LDD  R26,Y+@0
	LDD  R27,Y+@0+1
	LDD  R24,Y+@0+2
	LDD  R25,Y+@0+3
	.ENDM

	.MACRO __PUTD1S
	STD  Y+@0,R30
	STD  Y+@0+1,R31
	STD  Y+@0+2,R22
	STD  Y+@0+3,R23
	.ENDM

	.MACRO __PUTD2S
	STD  Y+@0,R26
	STD  Y+@0+1,R27
	STD  Y+@0+2,R24
	STD  Y+@0+3,R25
	.ENDM

	.MACRO __PUTDZ2
	STD  Z+@0,R26
	STD  Z+@0+1,R27
	STD  Z+@0+2,R24
	STD  Z+@0+3,R25
	.ENDM

	.MACRO __CLRD1S
	STD  Y+@0,R30
	STD  Y+@0+1,R30
	STD  Y+@0+2,R30
	STD  Y+@0+3,R30
	.ENDM

	.MACRO __POINTB1MN
	LDI  R30,LOW(@0+(@1))
	.ENDM

	.MACRO __POINTW1MN
	LDI  R30,LOW(@0+(@1))
	LDI  R31,HIGH(@0+(@1))
	.ENDM

	.MACRO __POINTD1M
	LDI  R30,LOW(@0)
	LDI  R31,HIGH(@0)
	LDI  R22,BYTE3(@0)
	LDI  R23,BYTE4(@0)
	.ENDM

	.MACRO __POINTW1FN
	LDI  R30,LOW(2*@0+(@1))
	LDI  R31,HIGH(2*@0+(@1))
	.ENDM

	.MACRO __POINTD1FN
	LDI  R30,LOW(2*@0+(@1))
	LDI  R31,HIGH(2*@0+(@1))
	LDI  R22,BYTE3(2*@0+(@1))
	LDI  R23,BYTE4(2*@0+(@1))
	.ENDM

	.MACRO __POINTB2MN
	LDI  R26,LOW(@0+(@1))
	.ENDM

	.MACRO __POINTW2MN
	LDI  R26,LOW(@0+(@1))
	LDI  R27,HIGH(@0+(@1))
	.ENDM

	.MACRO __POINTBRM
	LDI  R@0,LOW(@1)
	.ENDM

	.MACRO __POINTWRM
	LDI  R@0,LOW(@2)
	LDI  R@1,HIGH(@2)
	.ENDM

	.MACRO __POINTBRMN
	LDI  R@0,LOW(@1+(@2))
	.ENDM

	.MACRO __POINTWRMN
	LDI  R@0,LOW(@2+(@3))
	LDI  R@1,HIGH(@2+(@3))
	.ENDM

	.MACRO __POINTWRFN
	LDI  R@0,LOW(@2*2+(@3))
	LDI  R@1,HIGH(@2*2+(@3))
	.ENDM

	.MACRO __GETD1N
	LDI  R30,LOW(@0)
	LDI  R31,HIGH(@0)
	LDI  R22,BYTE3(@0)
	LDI  R23,BYTE4(@0)
	.ENDM

	.MACRO __GETD2N
	LDI  R26,LOW(@0)
	LDI  R27,HIGH(@0)
	LDI  R24,BYTE3(@0)
	LDI  R25,BYTE4(@0)
	.ENDM

	.MACRO __GETB1MN
	LDS  R30,@0+(@1)
	.ENDM

	.MACRO __GETB1HMN
	LDS  R31,@0+(@1)
	.ENDM

	.MACRO __GETW1MN
	LDS  R30,@0+(@1)
	LDS  R31,@0+(@1)+1
	.ENDM

	.MACRO __GETD1MN
	LDS  R30,@0+(@1)
	LDS  R31,@0+(@1)+1
	LDS  R22,@0+(@1)+2
	LDS  R23,@0+(@1)+3
	.ENDM

	.MACRO __GETBRMN
	LDS  R@0,@1+(@2)
	.ENDM

	.MACRO __GETWRMN
	LDS  R@0,@2+(@3)
	LDS  R@1,@2+(@3)+1
	.ENDM

	.MACRO __GETWRZ
	LDD  R@0,Z+@2
	LDD  R@1,Z+@2+1
	.ENDM

	.MACRO __GETD2Z
	LDD  R26,Z+@0
	LDD  R27,Z+@0+1
	LDD  R24,Z+@0+2
	LDD  R25,Z+@0+3
	.ENDM

	.MACRO __GETB2MN
	LDS  R26,@0+(@1)
	.ENDM

	.MACRO __GETW2MN
	LDS  R26,@0+(@1)
	LDS  R27,@0+(@1)+1
	.ENDM

	.MACRO __GETD2MN
	LDS  R26,@0+(@1)
	LDS  R27,@0+(@1)+1
	LDS  R24,@0+(@1)+2
	LDS  R25,@0+(@1)+3
	.ENDM

	.MACRO __PUTB1MN
	STS  @0+(@1),R30
	.ENDM

	.MACRO __PUTW1MN
	STS  @0+(@1),R30
	STS  @0+(@1)+1,R31
	.ENDM

	.MACRO __PUTD1MN
	STS  @0+(@1),R30
	STS  @0+(@1)+1,R31
	STS  @0+(@1)+2,R22
	STS  @0+(@1)+3,R23
	.ENDM

	.MACRO __PUTB1EN
	LDI  R26,LOW(@0+(@1))
	LDI  R27,HIGH(@0+(@1))
	CALL __EEPROMWRB
	.ENDM

	.MACRO __PUTW1EN
	LDI  R26,LOW(@0+(@1))
	LDI  R27,HIGH(@0+(@1))
	CALL __EEPROMWRW
	.ENDM

	.MACRO __PUTD1EN
	LDI  R26,LOW(@0+(@1))
	LDI  R27,HIGH(@0+(@1))
	CALL __EEPROMWRD
	.ENDM

	.MACRO __PUTBR0MN
	STS  @0+(@1),R0
	.ENDM

	.MACRO __PUTBMRN
	STS  @0+(@1),R@2
	.ENDM

	.MACRO __PUTWMRN
	STS  @0+(@1),R@2
	STS  @0+(@1)+1,R@3
	.ENDM

	.MACRO __PUTBZR
	STD  Z+@1,R@0
	.ENDM

	.MACRO __PUTWZR
	STD  Z+@2,R@0
	STD  Z+@2+1,R@1
	.ENDM

	.MACRO __GETW1R
	MOV  R30,R@0
	MOV  R31,R@1
	.ENDM

	.MACRO __GETW2R
	MOV  R26,R@0
	MOV  R27,R@1
	.ENDM

	.MACRO __GETWRN
	LDI  R@0,LOW(@2)
	LDI  R@1,HIGH(@2)
	.ENDM

	.MACRO __PUTW1R
	MOV  R@0,R30
	MOV  R@1,R31
	.ENDM

	.MACRO __PUTW2R
	MOV  R@0,R26
	MOV  R@1,R27
	.ENDM

	.MACRO __ADDWRN
	SUBI R@0,LOW(-@2)
	SBCI R@1,HIGH(-@2)
	.ENDM

	.MACRO __ADDWRR
	ADD  R@0,R@2
	ADC  R@1,R@3
	.ENDM

	.MACRO __SUBWRN
	SUBI R@0,LOW(@2)
	SBCI R@1,HIGH(@2)
	.ENDM

	.MACRO __SUBWRR
	SUB  R@0,R@2
	SBC  R@1,R@3
	.ENDM

	.MACRO __ANDWRN
	ANDI R@0,LOW(@2)
	ANDI R@1,HIGH(@2)
	.ENDM

	.MACRO __ANDWRR
	AND  R@0,R@2
	AND  R@1,R@3
	.ENDM

	.MACRO __ORWRN
	ORI  R@0,LOW(@2)
	ORI  R@1,HIGH(@2)
	.ENDM

	.MACRO __ORWRR
	OR   R@0,R@2
	OR   R@1,R@3
	.ENDM

	.MACRO __EORWRR
	EOR  R@0,R@2
	EOR  R@1,R@3
	.ENDM

	.MACRO __GETWRS
	LDD  R@0,Y+@2
	LDD  R@1,Y+@2+1
	.ENDM

	.MACRO __PUTBSR
	STD  Y+@1,R@0
	.ENDM

	.MACRO __PUTWSR
	STD  Y+@2,R@0
	STD  Y+@2+1,R@1
	.ENDM

	.MACRO __MOVEWRR
	MOV  R@0,R@2
	MOV  R@1,R@3
	.ENDM

	.MACRO __INWR
	IN   R@0,@2
	IN   R@1,@2+1
	.ENDM

	.MACRO __OUTWR
	OUT  @2+1,R@1
	OUT  @2,R@0
	.ENDM

	.MACRO __CALL1MN
	LDS  R30,@0+(@1)
	LDS  R31,@0+(@1)+1
	ICALL
	.ENDM

	.MACRO __CALL1FN
	LDI  R30,LOW(2*@0+(@1))
	LDI  R31,HIGH(2*@0+(@1))
	CALL __GETW1PF
	ICALL
	.ENDM

	.MACRO __CALL2EN
	LDI  R26,LOW(@0+(@1))
	LDI  R27,HIGH(@0+(@1))
	CALL __EEPROMRDW
	ICALL
	.ENDM

	.MACRO __GETW1STACK
	IN   R26,SPL
	IN   R27,SPH
	ADIW R26,@0+1
	LD   R30,X+
	LD   R31,X
	.ENDM

	.MACRO __GETD1STACK
	IN   R26,SPL
	IN   R27,SPH
	ADIW R26,@0+1
	LD   R30,X+
	LD   R31,X+
	LD   R22,X
	.ENDM

	.MACRO __NBST
	BST  R@0,@1
	IN   R30,SREG
	LDI  R31,0x40
	EOR  R30,R31
	OUT  SREG,R30
	.ENDM


	.MACRO __PUTB1SN
	LDD  R26,Y+@0
	LDD  R27,Y+@0+1
	SUBI R26,LOW(-@1)
	SBCI R27,HIGH(-@1)
	ST   X,R30
	.ENDM

	.MACRO __PUTW1SN
	LDD  R26,Y+@0
	LDD  R27,Y+@0+1
	SUBI R26,LOW(-@1)
	SBCI R27,HIGH(-@1)
	ST   X+,R30
	ST   X,R31
	.ENDM

	.MACRO __PUTD1SN
	LDD  R26,Y+@0
	LDD  R27,Y+@0+1
	SUBI R26,LOW(-@1)
	SBCI R27,HIGH(-@1)
	CALL __PUTDP1
	.ENDM

	.MACRO __PUTB1SNS
	LDD  R26,Y+@0
	LDD  R27,Y+@0+1
	ADIW R26,@1
	ST   X,R30
	.ENDM

	.MACRO __PUTW1SNS
	LDD  R26,Y+@0
	LDD  R27,Y+@0+1
	ADIW R26,@1
	ST   X+,R30
	ST   X,R31
	.ENDM

	.MACRO __PUTD1SNS
	LDD  R26,Y+@0
	LDD  R27,Y+@0+1
	ADIW R26,@1
	CALL __PUTDP1
	.ENDM

	.MACRO __PUTB1PMN
	LDS  R26,@0
	LDS  R27,@0+1
	SUBI R26,LOW(-@1)
	SBCI R27,HIGH(-@1)
	ST   X,R30
	.ENDM

	.MACRO __PUTW1PMN
	LDS  R26,@0
	LDS  R27,@0+1
	SUBI R26,LOW(-@1)
	SBCI R27,HIGH(-@1)
	ST   X+,R30
	ST   X,R31
	.ENDM

	.MACRO __PUTD1PMN
	LDS  R26,@0
	LDS  R27,@0+1
	SUBI R26,LOW(-@1)
	SBCI R27,HIGH(-@1)
	CALL __PUTDP1
	.ENDM

	.MACRO __PUTB1PMNS
	LDS  R26,@0
	LDS  R27,@0+1
	ADIW R26,@1
	ST   X,R30
	.ENDM

	.MACRO __PUTW1PMNS
	LDS  R26,@0
	LDS  R27,@0+1
	ADIW R26,@1
	ST   X+,R30
	ST   X,R31
	.ENDM

	.MACRO __PUTD1PMNS
	LDS  R26,@0
	LDS  R27,@0+1
	ADIW R26,@1
	CALL __PUTDP1
	.ENDM

	.MACRO __PUTB1RN
	MOVW R26,R@0
	SUBI R26,LOW(-@1)
	SBCI R27,HIGH(-@1)
	ST   X,R30
	.ENDM

	.MACRO __PUTW1RN
	MOVW R26,R@0
	SUBI R26,LOW(-@1)
	SBCI R27,HIGH(-@1)
	ST   X+,R30
	ST   X,R31
	.ENDM

	.MACRO __PUTD1RN
	MOVW R26,R@0
	SUBI R26,LOW(-@1)
	SBCI R27,HIGH(-@1)
	CALL __PUTDP1
	.ENDM

	.MACRO __PUTB1RNS
	MOVW R26,R@0
	ADIW R26,@1
	ST   X,R30
	.ENDM

	.MACRO __PUTW1RNS
	MOVW R26,R@0
	ADIW R26,@1
	ST   X+,R30
	ST   X,R31
	.ENDM

	.MACRO __PUTD1RNS
	MOVW R26,R@0
	ADIW R26,@1
	CALL __PUTDP1
	.ENDM

	.MACRO __PUTB1RON
	MOV  R26,R@0
	MOV  R27,R@1
	SUBI R26,LOW(-@2)
	SBCI R27,HIGH(-@2)
	ST   X,R30
	.ENDM

	.MACRO __PUTW1RON
	MOV  R26,R@0
	MOV  R27,R@1
	SUBI R26,LOW(-@2)
	SBCI R27,HIGH(-@2)
	ST   X+,R30
	ST   X,R31
	.ENDM

	.MACRO __PUTD1RON
	MOV  R26,R@0
	MOV  R27,R@1
	SUBI R26,LOW(-@2)
	SBCI R27,HIGH(-@2)
	CALL __PUTDP1
	.ENDM

	.MACRO __PUTB1RONS
	MOV  R26,R@0
	MOV  R27,R@1
	ADIW R26,@2
	ST   X,R30
	.ENDM

	.MACRO __PUTW1RONS
	MOV  R26,R@0
	MOV  R27,R@1
	ADIW R26,@2
	ST   X+,R30
	ST   X,R31
	.ENDM

	.MACRO __PUTD1RONS
	MOV  R26,R@0
	MOV  R27,R@1
	ADIW R26,@2
	CALL __PUTDP1
	.ENDM


	.MACRO __GETB1SX
	MOVW R30,R28
	SUBI R30,LOW(-@0)
	SBCI R31,HIGH(-@0)
	LD   R30,Z
	.ENDM

	.MACRO __GETB1HSX
	MOVW R30,R28
	SUBI R30,LOW(-@0)
	SBCI R31,HIGH(-@0)
	LD   R31,Z
	.ENDM

	.MACRO __GETW1SX
	MOVW R30,R28
	SUBI R30,LOW(-@0)
	SBCI R31,HIGH(-@0)
	LD   R0,Z+
	LD   R31,Z
	MOV  R30,R0
	.ENDM

	.MACRO __GETD1SX
	MOVW R30,R28
	SUBI R30,LOW(-@0)
	SBCI R31,HIGH(-@0)
	LD   R0,Z+
	LD   R1,Z+
	LD   R22,Z+
	LD   R23,Z
	MOVW R30,R0
	.ENDM

	.MACRO __GETB2SX
	MOVW R26,R28
	SUBI R26,LOW(-@0)
	SBCI R27,HIGH(-@0)
	LD   R26,X
	.ENDM

	.MACRO __GETW2SX
	MOVW R26,R28
	SUBI R26,LOW(-@0)
	SBCI R27,HIGH(-@0)
	LD   R0,X+
	LD   R27,X
	MOV  R26,R0
	.ENDM

	.MACRO __GETD2SX
	MOVW R26,R28
	SUBI R26,LOW(-@0)
	SBCI R27,HIGH(-@0)
	LD   R0,X+
	LD   R1,X+
	LD   R24,X+
	LD   R25,X
	MOVW R26,R0
	.ENDM

	.MACRO __GETBRSX
	MOVW R30,R28
	SUBI R30,LOW(-@1)
	SBCI R31,HIGH(-@1)
	LD   R@0,Z
	.ENDM

	.MACRO __GETWRSX
	MOVW R30,R28
	SUBI R30,LOW(-@2)
	SBCI R31,HIGH(-@2)
	LD   R@0,Z+
	LD   R@1,Z
	.ENDM

	.MACRO __GETBRSX2
	MOVW R26,R28
	SUBI R26,LOW(-@1)
	SBCI R27,HIGH(-@1)
	LD   R@0,X
	.ENDM

	.MACRO __GETWRSX2
	MOVW R26,R28
	SUBI R26,LOW(-@2)
	SBCI R27,HIGH(-@2)
	LD   R@0,X+
	LD   R@1,X
	.ENDM

	.MACRO __LSLW8SX
	MOVW R30,R28
	SUBI R30,LOW(-@0)
	SBCI R31,HIGH(-@0)
	LD   R31,Z
	CLR  R30
	.ENDM

	.MACRO __PUTB1SX
	MOVW R26,R28
	SUBI R26,LOW(-@0)
	SBCI R27,HIGH(-@0)
	ST   X,R30
	.ENDM

	.MACRO __PUTW1SX
	MOVW R26,R28
	SUBI R26,LOW(-@0)
	SBCI R27,HIGH(-@0)
	ST   X+,R30
	ST   X,R31
	.ENDM

	.MACRO __PUTD1SX
	MOVW R26,R28
	SUBI R26,LOW(-@0)
	SBCI R27,HIGH(-@0)
	ST   X+,R30
	ST   X+,R31
	ST   X+,R22
	ST   X,R23
	.ENDM

	.MACRO __CLRW1SX
	MOVW R26,R28
	SUBI R26,LOW(-@0)
	SBCI R27,HIGH(-@0)
	ST   X+,R30
	ST   X,R30
	.ENDM

	.MACRO __CLRD1SX
	MOVW R26,R28
	SUBI R26,LOW(-@0)
	SBCI R27,HIGH(-@0)
	ST   X+,R30
	ST   X+,R30
	ST   X+,R30
	ST   X,R30
	.ENDM

	.MACRO __PUTB2SX
	MOVW R30,R28
	SUBI R30,LOW(-@0)
	SBCI R31,HIGH(-@0)
	ST   Z,R26
	.ENDM

	.MACRO __PUTW2SX
	MOVW R30,R28
	SUBI R30,LOW(-@0)
	SBCI R31,HIGH(-@0)
	ST   Z+,R26
	ST   Z,R27
	.ENDM

	.MACRO __PUTD2SX
	MOVW R30,R28
	SUBI R30,LOW(-@0)
	SBCI R31,HIGH(-@0)
	ST   Z+,R26
	ST   Z+,R27
	ST   Z+,R24
	ST   Z,R25
	.ENDM

	.MACRO __PUTBSRX
	MOVW R30,R28
	SUBI R30,LOW(-@1)
	SBCI R31,HIGH(-@1)
	ST   Z,R@0
	.ENDM

	.MACRO __PUTWSRX
	MOVW R30,R28
	SUBI R30,LOW(-@2)
	SBCI R31,HIGH(-@2)
	ST   Z+,R@0
	ST   Z,R@1
	.ENDM

	.MACRO __PUTB1SNX
	MOVW R26,R28
	SUBI R26,LOW(-@0)
	SBCI R27,HIGH(-@0)
	LD   R0,X+
	LD   R27,X
	MOV  R26,R0
	SUBI R26,LOW(-@1)
	SBCI R27,HIGH(-@1)
	ST   X,R30
	.ENDM

	.MACRO __PUTW1SNX
	MOVW R26,R28
	SUBI R26,LOW(-@0)
	SBCI R27,HIGH(-@0)
	LD   R0,X+
	LD   R27,X
	MOV  R26,R0
	SUBI R26,LOW(-@1)
	SBCI R27,HIGH(-@1)
	ST   X+,R30
	ST   X,R31
	.ENDM

	.MACRO __PUTD1SNX
	MOVW R26,R28
	SUBI R26,LOW(-@0)
	SBCI R27,HIGH(-@0)
	LD   R0,X+
	LD   R27,X
	MOV  R26,R0
	SUBI R26,LOW(-@1)
	SBCI R27,HIGH(-@1)
	ST   X+,R30
	ST   X+,R31
	ST   X+,R22
	ST   X,R23
	.ENDM

	.MACRO __MULBRR
	MULS R@0,R@1
	MOVW R30,R0
	.ENDM

	.MACRO __MULBRRU
	MUL  R@0,R@1
	MOVW R30,R0
	.ENDM

	.MACRO __MULBRR0
	MULS R@0,R@1
	.ENDM

	.MACRO __MULBRRU0
	MUL  R@0,R@1
	.ENDM

	.MACRO __MULBNWRU
	LDI  R26,@2
	MUL  R26,R@0
	MOVW R30,R0
	MUL  R26,R@1
	ADD  R31,R0
	.ENDM

;NAME DEFINITIONS FOR GLOBAL VARIABLES ALLOCATED TO REGISTERS
	.DEF _programMemory=R5
	.DEF _switchMemory=R4
	.DEF _baudRateXBee=R7
	.DEF _parityXBee=R6
	.DEF _baudRateSensor=R9
	.DEF _paritySensor=R8
	.DEF _memory=R11
	.DEF _countStackForSensor=R10
	.DEF _countStackForPC=R13
	.DEF _memorySPISend=R12

	.CSEG
	.ORG 0x00

;START OF CODE MARKER
__START_OF_CODE:

;INTERRUPT VECTORS
	JMP  __RESET
	JMP  0x00
	JMP  0x00
	JMP  0x00
	JMP  0x00
	JMP  0x00
	JMP  0x00
	JMP  0x00
	JMP  0x00
	JMP  0x00
	JMP  0x00
	JMP  0x00
	JMP  0x00
	JMP  0x00
	JMP  0x00
	JMP  0x00
	JMP  0x00
	JMP  0x00
	JMP  _recieve_sensor_SPI
	JMP  _recieve_sensor
	JMP  _recieve
	JMP  0x00
	JMP  0x00
	JMP  0x00
	JMP  0x00
	JMP  0x00
	JMP  0x00
	JMP  0x00

_tbl10_G100:
	.DB  0x10,0x27,0xE8,0x3,0x64,0x0,0xA,0x0
	.DB  0x1,0x0
_tbl16_G100:
	.DB  0x0,0x10,0x0,0x1,0x10,0x0,0x1,0x0

_0x33:
	.DB  0x1,0x1,0x0,0x3,0x0,0x3,0x0,0x0
	.DB  0x0,0x0
_0x0:
	.DB  0x41,0x54,0x41,0x43,0x20,0xD,0x0,0x41
	.DB  0x54,0x43,0x4E,0x20,0xD,0x0,0x4F,0x4B
	.DB  0x0
_0x40000:
	.DB  0x2B,0x2B,0x2B,0x0,0x45,0x52,0x52,0x4F
	.DB  0x52,0x0,0x4F,0x4B,0x0,0x48,0x49,0x47
	.DB  0x48,0x0,0x4C,0x4F,0x57,0x0

__GLOBAL_INI_TBL:
	.DW  0x07
	.DW  _0xE
	.DW  _0x0*2

	.DW  0x07
	.DW  _0xE+7
	.DW  _0x0*2+7

	.DW  0x03
	.DW  _0xE+14
	.DW  _0x0*2+14

	.DW  0x0A
	.DW  0x04
	.DW  _0x33*2

	.DW  0x04
	.DW  _0x40016
	.DW  _0x40000*2

	.DW  0x06
	.DW  _0x40084
	.DW  _0x40000*2+4

	.DW  0x03
	.DW  _0x40084+6
	.DW  _0x40000*2+10

	.DW  0x06
	.DW  _0x40084+9
	.DW  _0x40000*2+4

	.DW  0x06
	.DW  _0x40084+15
	.DW  _0x40000*2+4

	.DW  0x06
	.DW  _0x40084+21
	.DW  _0x40000*2+4

	.DW  0x03
	.DW  _0x40084+27
	.DW  _0x40000*2+10

	.DW  0x03
	.DW  _0x40084+30
	.DW  _0x40000*2+10

	.DW  0x03
	.DW  _0x40084+33
	.DW  _0x40000*2+10

	.DW  0x03
	.DW  _0x40084+36
	.DW  _0x40000*2+10

	.DW  0x03
	.DW  _0x40084+39
	.DW  _0x40000*2+10

	.DW  0x03
	.DW  _0x40084+42
	.DW  _0x40000*2+10

	.DW  0x03
	.DW  _0x40084+45
	.DW  _0x40000*2+10

	.DW  0x05
	.DW  _0x40084+48
	.DW  _0x40000*2+13

	.DW  0x04
	.DW  _0x40084+53
	.DW  _0x40000*2+18

_0xFFFFFFFF:
	.DW  0

__RESET:
	CLI
	CLR  R30
	OUT  EECR,R30

;INTERRUPT VECTORS ARE PLACED
;AT THE START OF FLASH
	LDI  R31,1
	OUT  GICR,R31
	OUT  GICR,R30
	OUT  MCUCR,R30
	OUT  EMCUCR,R30

;DISABLE WATCHDOG
	LDI  R31,0x18
	OUT  WDTCR,R31
	OUT  WDTCR,R30

;CLEAR R2-R14
	LDI  R24,(14-2)+1
	LDI  R26,2
	CLR  R27
__CLEAR_REG:
	ST   X+,R30
	DEC  R24
	BRNE __CLEAR_REG

;CLEAR SRAM
	LDI  R24,LOW(__CLEAR_SRAM_SIZE)
	LDI  R25,HIGH(__CLEAR_SRAM_SIZE)
	LDI  R26,LOW(__SRAM_START)
	LDI  R27,HIGH(__SRAM_START)
__CLEAR_SRAM:
	ST   X+,R30
	SBIW R24,1
	BRNE __CLEAR_SRAM

;GLOBAL VARIABLES INITIALIZATION
	LDI  R30,LOW(__GLOBAL_INI_TBL*2)
	LDI  R31,HIGH(__GLOBAL_INI_TBL*2)
__GLOBAL_INI_NEXT:
	LPM  R24,Z+
	LPM  R25,Z+
	SBIW R24,0
	BREQ __GLOBAL_INI_END
	LPM  R26,Z+
	LPM  R27,Z+
	LPM  R0,Z+
	LPM  R1,Z+
	MOVW R22,R30
	MOVW R30,R0
__GLOBAL_INI_LOOP:
	LPM  R0,Z+
	ST   X+,R0
	SBIW R24,1
	BRNE __GLOBAL_INI_LOOP
	MOVW R30,R22
	RJMP __GLOBAL_INI_NEXT
__GLOBAL_INI_END:

;HARDWARE STACK POINTER INITIALIZATION
	LDI  R30,LOW(__SRAM_END-__HEAP_SIZE)
	OUT  SPL,R30
	LDI  R30,HIGH(__SRAM_END-__HEAP_SIZE)
	OUT  SPH,R30

;DATA STACK POINTER INITIALIZATION
	LDI  R28,LOW(__SRAM_START+__DSTACK_SIZE)
	LDI  R29,HIGH(__SRAM_START+__DSTACK_SIZE)

	JMP  _main

	.ESEG
	.ORG 0

	.DSEG
	.ORG 0x200

	.CSEG
;//#include "atmega_IO.h"
;#include <mega162.h>
	#ifndef __SLEEP_DEFINED__
	#define __SLEEP_DEFINED__
	.EQU __se_bit=0x20
	.SET power_ctrl_reg=mcucr
	#endif
;#include <mega162_bits.h>
;#include "communication.h"
;#include "initialization.h"
;
;//Globalni promenne
;char programMemory = 0x01;
;char switchMemory = 0x01;
;char baudRateXBee = 0x03;  //komunikace s XBee
;char parityXBee = 0x00;  //komunikace s XBee
;char baudRateSensor = 0x03;  //komunikace se senzorem
;char paritySensor = 0x00;  //komunikace se senzorem
;char memory = 0x00;  //pro pamatovani zda-li prisly znaky O, K, E, R
;char stackForSensor [32];  //zasobnik dat pro senzor
;char countStackForSensor = 0;  //pocitadlo dat v zasobniku pro senzor
;char stackForPC [32];  //zasobnik dat pro PC
;char countStackForPC = 0;  //pocitadlo dat v zasobniku pro PC
;char memorySPISend = 0;  //memory pro SPI
;
;interrupt [SPI_STC] void recieve_sensor_SPI (void)  //preruseni pri prijmu dat ze Senzoru z SPI
; 0000 0016 {

	.CSEG
_recieve_sensor_SPI:
	ST   -Y,R0
	ST   -Y,R1
	ST   -Y,R15
	ST   -Y,R22
	ST   -Y,R23
	ST   -Y,R24
	ST   -Y,R25
	ST   -Y,R26
	ST   -Y,R27
	ST   -Y,R30
	ST   -Y,R31
	IN   R30,SREG
	ST   -Y,R30
; 0000 0017     SREG.7 = 0;
	BCLR 7
; 0000 0018     SensorSPIRecieve(&stackForPC[0], &countStackForPC);
	LDI  R30,LOW(_stackForPC)
	LDI  R31,HIGH(_stackForPC)
	ST   -Y,R31
	ST   -Y,R30
	LDI  R30,LOW(13)
	LDI  R31,HIGH(13)
	ST   -Y,R31
	ST   -Y,R30
	CALL _SensorSPIRecieve
; 0000 0019     memorySPISend = 0;
	CLR  R12
; 0000 001A     //setPORTC_LED(0x01); SVITI
; 0000 001B     SREG.7 = 1;
	RJMP _0x32
; 0000 001C }
;
;interrupt [USART0_RXC] void recieve_sensor (void)  //preruseni pri prijmu dat ze Senzoru z USART
; 0000 001F {
_recieve_sensor:
	ST   -Y,R0
	ST   -Y,R1
	ST   -Y,R15
	ST   -Y,R22
	ST   -Y,R23
	ST   -Y,R24
	ST   -Y,R25
	ST   -Y,R26
	ST   -Y,R27
	ST   -Y,R30
	ST   -Y,R31
	IN   R30,SREG
	ST   -Y,R30
; 0000 0020     SREG.7 = 0;
	BCLR 7
; 0000 0021     SensorUsartRecieve(&stackForPC[0], &countStackForPC);
	LDI  R30,LOW(_stackForPC)
	LDI  R31,HIGH(_stackForPC)
	ST   -Y,R31
	ST   -Y,R30
	LDI  R30,LOW(13)
	LDI  R31,HIGH(13)
	ST   -Y,R31
	ST   -Y,R30
	CALL _SensorUsartRecieve
; 0000 0022     SREG.7 = 1;
	RJMP _0x32
; 0000 0023 }
;
;interrupt [USART1_RXC] void recieve (void)  //preruseni pri prijmu dat z modulu XBee
; 0000 0026 {
_recieve:
	ST   -Y,R0
	ST   -Y,R1
	ST   -Y,R15
	ST   -Y,R22
	ST   -Y,R23
	ST   -Y,R24
	ST   -Y,R25
	ST   -Y,R26
	ST   -Y,R27
	ST   -Y,R30
	ST   -Y,R31
	IN   R30,SREG
	ST   -Y,R30
; 0000 0027     SREG.7 = 0;
	BCLR 7
; 0000 0028     XBeeUsartRecieve (&programMemory, &switchMemory, &baudRateXBee, &parityXBee, &baudRateSensor, &paritySensor, &memory, &stackForSensor[0], &countStackForSensor);
	LDI  R30,LOW(5)
	LDI  R31,HIGH(5)
	ST   -Y,R31
	ST   -Y,R30
	LDI  R30,LOW(4)
	LDI  R31,HIGH(4)
	ST   -Y,R31
	ST   -Y,R30
	LDI  R30,LOW(7)
	LDI  R31,HIGH(7)
	ST   -Y,R31
	ST   -Y,R30
	LDI  R30,LOW(6)
	LDI  R31,HIGH(6)
	ST   -Y,R31
	ST   -Y,R30
	LDI  R30,LOW(9)
	LDI  R31,HIGH(9)
	ST   -Y,R31
	ST   -Y,R30
	LDI  R30,LOW(8)
	LDI  R31,HIGH(8)
	ST   -Y,R31
	ST   -Y,R30
	LDI  R30,LOW(11)
	LDI  R31,HIGH(11)
	ST   -Y,R31
	ST   -Y,R30
	LDI  R30,LOW(_stackForSensor)
	LDI  R31,HIGH(_stackForSensor)
	ST   -Y,R31
	ST   -Y,R30
	LDI  R30,LOW(10)
	LDI  R31,HIGH(10)
	ST   -Y,R31
	ST   -Y,R30
	RCALL _XBeeUsartRecieve
; 0000 0029     SREG.7 = 1;
_0x32:
	BSET 7
; 0000 002A }
	LD   R30,Y+
	OUT  SREG,R30
	LD   R31,Y+
	LD   R30,Y+
	LD   R27,Y+
	LD   R26,Y+
	LD   R25,Y+
	LD   R24,Y+
	LD   R23,Y+
	LD   R22,Y+
	LD   R15,Y+
	LD   R1,Y+
	LD   R0,Y+
	RETI
;
;
;void main (void)
; 0000 002E {
_main:
; 0000 002F     char retezec [8];
; 0000 0030     char testData [10];
; 0000 0031     char count = 0;
; 0000 0032     char memoryUDR0Send = 0;
; 0000 0033     char i = 0;
; 0000 0034     char firstStart = 0;
; 0000 0035 
; 0000 0036     atmegaSetUp();
	SBIW R28,18
;	retezec -> Y+10
;	testData -> Y+0
;	count -> R17
;	memoryUDR0Send -> R16
;	i -> R19
;	firstStart -> R18
	LDI  R17,0
	LDI  R16,0
	LDI  R19,0
	LDI  R18,0
	RCALL _atmegaSetUp
; 0000 0037     loadTestData(&testData[0]);
	MOVW R30,R28
	ST   -Y,R31
	ST   -Y,R30
	RCALL _loadTestData
; 0000 0038 
; 0000 0039     while (1 == 1)
_0x3:
; 0000 003A     {
; 0000 003B         switch(switchMemory)
	MOV  R30,R4
	LDI  R31,0
; 0000 003C         {
; 0000 003D             case 0x00: break;
	SBIW R30,0
	BRNE _0x9
	RJMP _0x8
; 0000 003E             case 0x01: switchMemory = XBeeEnterCommandMode(); break;
_0x9:
	CPI  R30,LOW(0x1)
	LDI  R26,HIGH(0x1)
	CPC  R31,R26
	BRNE _0xA
	RCALL _XBeeEnterCommandMode
	MOV  R4,R30
	RJMP _0x8
; 0000 003F             case 0x02: XBeeSetBaudRate(&retezec[0], baudRateXBee); switchMemory = XBeeSendString(retezec);  break;
_0xA:
	CPI  R30,LOW(0x2)
	LDI  R26,HIGH(0x2)
	CPC  R31,R26
	BRNE _0xB
	MOVW R30,R28
	ADIW R30,10
	ST   -Y,R31
	ST   -Y,R30
	ST   -Y,R7
	RCALL _XBeeSetBaudRate
	MOVW R30,R28
	ADIW R30,10
	ST   -Y,R31
	ST   -Y,R30
	RCALL _XBeeSendString
	MOV  R4,R30
	RJMP _0x8
; 0000 0040             case 0x03: XBeeSetParity(&retezec[0], parityXBee); switchMemory = XBeeSendString(retezec);  break;
_0xB:
	CPI  R30,LOW(0x3)
	LDI  R26,HIGH(0x3)
	CPC  R31,R26
	BRNE _0xC
	MOVW R30,R28
	ADIW R30,10
	ST   -Y,R31
	ST   -Y,R30
	ST   -Y,R6
	RCALL _XBeeSetParity
	MOVW R30,R28
	ADIW R30,10
	ST   -Y,R31
	ST   -Y,R30
	RCALL _XBeeSendString
	MOV  R4,R30
	RJMP _0x8
; 0000 0041             case 0x04: switchMemory = XBeeSendString(APPLY_COMMUNICATION_PARAMETERS); break;
_0xC:
	CPI  R30,LOW(0x4)
	LDI  R26,HIGH(0x4)
	CPC  R31,R26
	BRNE _0xD
	__POINTW1MN _0xE,0
	ST   -Y,R31
	ST   -Y,R30
	RCALL _XBeeSendString
	MOV  R4,R30
	RJMP _0x8
; 0000 0042             case 0x05:
_0xD:
	CPI  R30,LOW(0x5)
	LDI  R26,HIGH(0x5)
	CPC  R31,R26
	BRNE _0xF
; 0000 0043             {
; 0000 0044                 XBeeSetUSARTParameters(baudRateXBee, parityXBee);
	ST   -Y,R7
	ST   -Y,R6
	RCALL _XBeeSetUSARTParameters
; 0000 0045                 switchMemory = XBeeSendString(EXIT_COMMAND_MODE);
	__POINTW1MN _0xE,7
	ST   -Y,R31
	ST   -Y,R30
	RCALL _XBeeSendString
	MOV  R4,R30
; 0000 0046                 if(firstStart != 0)
	CPI  R18,0
	BREQ _0x10
; 0000 0047                 {
; 0000 0048                     XBeeSendString("OK");  //posle OK vzdy kdyz dojde k vzdalenemu prenastaveni komunikace s XBee modulem
	__POINTW1MN _0xE,14
	ST   -Y,R31
	ST   -Y,R30
	RCALL _XBeeSendString
; 0000 0049                 }
; 0000 004A                 firstStart = 1;
_0x10:
	LDI  R18,LOW(1)
; 0000 004B                 setPORTC_LED(0x00);
	LDI  R30,LOW(0)
	ST   -Y,R30
	RCALL _setPORTC_LED
; 0000 004C                 break;
	RJMP _0x8
; 0000 004D             }
; 0000 004E             case 0x06: count = XBeeTransmitTestData(&testData[0], count); break;
_0xF:
	CPI  R30,LOW(0x6)
	LDI  R26,HIGH(0x6)
	CPC  R31,R26
	BRNE _0x12
	MOVW R30,R28
	ST   -Y,R31
	ST   -Y,R30
	ST   -Y,R17
	RCALL _XBeeTransmitTestData
	MOV  R17,R30
; 0000 004F             default: break;
_0x12:
; 0000 0050         }
_0x8:
; 0000 0051 
; 0000 0052         if(UCSR0B.7 == 1 && (((memoryUDR0Send == 0) && (countStackForSensor > 0)) || ((countStackForSensor > 0) && (UCSR0A.6 == 1))))  //posila data ze zasobniku z XBee na senzor
	SBIS 0xA,7
	RJMP _0x14
	CPI  R16,0
	BRNE _0x15
	LDI  R30,LOW(0)
	CP   R30,R10
	BRLO _0x17
_0x15:
	LDI  R30,LOW(0)
	CP   R30,R10
	BRSH _0x18
	SBIC 0xB,6
	RJMP _0x17
_0x18:
	RJMP _0x14
_0x17:
	RJMP _0x1B
_0x14:
	RJMP _0x13
_0x1B:
; 0000 0053         {
; 0000 0054             SREG.7 = 0;
	BCLR 7
; 0000 0055             memoryUDR0Send = 1;
	LDI  R16,LOW(1)
; 0000 0056 
; 0000 0057             UDR0 = stackForSensor[0];
	LDS  R30,_stackForSensor
	OUT  0xC,R30
; 0000 0058             for(i = 0; i < countStackForSensor; i++)
	LDI  R19,LOW(0)
_0x1D:
	CP   R19,R10
	BRSH _0x1E
; 0000 0059             {
; 0000 005A                 stackForSensor[i] = stackForSensor[i + 1];
	MOV  R26,R19
	LDI  R27,0
	SUBI R26,LOW(-_stackForSensor)
	SBCI R27,HIGH(-_stackForSensor)
	MOV  R30,R19
	LDI  R31,0
	__ADDW1MN _stackForSensor,1
	LD   R30,Z
	ST   X,R30
; 0000 005B             }
	SUBI R19,-1
	RJMP _0x1D
_0x1E:
; 0000 005C             countStackForSensor--;
	DEC  R10
; 0000 005D             SREG.7 = 1;
	BSET 7
; 0000 005E         }
; 0000 005F 
; 0000 0060         if((SPCR.7 == 1) && (memorySPISend == 0) && (countStackForSensor > 0))
_0x13:
	SBIS 0xD,7
	RJMP _0x20
	LDI  R30,LOW(0)
	CP   R30,R12
	BRNE _0x20
	CP   R30,R10
	BRLO _0x21
_0x20:
	RJMP _0x1F
_0x21:
; 0000 0061         {
; 0000 0062             SREG.7 = 0;
	BCLR 7
; 0000 0063             memorySPISend = 1;
	LDI  R30,LOW(1)
	MOV  R12,R30
; 0000 0064             SPDR = stackForSensor[0];
	LDS  R30,_stackForSensor
	OUT  0xF,R30
; 0000 0065             for(i = 0; i < countStackForSensor; i++)
	LDI  R19,LOW(0)
_0x23:
	CP   R19,R10
	BRSH _0x24
; 0000 0066             {
; 0000 0067                 stackForSensor[i] = stackForSensor[i + 1];
	MOV  R26,R19
	LDI  R27,0
	SUBI R26,LOW(-_stackForSensor)
	SBCI R27,HIGH(-_stackForSensor)
	MOV  R30,R19
	LDI  R31,0
	__ADDW1MN _stackForSensor,1
	LD   R30,Z
	ST   X,R30
; 0000 0068             }
	SUBI R19,-1
	RJMP _0x23
_0x24:
; 0000 0069             countStackForSensor--;
	DEC  R10
; 0000 006A 
; 0000 006B             //setPORTC_LED(0x00);  /////////////////////////////////Rozsviceni LED 0, SVITI
; 0000 006C             SREG.7 = 1;
	BSET 7
; 0000 006D         }
; 0000 006E 
; 0000 006F         if((countStackForPC > 0) && (UCSR1A.6 == 1))  //posila data ze zasobniku z procesoru do XBee (do PC)
_0x1F:
	LDI  R30,LOW(0)
	CP   R30,R13
	BRSH _0x26
	SBIC 0x2,6
	RJMP _0x27
_0x26:
	RJMP _0x25
_0x27:
; 0000 0070         {
; 0000 0071             SREG.7 = 0;
	BCLR 7
; 0000 0072             if(UCSR1A.6==1) //priznak vysilani dokonceno a v bufferu nejsou data k odeslani
	SBIC 0x2,6
; 0000 0073             {
; 0000 0074                 UCSR1A.6=1; //nuluje se nastavanim do logicke 1
	SBI  0x2,6
; 0000 0075             };
; 0000 0076 
; 0000 0077             UDR1 = stackForPC[0];
	LDS  R30,_stackForPC
	OUT  0x3,R30
; 0000 0078             for(i = 0; i < countStackForPC; i++)
	LDI  R19,LOW(0)
_0x2C:
	CP   R19,R13
	BRSH _0x2D
; 0000 0079             {
; 0000 007A                 stackForPC[i] = stackForPC[i + 1];
	MOV  R26,R19
	LDI  R27,0
	SUBI R26,LOW(-_stackForPC)
	SBCI R27,HIGH(-_stackForPC)
	MOV  R30,R19
	LDI  R31,0
	__ADDW1MN _stackForPC,1
	LD   R30,Z
	ST   X,R30
; 0000 007B             }
	SUBI R19,-1
	RJMP _0x2C
_0x2D:
; 0000 007C             countStackForPC--;
	DEC  R13
; 0000 007D             //setPORTC_LED(0x00);  /////////////////////////////////, SVITI
; 0000 007E             while (UCSR1A.6==0)  //dokud neni vysilani dokonceno
_0x2E:
	SBIS 0x2,6
; 0000 007F             {
; 0000 0080             }
	RJMP _0x2E
; 0000 0081             //priznak vysilani dokonceno zustava nastaven
; 0000 0082             SREG.7 = 1;
	BSET 7
; 0000 0083         }
; 0000 0084     }
_0x25:
	RJMP _0x3
; 0000 0085 }
_0x31:
	NOP
	RJMP _0x31

	.DSEG
_0xE:
	.BYTE 0x11
;//#include "atmega_IO.h"
;#include <mega162.h>
	#ifndef __SLEEP_DEFINED__
	#define __SLEEP_DEFINED__
	.EQU __se_bit=0x20
	.SET power_ctrl_reg=mcucr
	#endif
;#include <mega162_bits.h>
;#include "initialization.h"
;
;void atmegaSetUp(void)  //nastavuje procesor do pocatecniho nastaveni
; 0001 0007 {

	.CSEG
_atmegaSetUp:
; 0001 0008     //vypnuti WatchDogu
; 0001 0009     /* Write logical on? to WDCE and WDE */
; 0001 000A     WDTCR |= (1<<WDCE) | (1<<WDE);
	IN   R30,0x21
	ORI  R30,LOW(0x18)
	OUT  0x21,R30
; 0001 000B     /* Turn off WDT */
; 0001 000C     WDTCR = 0x00;
	LDI  R30,LOW(0)
	OUT  0x21,R30
; 0001 000D 
; 0001 000E     //inicializace PORTU
; 0001 000F     DDRA = 0x00;  //port A bude vstupni
	OUT  0x1A,R30
; 0001 0010     DDRB.4 = 1;  //Slave select musi byt vystupni kvuli tomu aby byl mikrokontroler stale v master rezimu
	SBI  0x17,4
; 0001 0011     DDRB.5 = 1;  //SCK (SPI) musi byt output
	SBI  0x17,5
; 0001 0012     DDRB.7 = 1;  //MOSI (SPI) musi byt output
	SBI  0x17,7
; 0001 0013     DDRC = 0xFF;  //port C bude vystupni
	LDI  R30,LOW(255)
	OUT  0x14,R30
; 0001 0014 
; 0001 0015     PORTB.4 = 1;  //Slave select musi byt v logicke 1 kvuli tomu aby byl mikrokontroler stale v master rezimu
	SBI  0x18,4
; 0001 0016     PORTC = 0x00;  //vsechny vystupy budou v logicke 0
	LDI  R30,LOW(0)
	OUT  0x15,R30
; 0001 0017 
; 0001 0018     //inicializace USART JEDNOTEK
; 0001 0019     UBRR0H = 0x00;  //USART0 bude nastaven na 9600 Bd
	OUT  0x20,R30
; 0001 001A     UBRR0L = 0x47;  //USART0 bude nastaven na 9600 Bd
	LDI  R30,LOW(71)
	OUT  0x9,R30
; 0001 001B     UCSR0B = (1<<RXEN0)|(1<<TXEN0);  //povoleni vysilace a prijimace
	LDI  R30,LOW(24)
	OUT  0xA,R30
; 0001 001C 
; 0001 001D     UBRR1H = 0x00;  //USART1 bude nastaven na 9600 Bd
	LDI  R30,LOW(0)
	OUT  0x3C,R30
; 0001 001E     UBRR1L = 0x47;  //USART1 bude nastaven na 9600 Bd
	LDI  R30,LOW(71)
	OUT  0x0,R30
; 0001 001F     UCSR1B = (1<<RXCIE1)|(1<<RXEN1)|(1<<TXEN1);  //povoleni preruseni od prijimace, povoleni vysilace a prijimace
	LDI  R30,LOW(152)
	OUT  0x1,R30
; 0001 0020 
; 0001 0021     //inicializace ANALOGOVEHO KOMPARATORU
; 0001 0022     ACSR = (1<<ACBG);  //pripojeni referencniho napeti (1,23 V) na neinvertujici vstup Analogoveho komparatoru
	LDI  R30,LOW(64)
	OUT  0x8,R30
; 0001 0023 
; 0001 0024     //konec inicializaci
; 0001 0025     delay_ms(Wait_3sec);  //cekani 3 sekundy, diody budou svitit pro overeni funkcnosti zarizeni
	LDI  R30,LOW(30)
	LDI  R31,HIGH(30)
	ST   -Y,R31
	ST   -Y,R30
	CALL _delay_ms
; 0001 0026     PORTC = 0xFF;  //vsechny vystupy budou v logicke 1
	LDI  R30,LOW(255)
	OUT  0x15,R30
; 0001 0027     delay_ms(Wait_1sec);
	LDI  R30,LOW(10)
	LDI  R31,HIGH(10)
	ST   -Y,R31
	ST   -Y,R30
	CALL _delay_ms
; 0001 0028 }
	RET
;
;void loadTestData(unsigned char *p_testData)  //nahrava do pole hodnoty cisel 0 az 9
; 0001 002B {
_loadTestData:
; 0001 002C     char count = 0;
; 0001 002D     for(count = 0; count < 10; count++)
	ST   -Y,R17
;	*p_testData -> Y+1
;	count -> R17
	LDI  R17,0
	LDI  R17,LOW(0)
_0x2000C:
	CPI  R17,10
	BRSH _0x2000D
; 0001 002E     {
; 0001 002F         *(p_testData + count) = count + 48;
	MOV  R30,R17
	LDI  R31,0
	LDD  R26,Y+1
	LDD  R27,Y+1+1
	ADD  R26,R30
	ADC  R27,R31
	MOV  R30,R17
	SUBI R30,-LOW(48)
	ST   X,R30
; 0001 0030     }
	SUBI R17,-1
	RJMP _0x2000C
_0x2000D:
; 0001 0031 }
	RJMP _0x2060004
;#include "communication.h"
	#ifndef __SLEEP_DEFINED__
	#define __SLEEP_DEFINED__
	.EQU __se_bit=0x20
	.SET power_ctrl_reg=mcucr
	#endif
;
;void setPORTC_LED(char LED_number)  //funkce slouzici pro debug
; 0002 0004 {

	.CSEG
_setPORTC_LED:
; 0002 0005     switch (LED_number)
;	LED_number -> Y+0
	LD   R30,Y
	LDI  R31,0
; 0002 0006     {
; 0002 0007         case 0x00: PORTC = 0xFE; break;
	SBIW R30,0
	BRNE _0x40006
	LDI  R30,LOW(254)
	OUT  0x15,R30
	RJMP _0x40005
; 0002 0008         case 0x01: PORTC = 0xFC; break;
_0x40006:
	CPI  R30,LOW(0x1)
	LDI  R26,HIGH(0x1)
	CPC  R31,R26
	BRNE _0x40007
	LDI  R30,LOW(252)
	OUT  0x15,R30
	RJMP _0x40005
; 0002 0009         case 0x02: PORTC = 0xF8; break;
_0x40007:
	CPI  R30,LOW(0x2)
	LDI  R26,HIGH(0x2)
	CPC  R31,R26
	BRNE _0x40008
	LDI  R30,LOW(248)
	OUT  0x15,R30
	RJMP _0x40005
; 0002 000A         case 0x03: PORTC = 0xF0; break;
_0x40008:
	CPI  R30,LOW(0x3)
	LDI  R26,HIGH(0x3)
	CPC  R31,R26
	BRNE _0x40009
	LDI  R30,LOW(240)
	OUT  0x15,R30
	RJMP _0x40005
; 0002 000B         case 0x04: PORTC = 0xE0; break;
_0x40009:
	CPI  R30,LOW(0x4)
	LDI  R26,HIGH(0x4)
	CPC  R31,R26
	BRNE _0x4000A
	LDI  R30,LOW(224)
	OUT  0x15,R30
	RJMP _0x40005
; 0002 000C         case 0x05: PORTC = 0xC0; break;
_0x4000A:
	CPI  R30,LOW(0x5)
	LDI  R26,HIGH(0x5)
	CPC  R31,R26
	BRNE _0x4000B
	LDI  R30,LOW(192)
	OUT  0x15,R30
	RJMP _0x40005
; 0002 000D         case 0x06: PORTC = 0x80; break;
_0x4000B:
	CPI  R30,LOW(0x6)
	LDI  R26,HIGH(0x6)
	CPC  R31,R26
	BRNE _0x4000C
	LDI  R30,LOW(128)
	OUT  0x15,R30
	RJMP _0x40005
; 0002 000E         case 0x07: PORTC = 0x00; break;
_0x4000C:
	CPI  R30,LOW(0x7)
	LDI  R26,HIGH(0x7)
	CPC  R31,R26
	BRNE _0x4000E
	LDI  R30,LOW(0)
	OUT  0x15,R30
; 0002 000F         default: break;
_0x4000E:
; 0002 0010     }
_0x40005:
; 0002 0011 }
	ADIW R28,1
	RET
;
;char XBeeTransmitTestData (char * p_TestData, char count)  //posila data na USART1
; 0002 0014 {
_XBeeTransmitTestData:
; 0002 0015     if(UCSR1A.6==1) //priznak vysilani dokonceno a v bufferu nejsou data k odeslani
;	*p_TestData -> Y+1
;	count -> Y+0
	SBIC 0x2,6
; 0002 0016     {
; 0002 0017         UCSR1A.6=1; //nuluje se nastavanim do logicke 1
	SBI  0x2,6
; 0002 0018     };
; 0002 0019 
; 0002 001A     UDR1 = *(p_TestData + count);  //nacti do UDR znak
	LD   R30,Y
	LDI  R31,0
	LDD  R26,Y+1
	LDD  R27,Y+1+1
	ADD  R26,R30
	ADC  R27,R31
	LD   R30,X
	OUT  0x3,R30
; 0002 001B     count++;
	LD   R30,Y
	SUBI R30,-LOW(1)
	ST   Y,R30
; 0002 001C     if(count > 9)
	LD   R26,Y
	CPI  R26,LOW(0xA)
	BRLO _0x40012
; 0002 001D     {
; 0002 001E         count = 0;
	LDI  R30,LOW(0)
	ST   Y,R30
; 0002 001F     }
; 0002 0020     while (UCSR1A.6==0)  //dokud neni vysilani dokonceno
_0x40012:
_0x40013:
	SBIS 0x2,6
; 0002 0021     {
; 0002 0022     }
	RJMP _0x40013
; 0002 0023     //priznak vysilani dokonceno zustava nastaven
; 0002 0024     delay_ms(Wait_5ms);  //zpozdeni kvuli zpomaleni komunikace kvuli lepsimu debugu
	LDI  R30,LOW(5)
	LDI  R31,HIGH(5)
	ST   -Y,R31
	ST   -Y,R30
	CALL _delay_ms
; 0002 0025     return count;
	LD   R30,Y
	RJMP _0x2060003
; 0002 0026 }
;
;char XBeeEnterCommandMode (void)  //vstup do Command modu
; 0002 0029 {
_XBeeEnterCommandMode:
; 0002 002A     delay_ms(Wait_2s);  //cekani GuardTime 1000 ms
	LDI  R30,LOW(20)
	LDI  R31,HIGH(20)
	ST   -Y,R31
	ST   -Y,R30
	CALL _delay_ms
; 0002 002B     XBeeSendString (ENTER_COMMAND_MODE);  //vstup do command modu
	__POINTW1MN _0x40016,0
	ST   -Y,R31
	ST   -Y,R30
	RCALL _XBeeSendString
; 0002 002C     SREG.7 = 1;  //globalni povoleni preruseni
	BSET 7
; 0002 002D     delay_ms(Wait_1s);  //cekani GuardTime 1000 ms
	LDI  R30,LOW(10)
	LDI  R31,HIGH(10)
	ST   -Y,R31
	ST   -Y,R30
	CALL _delay_ms
; 0002 002E     return 0x00;
	LDI  R30,LOW(0)
	RET
; 0002 002F }

	.DSEG
_0x40016:
	.BYTE 0x4
;
;void XBeeSetBaudRate (char * retezec, char baudRateXBee)
; 0002 0032 {

	.CSEG
_XBeeSetBaudRate:
; 0002 0033     char mem = baudRateXBee;
; 0002 0034     switch (mem)
	ST   -Y,R17
;	*retezec -> Y+2
;	baudRateXBee -> Y+1
;	mem -> R17
	LDD  R17,Y+1
	MOV  R30,R17
	LDI  R31,0
; 0002 0035     {
; 0002 0036         case 0x00: mem = '0'; break;
	SBIW R30,0
	BRNE _0x4001A
	LDI  R17,LOW(48)
	RJMP _0x40019
; 0002 0037         case 0x01: mem = '1'; break;
_0x4001A:
	CPI  R30,LOW(0x1)
	LDI  R26,HIGH(0x1)
	CPC  R31,R26
	BRNE _0x4001B
	LDI  R17,LOW(49)
	RJMP _0x40019
; 0002 0038         case 0x02: mem = '2'; break;
_0x4001B:
	CPI  R30,LOW(0x2)
	LDI  R26,HIGH(0x2)
	CPC  R31,R26
	BRNE _0x4001C
	LDI  R17,LOW(50)
	RJMP _0x40019
; 0002 0039         case 0x03: mem = '3'; break;
_0x4001C:
	CPI  R30,LOW(0x3)
	LDI  R26,HIGH(0x3)
	CPC  R31,R26
	BRNE _0x4001D
	LDI  R17,LOW(51)
	RJMP _0x40019
; 0002 003A         case 0x04: mem = '4'; break;
_0x4001D:
	CPI  R30,LOW(0x4)
	LDI  R26,HIGH(0x4)
	CPC  R31,R26
	BRNE _0x4001E
	LDI  R17,LOW(52)
	RJMP _0x40019
; 0002 003B         case 0x05: mem = '5'; break;
_0x4001E:
	CPI  R30,LOW(0x5)
	LDI  R26,HIGH(0x5)
	CPC  R31,R26
	BRNE _0x4001F
	LDI  R17,LOW(53)
	RJMP _0x40019
; 0002 003C         case 0x06: mem = '6'; break;
_0x4001F:
	CPI  R30,LOW(0x6)
	LDI  R26,HIGH(0x6)
	CPC  R31,R26
	BRNE _0x40020
	LDI  R17,LOW(54)
	RJMP _0x40019
; 0002 003D         case 0x07: mem = '7'; break;
_0x40020:
	CPI  R30,LOW(0x7)
	LDI  R26,HIGH(0x7)
	CPC  R31,R26
	BRNE _0x40022
	LDI  R17,LOW(55)
; 0002 003E         default: break;
_0x40022:
; 0002 003F     }
_0x40019:
; 0002 0040     *(retezec + 0) = 'A';
	LDD  R26,Y+2
	LDD  R27,Y+2+1
	ADIW R26,0
	LDI  R30,LOW(65)
	ST   X,R30
; 0002 0041     *(retezec + 1) = 'T';
	LDD  R26,Y+2
	LDD  R27,Y+2+1
	ADIW R26,1
	LDI  R30,LOW(84)
	ST   X,R30
; 0002 0042     *(retezec + 2) = 'B';
	LDD  R26,Y+2
	LDD  R27,Y+2+1
	ADIW R26,2
	LDI  R30,LOW(66)
	ST   X,R30
; 0002 0043     *(retezec + 3) = 'D';
	LDD  R26,Y+2
	LDD  R27,Y+2+1
	ADIW R26,3
	LDI  R30,LOW(68)
	RJMP _0x2060006
; 0002 0044     *(retezec + 4) = ' ';
; 0002 0045     *(retezec + 5) = mem;
; 0002 0046     *(retezec + 6) = '\r';
; 0002 0047     *(retezec + 7) = NULL;
; 0002 0048 }
;
;void XBeeSetParity (char * retezec, char parityXBee)
; 0002 004B {
_XBeeSetParity:
; 0002 004C     char mem = parityXBee;
; 0002 004D     switch (mem)
	ST   -Y,R17
;	*retezec -> Y+2
;	parityXBee -> Y+1
;	mem -> R17
	LDD  R17,Y+1
	MOV  R30,R17
	LDI  R31,0
; 0002 004E     {
; 0002 004F         case 0x00: mem = '0'; break; //zadna parita
	SBIW R30,0
	BRNE _0x40026
	LDI  R17,LOW(48)
	RJMP _0x40025
; 0002 0050         case 0x01: mem = '1'; break; //suda parita
_0x40026:
	CPI  R30,LOW(0x1)
	LDI  R26,HIGH(0x1)
	CPC  R31,R26
	BRNE _0x40027
	LDI  R17,LOW(49)
	RJMP _0x40025
; 0002 0051         case 0x02: mem = '2'; break; //licha parita
_0x40027:
	CPI  R30,LOW(0x2)
	LDI  R26,HIGH(0x2)
	CPC  R31,R26
	BRNE _0x40029
	LDI  R17,LOW(50)
; 0002 0052         default: break;
_0x40029:
; 0002 0053     }
_0x40025:
; 0002 0054     *(retezec + 0) = 'A';
	LDD  R26,Y+2
	LDD  R27,Y+2+1
	ADIW R26,0
	LDI  R30,LOW(65)
	ST   X,R30
; 0002 0055     *(retezec + 1) = 'T';
	LDD  R26,Y+2
	LDD  R27,Y+2+1
	ADIW R26,1
	LDI  R30,LOW(84)
	ST   X,R30
; 0002 0056     *(retezec + 2) = 'N';
	LDD  R26,Y+2
	LDD  R27,Y+2+1
	ADIW R26,2
	LDI  R30,LOW(78)
	ST   X,R30
; 0002 0057     *(retezec + 3) = 'B';
	LDD  R26,Y+2
	LDD  R27,Y+2+1
	ADIW R26,3
	LDI  R30,LOW(66)
_0x2060006:
	ST   X,R30
; 0002 0058     *(retezec + 4) = ' ';
	LDD  R26,Y+2
	LDD  R27,Y+2+1
	ADIW R26,4
	LDI  R30,LOW(32)
	ST   X,R30
; 0002 0059     *(retezec + 5) = mem;
	LDD  R30,Y+2
	LDD  R31,Y+2+1
	__PUTBZR 17,5
; 0002 005A     *(retezec + 6) = '\r';
	LDD  R26,Y+2
	LDD  R27,Y+2+1
	ADIW R26,6
	LDI  R30,LOW(13)
	ST   X,R30
; 0002 005B     *(retezec + 7) = NULL;
	LDD  R26,Y+2
	LDD  R27,Y+2+1
	ADIW R26,7
	LDI  R30,LOW(0)
	ST   X,R30
; 0002 005C }
	LDD  R17,Y+0
	ADIW R28,4
	RET
;
;void XBeeSetUSARTParameters(char baudRateXBee, char parityXBee)
; 0002 005F {
_XBeeSetUSARTParameters:
; 0002 0060 
; 0002 0061     SREG.7 = 0;  //zakaz preruseni globalne
;	baudRateXBee -> Y+1
;	parityXBee -> Y+0
	BCLR 7
; 0002 0062     UCSR1B=0x00; // nastaveni hodnoty na 0b10011000 - preruseni od RXCIE, povolen vysilac a prijimac
	LDI  R30,LOW(0)
	OUT  0x1,R30
; 0002 0063 
; 0002 0064     switch(baudRateXBee)
	LDD  R30,Y+1
	LDI  R31,0
; 0002 0065     {
; 0002 0066         case 0: UBRR1H = BAUDRATE1200H; UBRR1L = BAUDRATE1200L; break;
	SBIW R30,0
	BRNE _0x4002D
	LDI  R30,LOW(2)
	OUT  0x3C,R30
	LDI  R30,LOW(64)
	OUT  0x0,R30
	RJMP _0x4002C
; 0002 0067         case 1: UBRR1H = BAUDRATE2400H; UBRR1L = BAUDRATE2400L; break;
_0x4002D:
	CPI  R30,LOW(0x1)
	LDI  R26,HIGH(0x1)
	CPC  R31,R26
	BRNE _0x4002E
	LDI  R30,LOW(1)
	OUT  0x3C,R30
	LDI  R30,LOW(31)
	OUT  0x0,R30
	RJMP _0x4002C
; 0002 0068         case 2: UBRR1H = BAUDRATE4800H; UBRR1L = BAUDRATE4800L; break;
_0x4002E:
	CPI  R30,LOW(0x2)
	LDI  R26,HIGH(0x2)
	CPC  R31,R26
	BRNE _0x4002F
	LDI  R30,LOW(0)
	OUT  0x3C,R30
	LDI  R30,LOW(143)
	OUT  0x0,R30
	RJMP _0x4002C
; 0002 0069         case 3: UBRR1H = BAUDRATE9600H; UBRR1L = BAUDRATE9600L; break;
_0x4002F:
	CPI  R30,LOW(0x3)
	LDI  R26,HIGH(0x3)
	CPC  R31,R26
	BRNE _0x40030
	LDI  R30,LOW(0)
	OUT  0x3C,R30
	LDI  R30,LOW(71)
	OUT  0x0,R30
	RJMP _0x4002C
; 0002 006A         case 4: UBRR1H = BAUDRATE19200H; UBRR1L = BAUDRATE19200L; break;
_0x40030:
	CPI  R30,LOW(0x4)
	LDI  R26,HIGH(0x4)
	CPC  R31,R26
	BRNE _0x40031
	LDI  R30,LOW(0)
	OUT  0x3C,R30
	LDI  R30,LOW(35)
	OUT  0x0,R30
	RJMP _0x4002C
; 0002 006B         case 5: UBRR1H = BAUDRATE38400H; UBRR1L = BAUDRATE38400L; break;
_0x40031:
	CPI  R30,LOW(0x5)
	LDI  R26,HIGH(0x5)
	CPC  R31,R26
	BRNE _0x40032
	LDI  R30,LOW(0)
	OUT  0x3C,R30
	LDI  R30,LOW(17)
	OUT  0x0,R30
	RJMP _0x4002C
; 0002 006C         case 6: UBRR1H = BAUDRATE57600H; UBRR1L = BAUDRATE57600L; break;
_0x40032:
	CPI  R30,LOW(0x6)
	LDI  R26,HIGH(0x6)
	CPC  R31,R26
	BRNE _0x40033
	LDI  R30,LOW(0)
	OUT  0x3C,R30
	LDI  R30,LOW(11)
	OUT  0x0,R30
	RJMP _0x4002C
; 0002 006D         case 7: UBRR1H = BAUDRATE115200H; UBRR1L = BAUDRATE115200L; break;
_0x40033:
	CPI  R30,LOW(0x7)
	LDI  R26,HIGH(0x7)
	CPC  R31,R26
	BRNE _0x40035
	LDI  R30,LOW(0)
	OUT  0x3C,R30
	LDI  R30,LOW(5)
	OUT  0x0,R30
; 0002 006E         default: break;
_0x40035:
; 0002 006F     }
_0x4002C:
; 0002 0070 
; 0002 0071     /*//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! NEFUNGUJE
; 0002 0072     switch(parityXBee)
; 0002 0073     {
; 0002 0074         case 0: UCSR1C = (1<<URSEL1); break;  //zadna parita
; 0002 0075         case 1: UCSR1C = (1<<URSEL1)|(1<<UPM11); break;  //suda parita
; 0002 0076         case 2: UCSR1C = (1<<URSEL1)|(1<<UPM11)|(1<<UPM10); break;  //licha parita
; 0002 0077         default: break;
; 0002 0078     }
; 0002 0079     UCSR1C = UCSR1C & 0b01111111;  //vynulovani bitu URSEL
; 0002 007A     *///!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! NEFUNGUJE
; 0002 007B 
; 0002 007C     UCSR1B=0x98; // nastaveni hodnoty na 0b10011000 - preruseni od RXCIE, povolen vysilac a prijimac
	LDI  R30,LOW(152)
	OUT  0x1,R30
; 0002 007D     delay_ms(10);
	RJMP _0x2060005
; 0002 007E     SREG.7 = 1;  //povoleni globalniho preruseni
; 0002 007F 
; 0002 0080 }
;
;void SensorSetUSARTParameters(char baudRateSensor, char paritySensor)
; 0002 0083 {
_SensorSetUSARTParameters:
; 0002 0084     SREG.7 = 0;  //zakaz preruseni globalne
;	baudRateSensor -> Y+1
;	paritySensor -> Y+0
	BCLR 7
; 0002 0085     UCSR0B=0x00; // nastaveni hodnoty na 0b10011000 - preruseni od RXCIE, povolen vysilac a prijimac
	LDI  R30,LOW(0)
	OUT  0xA,R30
; 0002 0086 
; 0002 0087     switch(baudRateSensor)
	LDD  R30,Y+1
	LDI  R31,0
; 0002 0088     {
; 0002 0089         case 0: UBRR0H = BAUDRATE1200H; UBRR0L = BAUDRATE1200L; break;
	SBIW R30,0
	BRNE _0x40039
	LDI  R30,LOW(2)
	OUT  0x20,R30
	LDI  R30,LOW(64)
	OUT  0x9,R30
	RJMP _0x40038
; 0002 008A         case 1: UBRR0H = BAUDRATE2400H; UBRR0L = BAUDRATE2400L; break;
_0x40039:
	CPI  R30,LOW(0x1)
	LDI  R26,HIGH(0x1)
	CPC  R31,R26
	BRNE _0x4003A
	LDI  R30,LOW(1)
	OUT  0x20,R30
	LDI  R30,LOW(31)
	OUT  0x9,R30
	RJMP _0x40038
; 0002 008B         case 2: UBRR0H = BAUDRATE4800H; UBRR0L = BAUDRATE4800L; break;
_0x4003A:
	CPI  R30,LOW(0x2)
	LDI  R26,HIGH(0x2)
	CPC  R31,R26
	BRNE _0x4003B
	LDI  R30,LOW(0)
	OUT  0x20,R30
	LDI  R30,LOW(143)
	OUT  0x9,R30
	RJMP _0x40038
; 0002 008C         case 3: UBRR0H = BAUDRATE9600H; UBRR0L = BAUDRATE9600L; break;
_0x4003B:
	CPI  R30,LOW(0x3)
	LDI  R26,HIGH(0x3)
	CPC  R31,R26
	BRNE _0x4003C
	LDI  R30,LOW(0)
	OUT  0x20,R30
	LDI  R30,LOW(71)
	OUT  0x9,R30
	RJMP _0x40038
; 0002 008D         case 4: UBRR0H = BAUDRATE19200H; UBRR0L = BAUDRATE19200L; break;
_0x4003C:
	CPI  R30,LOW(0x4)
	LDI  R26,HIGH(0x4)
	CPC  R31,R26
	BRNE _0x4003D
	LDI  R30,LOW(0)
	OUT  0x20,R30
	LDI  R30,LOW(35)
	OUT  0x9,R30
	RJMP _0x40038
; 0002 008E         case 5: UBRR0H = BAUDRATE38400H; UBRR0L = BAUDRATE38400L; break;
_0x4003D:
	CPI  R30,LOW(0x5)
	LDI  R26,HIGH(0x5)
	CPC  R31,R26
	BRNE _0x4003E
	LDI  R30,LOW(0)
	OUT  0x20,R30
	LDI  R30,LOW(17)
	OUT  0x9,R30
	RJMP _0x40038
; 0002 008F         case 6: UBRR0H = BAUDRATE57600H; UBRR0L = BAUDRATE57600L; break;
_0x4003E:
	CPI  R30,LOW(0x6)
	LDI  R26,HIGH(0x6)
	CPC  R31,R26
	BRNE _0x4003F
	LDI  R30,LOW(0)
	OUT  0x20,R30
	LDI  R30,LOW(11)
	OUT  0x9,R30
	RJMP _0x40038
; 0002 0090         case 7: UBRR0H = BAUDRATE115200H; UBRR0L = BAUDRATE115200L; break;
_0x4003F:
	CPI  R30,LOW(0x7)
	LDI  R26,HIGH(0x7)
	CPC  R31,R26
	BRNE _0x40041
	LDI  R30,LOW(0)
	OUT  0x20,R30
	LDI  R30,LOW(5)
	OUT  0x9,R30
; 0002 0091         default: break;
_0x40041:
; 0002 0092     }
_0x40038:
; 0002 0093 
; 0002 0094     /*//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! NEFUNGUJE
; 0002 0095     switch(parityXBee)
; 0002 0096     {
; 0002 0097         case 0: UCSR0C = (1<<URSEL0); break;  //zadna parita
; 0002 0098         case 1: UCSR0C = (1<<URSEL0)|(1<<UPM01); break;  //suda parita
; 0002 0099         case 2: UCSR0C = (1<<URSEL0)|(1<<UPM01)|(1<<UPM00); break;  //licha parita
; 0002 009A         default: break;
; 0002 009B     }
; 0002 009C     UCSR0C = UCSR0C & 0b01111111;  //vynulovani bitu URSEL
; 0002 009D     *///!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! NEFUNGUJE
; 0002 009E 
; 0002 009F     UCSR0B=0x98; // nastaveni hodnoty na 0b10011000 - preruseni od RXCIE, povolen vysilac a prijimac
	LDI  R30,LOW(152)
	OUT  0xA,R30
; 0002 00A0     delay_ms(10);
_0x2060005:
	LDI  R30,LOW(10)
	LDI  R31,HIGH(10)
	ST   -Y,R31
	ST   -Y,R30
	CALL _delay_ms
; 0002 00A1     SREG.7 = 1;  //povoleni globalniho preruseni
	BSET 7
; 0002 00A2 }
	ADIW R28,2
	RET
;
;
;char XBeeSendString (char * string)  //funkce posilajici string na port XBee
; 0002 00A6 {
_XBeeSendString:
; 0002 00A7     char count = 0;
; 0002 00A8     if(UCSR1A.6==1) //priznak vysilani dokonceno
	ST   -Y,R17
;	*string -> Y+1
;	count -> R17
	LDI  R17,0
	SBIC 0x2,6
; 0002 00A9     {
; 0002 00AA         UCSR1A.6=1; //nuluje se nastavanim do logicke 1
	SBI  0x2,6
; 0002 00AB     };
; 0002 00AC     while (*(string + count) != NULL)  //dokud neni znak ve stringu roven NULL
_0x40045:
	MOV  R30,R17
	LDI  R31,0
	LDD  R26,Y+1
	LDD  R27,Y+1+1
	ADD  R26,R30
	ADC  R27,R31
	LD   R30,X
	CPI  R30,0
	BREQ _0x40047
; 0002 00AD     {
; 0002 00AE         UDR1 = *(string + count);  //nacti do UDR znak
	MOV  R30,R17
	LDI  R31,0
	LDD  R26,Y+1
	LDD  R27,Y+1+1
	ADD  R26,R30
	ADC  R27,R31
	LD   R30,X
	OUT  0x3,R30
; 0002 00AF         count++;
	SUBI R17,-1
; 0002 00B0         while (UCSR1A.6==0)  //dokud neni vysilani dokonceno
_0x40048:
	SBIS 0x2,6
; 0002 00B1         {
; 0002 00B2         }
	RJMP _0x40048
; 0002 00B3         if(*(string + count) != NULL)  //necha nastaven priznak vysilani dokonceno po ukonceni prenosu dat
	MOV  R30,R17
	LDI  R31,0
	LDD  R26,Y+1
	LDD  R27,Y+1+1
	ADD  R26,R30
	ADC  R27,R31
	LD   R30,X
	CPI  R30,0
	BREQ _0x4004B
; 0002 00B4         {
; 0002 00B5             UCSR1A.6=1;  //vynuluj priznak vysilani dokonceno
	SBI  0x2,6
; 0002 00B6         }
; 0002 00B7     };
_0x4004B:
	RJMP _0x40045
_0x40047:
; 0002 00B8     return 0x00;
	LDI  R30,LOW(0)
_0x2060004:
	LDD  R17,Y+0
_0x2060003:
	ADIW R28,3
	RET
; 0002 00B9 }
;
;char XBeeUdrRecieve (void)  //cte hodnotu prijatych dat jednotkou USART1
; 0002 00BC {
_XBeeUdrRecieve:
; 0002 00BD     return UDR1;
	IN   R30,0x3
	RET
; 0002 00BE }
;
;char SensorUdrRecieve (void)  //cte hodnotu prijatych dat jednotkou USART1
; 0002 00C1 {
_SensorUdrRecieve:
; 0002 00C2     return UDR0;
	IN   R30,0xC
	RET
; 0002 00C3 }
;
;void XBeeUsartRecieve(char * p_programMemory, char * p_switchMemory, char * p_baudRateXBee, char * p_parityXBee, char * p_baudRateSensor, char * p_paritySensor, char * p_memory, char * p_stackForSensor, char * p_countStackForSensor)
; 0002 00C6 {
_XBeeUsartRecieve:
; 0002 00C7     char symbol;
; 0002 00C8     symbol = XBeeUdrRecieve();
	ST   -Y,R17
;	*p_programMemory -> Y+17
;	*p_switchMemory -> Y+15
;	*p_baudRateXBee -> Y+13
;	*p_parityXBee -> Y+11
;	*p_baudRateSensor -> Y+9
;	*p_paritySensor -> Y+7
;	*p_memory -> Y+5
;	*p_stackForSensor -> Y+3
;	*p_countStackForSensor -> Y+1
;	symbol -> R17
	RCALL _XBeeUdrRecieve
	MOV  R17,R30
; 0002 00C9 
; 0002 00CA     if(*(p_programMemory) < 6)
	LDD  R26,Y+17
	LDD  R27,Y+17+1
	LD   R26,X
	CPI  R26,LOW(0x6)
	BRSH _0x4004E
; 0002 00CB     {
; 0002 00CC         XBeeUsartRecieveConfirm(p_programMemory, p_switchMemory, p_memory, symbol);
	LDD  R30,Y+17
	LDD  R31,Y+17+1
	ST   -Y,R31
	ST   -Y,R30
	LDD  R30,Y+17
	LDD  R31,Y+17+1
	ST   -Y,R31
	ST   -Y,R30
	LDD  R30,Y+9
	LDD  R31,Y+9+1
	ST   -Y,R31
	ST   -Y,R30
	ST   -Y,R17
	RCALL _XBeeUsartRecieveConfirm
; 0002 00CD     }
; 0002 00CE     else
	RJMP _0x4004F
_0x4004E:
; 0002 00CF     {
; 0002 00D0         XBeeUsartRecieveData(p_programMemory, p_switchMemory, p_baudRateXBee, p_parityXBee, p_baudRateSensor, p_paritySensor, p_stackForSensor, p_countStackForSensor, symbol);
	LDD  R30,Y+17
	LDD  R31,Y+17+1
	ST   -Y,R31
	ST   -Y,R30
	LDD  R30,Y+17
	LDD  R31,Y+17+1
	ST   -Y,R31
	ST   -Y,R30
	LDD  R30,Y+17
	LDD  R31,Y+17+1
	ST   -Y,R31
	ST   -Y,R30
	LDD  R30,Y+17
	LDD  R31,Y+17+1
	ST   -Y,R31
	ST   -Y,R30
	LDD  R30,Y+17
	LDD  R31,Y+17+1
	ST   -Y,R31
	ST   -Y,R30
	LDD  R30,Y+17
	LDD  R31,Y+17+1
	ST   -Y,R31
	ST   -Y,R30
	LDD  R30,Y+15
	LDD  R31,Y+15+1
	ST   -Y,R31
	ST   -Y,R30
	LDD  R30,Y+15
	LDD  R31,Y+15+1
	ST   -Y,R31
	ST   -Y,R30
	ST   -Y,R17
	RCALL _XBeeUsartRecieveData
; 0002 00D1     }
_0x4004F:
; 0002 00D2 }
	LDD  R17,Y+0
	ADIW R28,19
	RET
;
;void XBeeUsartRecieveConfirm(char * p_programMemory, char * p_switchMemory, char * p_memory, char symbol)
; 0002 00D5 {
_XBeeUsartRecieveConfirm:
; 0002 00D6     if(*(p_programMemory)<6)  //probiha nastaveni parametru komunikace XBee
;	*p_programMemory -> Y+5
;	*p_switchMemory -> Y+3
;	*p_memory -> Y+1
;	symbol -> Y+0
	LDD  R26,Y+5
	LDD  R27,Y+5+1
	LD   R26,X
	CPI  R26,LOW(0x6)
	BRLO PC+3
	JMP _0x40050
; 0002 00D7     {
; 0002 00D8         switch (symbol)
	LD   R30,Y
	LDI  R31,0
; 0002 00D9         {
; 0002 00DA             case 'O': (*(p_memory))++; break;  //XBee modul odpovi "O"
	CPI  R30,LOW(0x4F)
	LDI  R26,HIGH(0x4F)
	CPC  R31,R26
	BRNE _0x40054
	LDD  R26,Y+1
	LDD  R27,Y+1+1
	LD   R30,X
	SUBI R30,-LOW(1)
	ST   X,R30
	RJMP _0x40053
; 0002 00DB             case 'K': (*(p_memory))++; break;  //XBee modul odpovi "K"
_0x40054:
	CPI  R30,LOW(0x4B)
	LDI  R26,HIGH(0x4B)
	CPC  R31,R26
	BRNE _0x40055
	LDD  R26,Y+1
	LDD  R27,Y+1+1
	LD   R30,X
	SUBI R30,-LOW(1)
	ST   X,R30
	RJMP _0x40053
; 0002 00DC             case 'E': (*(p_memory))++; break;  //XBee modul odpovi "E"
_0x40055:
	CPI  R30,LOW(0x45)
	LDI  R26,HIGH(0x45)
	CPC  R31,R26
	BRNE _0x40056
	LDD  R26,Y+1
	LDD  R27,Y+1+1
	LD   R30,X
	SUBI R30,-LOW(1)
	ST   X,R30
	RJMP _0x40053
; 0002 00DD             case 'R': (*(p_memory))++; break;  //XBee modul odpovi "R"
_0x40056:
	CPI  R30,LOW(0x52)
	LDI  R26,HIGH(0x52)
	CPC  R31,R26
	BRNE _0x40057
	LDD  R26,Y+1
	LDD  R27,Y+1+1
	LD   R30,X
	SUBI R30,-LOW(1)
	ST   X,R30
	RJMP _0x40053
; 0002 00DE             case 0x0D:                  //XBee modul odpovi "\r"
_0x40057:
	CPI  R30,LOW(0xD)
	LDI  R26,HIGH(0xD)
	CPC  R31,R26
	BRNE _0x4005B
; 0002 00DF             {
; 0002 00E0                 if(*(p_memory) == 2)  //je v poradku odpovezeno OK\r, program pokracuje dale
	LDD  R26,Y+1
	LDD  R27,Y+1+1
	LD   R26,X
	CPI  R26,LOW(0x2)
	BRNE _0x40059
; 0002 00E1                 {
; 0002 00E2                     (*(p_programMemory))++;
	LDD  R26,Y+5
	LDD  R27,Y+5+1
	LD   R30,X
	SUBI R30,-LOW(1)
	ST   X,R30
; 0002 00E3                     (*(p_switchMemory)) = (*(p_programMemory));
	LDD  R26,Y+3
	LDD  R27,Y+3+1
	ST   X,R30
; 0002 00E4                     *(p_memory) = 0;
	LDD  R26,Y+1
	LDD  R27,Y+1+1
	LDI  R30,LOW(0)
	RJMP _0x400B3
; 0002 00E5                 }
; 0002 00E6                 else  //prisla odpoved ERROR\r, program XBee bude restartovan
_0x40059:
; 0002 00E7                 {
; 0002 00E8                     PORTC = 0xFF;
	LDI  R30,LOW(255)
	OUT  0x15,R30
; 0002 00E9                     delay_ms(Wait_5s);
	LDI  R30,LOW(50)
	LDI  R31,HIGH(50)
	ST   -Y,R31
	ST   -Y,R30
	CALL _delay_ms
; 0002 00EA                     PORTC = 0x00;
	LDI  R30,LOW(0)
	OUT  0x15,R30
; 0002 00EB                     delay_ms(Wait_5s);
	LDI  R30,LOW(50)
	LDI  R31,HIGH(50)
	ST   -Y,R31
	ST   -Y,R30
	CALL _delay_ms
; 0002 00EC                     PORTC = 0xFF;
	LDI  R30,LOW(255)
	OUT  0x15,R30
; 0002 00ED                     *(p_programMemory) = 0x01;
	LDD  R26,Y+5
	LDD  R27,Y+5+1
	LDI  R30,LOW(1)
	ST   X,R30
; 0002 00EE                     *(p_switchMemory) = 0x01;
	LDD  R26,Y+3
	LDD  R27,Y+3+1
_0x400B3:
	ST   X,R30
; 0002 00EF                 }
; 0002 00F0                 break;
; 0002 00F1             }
; 0002 00F2             default: break;
_0x4005B:
; 0002 00F3         }
_0x40053:
; 0002 00F4         if(*(p_programMemory) == 1)
	LDD  R26,Y+5
	LDD  R27,Y+5+1
	LD   R26,X
	CPI  R26,LOW(0x1)
	BREQ _0x4005D
; 0002 00F5         {
; 0002 00F6 
; 0002 00F7         }
; 0002 00F8         else if(*(p_programMemory) == 2)
	LDD  R26,Y+5
	LDD  R27,Y+5+1
	LD   R26,X
	CPI  R26,LOW(0x2)
	BRNE _0x4005E
; 0002 00F9         {
; 0002 00FA             setPORTC_LED(0x01);
	LDI  R30,LOW(1)
	ST   -Y,R30
	RCALL _setPORTC_LED
; 0002 00FB         }
; 0002 00FC         else if(*(p_programMemory) == 3)
	RJMP _0x4005F
_0x4005E:
	LDD  R26,Y+5
	LDD  R27,Y+5+1
	LD   R26,X
	CPI  R26,LOW(0x3)
	BRNE _0x40060
; 0002 00FD         {
; 0002 00FE             setPORTC_LED(0x02);
	LDI  R30,LOW(2)
	ST   -Y,R30
	RCALL _setPORTC_LED
; 0002 00FF         }
; 0002 0100         else if(*(p_programMemory) == 4)
	RJMP _0x40061
_0x40060:
	LDD  R26,Y+5
	LDD  R27,Y+5+1
	LD   R26,X
	CPI  R26,LOW(0x4)
	BRNE _0x40062
; 0002 0101         {
; 0002 0102             setPORTC_LED(0x03);
	LDI  R30,LOW(3)
	ST   -Y,R30
	RCALL _setPORTC_LED
; 0002 0103         }
; 0002 0104         else if(*(p_programMemory) == 5)
	RJMP _0x40063
_0x40062:
	LDD  R26,Y+5
	LDD  R27,Y+5+1
	LD   R26,X
	CPI  R26,LOW(0x5)
	BRNE _0x40064
; 0002 0105         {
; 0002 0106             setPORTC_LED(0x04);
	LDI  R30,LOW(4)
	ST   -Y,R30
	RCALL _setPORTC_LED
; 0002 0107         }
; 0002 0108         else if(*(p_programMemory) == 6)
	RJMP _0x40065
_0x40064:
	LDD  R26,Y+5
	LDD  R27,Y+5+1
	LD   R26,X
	CPI  R26,LOW(0x6)
	BRNE _0x40066
; 0002 0109         {
; 0002 010A             setPORTC_LED(0x05);
	LDI  R30,LOW(5)
	ST   -Y,R30
	RCALL _setPORTC_LED
; 0002 010B             *(p_switchMemory) = 0x00;  //nicdelajici cykus
	LDD  R26,Y+3
	LDD  R27,Y+3+1
	LDI  R30,LOW(0)
	ST   X,R30
; 0002 010C         }
; 0002 010D     }
_0x40066:
_0x40065:
_0x40063:
_0x40061:
_0x4005F:
_0x4005D:
; 0002 010E }
_0x40050:
	ADIW R28,7
	RET
;
;void XBeeUsartRecieveData(char * p_programMemory, char * p_switchMemory, char * p_baudRateXBee, char * p_parityXBee, char * p_baudRateSensor, char * p_paritySensor, char * p_stackForSensor, char * p_countStackForSensor, char symbol)
; 0002 0111 {
_XBeeUsartRecieveData:
; 0002 0112     switch(*(p_programMemory))
;	*p_programMemory -> Y+15
;	*p_switchMemory -> Y+13
;	*p_baudRateXBee -> Y+11
;	*p_parityXBee -> Y+9
;	*p_baudRateSensor -> Y+7
;	*p_paritySensor -> Y+5
;	*p_stackForSensor -> Y+3
;	*p_countStackForSensor -> Y+1
;	symbol -> Y+0
	LDD  R26,Y+15
	LDD  R27,Y+15+1
	LD   R30,X
	LDI  R31,0
; 0002 0113     {
; 0002 0114         case 0x06: //resime zda-li prisla hlavicka, nahrada za znak hlavicky nebo data
	CPI  R30,LOW(0x6)
	LDI  R26,HIGH(0x6)
	CPC  R31,R26
	BRNE _0x4006A
; 0002 0115         {
; 0002 0116             if(symbol == 0xBB)  //prisla nahrada 0xAA nebo 0xBB
	LD   R26,Y
	CPI  R26,LOW(0xBB)
	BRNE _0x4006B
; 0002 0117             {
; 0002 0118                 *(p_switchMemory) = 0x00;  //nicdelajici cyklus
	LDD  R26,Y+13
	LDD  R27,Y+13+1
	LDI  R30,LOW(0)
	ST   X,R30
; 0002 0119                 *(p_programMemory) = 0x10;  //hodnota vyhodnocujici dalsi krok
	LDD  R26,Y+15
	LDD  R27,Y+15+1
	LDI  R30,LOW(16)
	ST   X,R30
; 0002 011A             }
; 0002 011B             else if(symbol == 0xAA)  //prisla hlavicka
	RJMP _0x4006C
_0x4006B:
	LD   R26,Y
	CPI  R26,LOW(0xAA)
	BRNE _0x4006D
; 0002 011C             {
; 0002 011D                 *(p_switchMemory) = 0x00;  //nicdelajici cyklus
	LDD  R26,Y+13
	LDD  R27,Y+13+1
	LDI  R30,LOW(0)
	ST   X,R30
; 0002 011E                 *(p_programMemory) = 0x11;  //hodnota vyhodnocujici dalsi krok
	LDD  R26,Y+15
	LDD  R27,Y+15+1
	LDI  R30,LOW(17)
	ST   X,R30
; 0002 011F             }
; 0002 0120             else
	RJMP _0x4006E
_0x4006D:
; 0002 0121             {
; 0002 0122                 //odesli na vystup nynejsi znak symbol
; 0002 0123                 SaveToStackForSensor(symbol, p_stackForSensor, p_countStackForSensor);
	LD   R30,Y
	ST   -Y,R30
	LDD  R30,Y+4
	LDD  R31,Y+4+1
	ST   -Y,R31
	ST   -Y,R30
	LDD  R30,Y+4
	LDD  R31,Y+4+1
	ST   -Y,R31
	ST   -Y,R30
	RCALL _SaveToStackForSensor
; 0002 0124             }
_0x4006E:
_0x4006C:
; 0002 0125             break;
	RJMP _0x40069
; 0002 0126         }
; 0002 0127 
; 0002 0128 
; 0002 0129         case 0x10:  //resime jestli prisla nahrada za 0xAA nebo za 0xBB
_0x4006A:
	CPI  R30,LOW(0x10)
	LDI  R26,HIGH(0x10)
	CPC  R31,R26
	BRNE _0x4006F
; 0002 012A         {
; 0002 012B             if(symbol == 0x55)  //byla to nahrada 0xBB znaky 0xBB55
	LD   R26,Y
	CPI  R26,LOW(0x55)
	BRNE _0x40070
; 0002 012C             {
; 0002 012D                 //na vystup odesli 0xBB
; 0002 012E                 SaveToStackForSensor(0xBB, p_stackForSensor, p_countStackForSensor);
	LDI  R30,LOW(187)
	RJMP _0x400B4
; 0002 012F             }
; 0002 0130             else  //byla to nahrada za 0xAA znakem 0xBB
_0x40070:
; 0002 0131             {
; 0002 0132                 //byla to nahrada 0xAA, na vystup odesli 0xAA a nynejsi znak symbol
; 0002 0133                 SaveToStackForSensor(0xAA, p_stackForSensor, p_countStackForSensor);
	LDI  R30,LOW(170)
	ST   -Y,R30
	LDD  R30,Y+4
	LDD  R31,Y+4+1
	ST   -Y,R31
	ST   -Y,R30
	LDD  R30,Y+4
	LDD  R31,Y+4+1
	ST   -Y,R31
	ST   -Y,R30
	RCALL _SaveToStackForSensor
; 0002 0134                 SaveToStackForSensor(symbol, p_stackForSensor, p_countStackForSensor);
	LD   R30,Y
_0x400B4:
	ST   -Y,R30
	LDD  R30,Y+4
	LDD  R31,Y+4+1
	ST   -Y,R31
	ST   -Y,R30
	LDD  R30,Y+4
	LDD  R31,Y+4+1
	ST   -Y,R31
	ST   -Y,R30
	RCALL _SaveToStackForSensor
; 0002 0135             }
; 0002 0136             *(p_programMemory) = 0x06;  //dalsi krok zavisi na hodnote symbol
	LDD  R26,Y+15
	LDD  R27,Y+15+1
	LDI  R30,LOW(6)
	ST   X,R30
; 0002 0137             break;
	RJMP _0x40069
; 0002 0138         }
; 0002 0139 
; 0002 013A         case 0x11:  //prisla hlavicka a resime co dal
_0x4006F:
	CPI  R30,LOW(0x11)
	LDI  R26,HIGH(0x11)
	CPC  R31,R26
	BRNE _0x40072
; 0002 013B         {
; 0002 013C             if(symbol == 0x01)  //nastaveni USART0
	LD   R26,Y
	CPI  R26,LOW(0x1)
	BRNE _0x40073
; 0002 013D             {
; 0002 013E                 *(p_programMemory) = 0x20;
	LDD  R26,Y+15
	LDD  R27,Y+15+1
	LDI  R30,LOW(32)
	ST   X,R30
; 0002 013F                 //XBeeSendString("Prenastavuji USART pripojeny k senzoru.");
; 0002 0140             }
; 0002 0141             else if(symbol == 0x02) //nastaveni USART1
	RJMP _0x40074
_0x40073:
	LD   R26,Y
	CPI  R26,LOW(0x2)
	BRNE _0x40075
; 0002 0142             {
; 0002 0143                 *(p_programMemory) = 0x30;
	LDD  R26,Y+15
	LDD  R27,Y+15+1
	LDI  R30,LOW(48)
	ST   X,R30
; 0002 0144                 //XBeeSendString("Prenastavuji USART pripojeny k XBee.");
; 0002 0145             }
; 0002 0146             else if(symbol == 0x03)  //zapnuti/vypnuti LED diod
	RJMP _0x40076
_0x40075:
	LD   R26,Y
	CPI  R26,LOW(0x3)
	BRNE _0x40077
; 0002 0147             {
; 0002 0148                 *(p_programMemory) = 0x40;
	LDD  R26,Y+15
	LDD  R27,Y+15+1
	LDI  R30,LOW(64)
	ST   X,R30
; 0002 0149                 //XBeeSendString("Menim nastaveni LED diod.");
; 0002 014A             }
; 0002 014B             else if(symbol == 0x04)  //posilej/neposilej testovaci data
	RJMP _0x40078
_0x40077:
	LD   R26,Y
	CPI  R26,LOW(0x4)
	BRNE _0x40079
; 0002 014C             {
; 0002 014D                 *(p_programMemory) = 0x50;
	LDD  R26,Y+15
	LDD  R27,Y+15+1
	LDI  R30,LOW(80)
	ST   X,R30
; 0002 014E             }
; 0002 014F             else if(symbol == 0x05)  //posilej/neposilej data ze senzoru prijatych v USART
	RJMP _0x4007A
_0x40079:
	LD   R26,Y
	CPI  R26,LOW(0x5)
	BRNE _0x4007B
; 0002 0150             {
; 0002 0151                 *(p_programMemory) = 0x60;
	LDD  R26,Y+15
	LDD  R27,Y+15+1
	LDI  R30,LOW(96)
	ST   X,R30
; 0002 0152             }
; 0002 0153             else if (symbol == 0x06)
	RJMP _0x4007C
_0x4007B:
	LD   R26,Y
	CPI  R26,LOW(0x6)
	BRNE _0x4007D
; 0002 0154             {
; 0002 0155                 *(p_programMemory) = 0x70;  //posilej/neposilej data ze senzoru prijatych v SPI
	LDD  R26,Y+15
	LDD  R27,Y+15+1
	LDI  R30,LOW(112)
	ST   X,R30
; 0002 0156             }
; 0002 0157             else if (symbol == 0x07)
	RJMP _0x4007E
_0x4007D:
	LD   R26,Y
	CPI  R26,LOW(0x7)
	BRNE _0x4007F
; 0002 0158             {
; 0002 0159                 *(p_programMemory) = 0x80;  //odesli vyslednou hodnotu Analogoveho komparatoru
	LDD  R26,Y+15
	LDD  R27,Y+15+1
	LDI  R30,LOW(128)
	ST   X,R30
; 0002 015A             }
; 0002 015B             else
_0x4007F:
; 0002 015C             {
; 0002 015D             }
_0x4007E:
_0x4007C:
_0x4007A:
_0x40078:
_0x40076:
_0x40074:
; 0002 015E             break;
	RJMP _0x40069
; 0002 015F         }
; 0002 0160 
; 0002 0161         case 0x20:  //prenastaveni USART0 pripojene k senzoru
_0x40072:
	CPI  R30,LOW(0x20)
	LDI  R26,HIGH(0x20)
	CPC  R31,R26
	BRNE _0x40081
; 0002 0162         {
; 0002 0163             if(symbol <= 0x07) //nastaveni baudRate USART0 jednotky pripojene k senzoru, rozmezi hodnot je 0-7
	LD   R26,Y
	CPI  R26,LOW(0x8)
	BRSH _0x40082
; 0002 0164             {
; 0002 0165                 *(p_baudRateSensor) = symbol;
	LD   R30,Y
	LDD  R26,Y+7
	LDD  R27,Y+7+1
	ST   X,R30
; 0002 0166                 *(p_programMemory) = 0x21;
	LDD  R26,Y+15
	LDD  R27,Y+15+1
	LDI  R30,LOW(33)
	ST   X,R30
; 0002 0167             }
; 0002 0168             else
	RJMP _0x40083
_0x40082:
; 0002 0169             {
; 0002 016A                XBeeSendString("ERROR");
	__POINTW1MN _0x40084,0
	ST   -Y,R31
	ST   -Y,R30
	RCALL _XBeeSendString
; 0002 016B             }
_0x40083:
; 0002 016C             break;
	RJMP _0x40069
; 0002 016D         }
; 0002 016E         case 0x21:  //prenastaveni USART0, parity
_0x40081:
	CPI  R30,LOW(0x21)
	LDI  R26,HIGH(0x21)
	CPC  R31,R26
	BRNE _0x40085
; 0002 016F         {
; 0002 0170             if(symbol <= 0x02) //nastaveni parityXBee, rozmezi hodnot je 0-2
	LD   R26,Y
	CPI  R26,LOW(0x3)
	BRSH _0x40086
; 0002 0171             {
; 0002 0172                 *(p_paritySensor) = symbol;
	LD   R30,Y
	LDD  R26,Y+5
	LDD  R27,Y+5+1
	ST   X,R30
; 0002 0173                 SensorSetUSARTParameters(*(p_baudRateSensor), *(p_paritySensor));
	LDD  R26,Y+7
	LDD  R27,Y+7+1
	LD   R30,X
	ST   -Y,R30
	LDD  R26,Y+6
	LDD  R27,Y+6+1
	LD   R30,X
	ST   -Y,R30
	RCALL _SensorSetUSARTParameters
; 0002 0174                 XBeeSendString("OK");  //nastaveni probehlo v poradku
	__POINTW1MN _0x40084,6
	ST   -Y,R31
	ST   -Y,R30
	RCALL _XBeeSendString
; 0002 0175                 *(p_programMemory) = 0x06;
	LDD  R26,Y+15
	LDD  R27,Y+15+1
	LDI  R30,LOW(6)
	ST   X,R30
; 0002 0176             }
; 0002 0177             else
	RJMP _0x40087
_0x40086:
; 0002 0178             {
; 0002 0179                XBeeSendString("ERROR");
	__POINTW1MN _0x40084,9
	ST   -Y,R31
	ST   -Y,R30
	RCALL _XBeeSendString
; 0002 017A             }
_0x40087:
; 0002 017B             break;
	RJMP _0x40069
; 0002 017C         }
; 0002 017D         case 0x30:  //prenastaveni USART1 pripojene k XBee
_0x40085:
	CPI  R30,LOW(0x30)
	LDI  R26,HIGH(0x30)
	CPC  R31,R26
	BRNE _0x40088
; 0002 017E         {
; 0002 017F             if(symbol <= 0x07) //nastaveni baudRate XBee, rozmezi hodnot je 0-7
	LD   R26,Y
	CPI  R26,LOW(0x8)
	BRSH _0x40089
; 0002 0180             {
; 0002 0181                 *(p_baudRateXBee) = symbol;
	LD   R30,Y
	LDD  R26,Y+11
	LDD  R27,Y+11+1
	ST   X,R30
; 0002 0182                 *(p_programMemory) = 0x31;
	LDD  R26,Y+15
	LDD  R27,Y+15+1
	LDI  R30,LOW(49)
	ST   X,R30
; 0002 0183             }
; 0002 0184             else
	RJMP _0x4008A
_0x40089:
; 0002 0185             {
; 0002 0186                XBeeSendString("ERROR");
	__POINTW1MN _0x40084,15
	ST   -Y,R31
	ST   -Y,R30
	RCALL _XBeeSendString
; 0002 0187             }
_0x4008A:
; 0002 0188             break;
	RJMP _0x40069
; 0002 0189         }
; 0002 018A         case 0x31:  //prenastaveni USART1, parity
_0x40088:
	CPI  R30,LOW(0x31)
	LDI  R26,HIGH(0x31)
	CPC  R31,R26
	BRNE _0x4008B
; 0002 018B         {
; 0002 018C             if(symbol <= 0x02) //nastaveni parity XBee, rozmezi hodnot je 0-2
	LD   R26,Y
	CPI  R26,LOW(0x3)
	BRSH _0x4008C
; 0002 018D             {
; 0002 018E                 *(p_parityXBee) = symbol;
	LD   R30,Y
	LDD  R26,Y+9
	LDD  R27,Y+9+1
	ST   X,R30
; 0002 018F                 PORTC = 0xFF;  //zhasnuti LED diod, roznou se po uspesnem nastaveni komunikace s XBee modulem
	LDI  R30,LOW(255)
	OUT  0x15,R30
; 0002 0190                 *(p_programMemory) = 0x01;
	LDD  R26,Y+15
	LDD  R27,Y+15+1
	LDI  R30,LOW(1)
	ST   X,R30
; 0002 0191                 *(p_switchMemory) = 0x01;
	LDD  R26,Y+13
	LDD  R27,Y+13+1
	ST   X,R30
; 0002 0192             }
; 0002 0193             else
	RJMP _0x4008D
_0x4008C:
; 0002 0194             {
; 0002 0195                XBeeSendString("ERROR");
	__POINTW1MN _0x40084,21
	ST   -Y,R31
	ST   -Y,R30
	RCALL _XBeeSendString
; 0002 0196             }
_0x4008D:
; 0002 0197             break;
	RJMP _0x40069
; 0002 0198         }
; 0002 0199         case 0x40:  //rozinani/zhasinani LED diod
_0x4008B:
	CPI  R30,LOW(0x40)
	LDI  R26,HIGH(0x40)
	CPC  R31,R26
	BRNE _0x4008E
; 0002 019A         {
; 0002 019B             if(symbol == 0x00)
	LD   R30,Y
	CPI  R30,0
	BRNE _0x4008F
; 0002 019C             {
; 0002 019D                 PORTC = 0x00;  //roznuti LED diod
	LDI  R30,LOW(0)
	OUT  0x15,R30
; 0002 019E                 XBeeSendString("OK");
	__POINTW1MN _0x40084,27
	RJMP _0x400B5
; 0002 019F                 *(p_programMemory) = 0x06;
; 0002 01A0             }
; 0002 01A1             else
_0x4008F:
; 0002 01A2             {
; 0002 01A3                 PORTC = 0xFF;  //zhasnuti LED diod
	LDI  R30,LOW(255)
	OUT  0x15,R30
; 0002 01A4                 XBeeSendString("OK");
	__POINTW1MN _0x40084,30
_0x400B5:
	ST   -Y,R31
	ST   -Y,R30
	RCALL _XBeeSendString
; 0002 01A5                 *(p_programMemory) = 0x06;
	LDD  R26,Y+15
	LDD  R27,Y+15+1
	LDI  R30,LOW(6)
	ST   X,R30
; 0002 01A6             }
; 0002 01A7             break;
	RJMP _0x40069
; 0002 01A8         }
; 0002 01A9         case 0x50:
_0x4008E:
	CPI  R30,LOW(0x50)
	LDI  R26,HIGH(0x50)
	CPC  R31,R26
	BRNE _0x40091
; 0002 01AA         {
; 0002 01AB             if(symbol == 0x00)  //start posilani testovacich dat
	LD   R30,Y
	CPI  R30,0
	BRNE _0x40092
; 0002 01AC             {
; 0002 01AD                 XBeeSendString("OK");
	__POINTW1MN _0x40084,33
	ST   -Y,R31
	ST   -Y,R30
	RCALL _XBeeSendString
; 0002 01AE                 *(p_programMemory) = 0x06;
	LDD  R26,Y+15
	LDD  R27,Y+15+1
	LDI  R30,LOW(6)
	ST   X,R30
; 0002 01AF                 *(p_switchMemory) = 0x06;
	LDD  R26,Y+13
	LDD  R27,Y+13+1
	RJMP _0x400B6
; 0002 01B0             }
; 0002 01B1             else
_0x40092:
; 0002 01B2             {
; 0002 01B3                 XBeeSendString("OK");  //konec posilani testovacich dat
	__POINTW1MN _0x40084,36
	ST   -Y,R31
	ST   -Y,R30
	RCALL _XBeeSendString
; 0002 01B4                 *(p_programMemory) = 0x06;
	LDD  R26,Y+15
	LDD  R27,Y+15+1
	LDI  R30,LOW(6)
	ST   X,R30
; 0002 01B5                 *(p_switchMemory) = 0x00;
	LDD  R26,Y+13
	LDD  R27,Y+13+1
	LDI  R30,LOW(0)
_0x400B6:
	ST   X,R30
; 0002 01B6             }
; 0002 01B7             break;
	RJMP _0x40069
; 0002 01B8         }
; 0002 01B9         case 0x60:  //preposilani dat ze sensoru do PC pripojenemu k USART jednotce
_0x40091:
	CPI  R30,LOW(0x60)
	LDI  R26,HIGH(0x60)
	CPC  R31,R26
	BRNE _0x40094
; 0002 01BA         {
; 0002 01BB             if(symbol == 0x00)  //posilej data ze senzoru prijatych v USART
	LD   R30,Y
	CPI  R30,0
	BRNE _0x40095
; 0002 01BC             {
; 0002 01BD                 SREG.7 = 0;
	BCLR 7
; 0002 01BE                 UCSR0B = (1<<RXCIE0)|(1<<RXEN0)|(1<<TXEN0);
	LDI  R30,LOW(152)
	OUT  0xA,R30
; 0002 01BF                 delay_ms(Wait_10ms);
	LDI  R30,LOW(10)
	LDI  R31,HIGH(10)
	ST   -Y,R31
	ST   -Y,R30
	CALL _delay_ms
; 0002 01C0                 SREG.7 = 1;
	BSET 7
; 0002 01C1                 XBeeSendString("OK");
	__POINTW1MN _0x40084,39
	RJMP _0x400B7
; 0002 01C2                 *(p_programMemory) = 0x06;
; 0002 01C3             }
; 0002 01C4             else  //neposilej data ze senzoru prijatych v USART
_0x40095:
; 0002 01C5             {
; 0002 01C6                 SREG.7 = 0;
	BCLR 7
; 0002 01C7                 UCSR0B = (0<<RXCIE0)|(1<<RXEN0)|(1<<TXEN0);
	LDI  R30,LOW(24)
	OUT  0xA,R30
; 0002 01C8                 delay_ms(Wait_10ms);
	LDI  R30,LOW(10)
	LDI  R31,HIGH(10)
	ST   -Y,R31
	ST   -Y,R30
	CALL _delay_ms
; 0002 01C9                 SREG.7 = 1;
	BSET 7
; 0002 01CA                 XBeeSendString("OK");
	__POINTW1MN _0x40084,42
_0x400B7:
	ST   -Y,R31
	ST   -Y,R30
	RCALL _XBeeSendString
; 0002 01CB                 *(p_programMemory) = 0x06;
	LDD  R26,Y+15
	LDD  R27,Y+15+1
	LDI  R30,LOW(6)
	ST   X,R30
; 0002 01CC             }
; 0002 01CD             break;
	RJMP _0x40069
; 0002 01CE         }
; 0002 01CF         case 0x70:  //preposilani dat ze senzoru do PC pripojenemu k SPI jednotce
_0x40094:
	CPI  R30,LOW(0x70)
	LDI  R26,HIGH(0x70)
	CPC  R31,R26
	BRNE _0x40097
; 0002 01D0         {
; 0002 01D1             if(symbol == 0x00)  //posilej data ze senzoru prijatych v SPI
	LD   R30,Y
	CPI  R30,0
	BRNE _0x40098
; 0002 01D2             {
; 0002 01D3                 SPCR = (1<<SPIE)|(1<<SPE)|(1<<MSTR);  //povoleni preruseni a zapnuti SPI periferie
	LDI  R30,LOW(208)
	RJMP _0x400B8
; 0002 01D4 
; 0002 01D5             }
; 0002 01D6             else  //neposilej data ze senzoru prijatych v SPI
_0x40098:
; 0002 01D7             {
; 0002 01D8                 SPCR = (0<<SPIE)|(1<<SPE)|(1<<MSTR);  //zakaz preruseni a zapnuti SPI periferie
	LDI  R30,LOW(80)
_0x400B8:
	OUT  0xD,R30
; 0002 01D9             }
; 0002 01DA             *(p_programMemory) = 0x71;
	LDD  R26,Y+15
	LDD  R27,Y+15+1
	LDI  R30,LOW(113)
	ST   X,R30
; 0002 01DB             break;
	RJMP _0x40069
; 0002 01DC         }
; 0002 01DD         case 0x71:
_0x40097:
	CPI  R30,LOW(0x71)
	LDI  R26,HIGH(0x71)
	CPC  R31,R26
	BRNE _0x4009A
; 0002 01DE         {
; 0002 01DF             if(symbol == 0x00)  //posilej data v rezimu LSB
	LD   R30,Y
	CPI  R30,0
	BRNE _0x4009B
; 0002 01E0             {
; 0002 01E1                 SPCR = SPCR | (1<<DORD);
	SBI  0xD,5
; 0002 01E2             }
; 0002 01E3             else  //posilej data v rezimu MSB
_0x4009B:
; 0002 01E4             {
; 0002 01E5                 //bit DORD = 0
; 0002 01E6             }
; 0002 01E7             *(p_programMemory) = 0x72;
	LDD  R26,Y+15
	LDD  R27,Y+15+1
	LDI  R30,LOW(114)
	ST   X,R30
; 0002 01E8             break;
	RJMP _0x40069
; 0002 01E9         }
; 0002 01EA         case 0x72:
_0x4009A:
	CPI  R30,LOW(0x72)
	LDI  R26,HIGH(0x72)
	CPC  R31,R26
	BRNE _0x4009D
; 0002 01EB         {
; 0002 01EC             if(symbol == 0x00)  //CPHA a CPOL = 0
	LD   R30,Y
	CPI  R30,0
	BREQ _0x4009F
; 0002 01ED             {
; 0002 01EE             }
; 0002 01EF             else if(symbol == 0x01)  //CPHA = 0 a CPOL = 1
	LD   R26,Y
	CPI  R26,LOW(0x1)
	BRNE _0x400A0
; 0002 01F0             {
; 0002 01F1                 SPCR = SPCR | (1<<CPOL);
	SBI  0xD,3
; 0002 01F2             }
; 0002 01F3             else if(symbol == 0x02)  //CPHA = 1 a CPOL = 0
	RJMP _0x400A1
_0x400A0:
	LD   R26,Y
	CPI  R26,LOW(0x2)
	BRNE _0x400A2
; 0002 01F4             {
; 0002 01F5                 SPCR = SPCR | (1<<CPHA);
	SBI  0xD,2
; 0002 01F6             }
; 0002 01F7             else  //CPHA = 1 a CPOL = 1
	RJMP _0x400A3
_0x400A2:
; 0002 01F8             {
; 0002 01F9                 SPCR = SPCR | (1<<CPHA) | (1<<CPOL);
	IN   R30,0xD
	ORI  R30,LOW(0xC)
	OUT  0xD,R30
; 0002 01FA             }
_0x400A3:
_0x400A1:
_0x4009F:
; 0002 01FB             *(p_programMemory) = 0x73;
	LDD  R26,Y+15
	LDD  R27,Y+15+1
	LDI  R30,LOW(115)
	ST   X,R30
; 0002 01FC             break;
	RJMP _0x40069
; 0002 01FD         }
; 0002 01FE         case 0x73:
_0x4009D:
	CPI  R30,LOW(0x73)
	LDI  R26,HIGH(0x73)
	CPC  R31,R26
	BRNE _0x400A4
; 0002 01FF         {
; 0002 0200             if(symbol == 0x00)  //rychlost SPI je frekvence krystalu / 4
	LD   R30,Y
	CPI  R30,0
	BREQ _0x400A6
; 0002 0201             {
; 0002 0202             }
; 0002 0203             else if(symbol == 0x01)  //rychlost SPI je frekvence krystalu / 16
	LD   R26,Y
	CPI  R26,LOW(0x1)
	BRNE _0x400A7
; 0002 0204             {
; 0002 0205                 SPCR = SPCR | (1<<SPR0);
	SBI  0xD,0
; 0002 0206             }
; 0002 0207             else if(symbol == 0x02)  //rychlost SPI je frekvence krystalu / 64
	RJMP _0x400A8
_0x400A7:
	LD   R26,Y
	CPI  R26,LOW(0x2)
	BRNE _0x400A9
; 0002 0208             {
; 0002 0209                 SPCR = SPCR | (1<<SPR1);
	SBI  0xD,1
; 0002 020A             }
; 0002 020B             else  //rychlost SPI je frekvence krystalu / 128
	RJMP _0x400AA
_0x400A9:
; 0002 020C             {
; 0002 020D                 SPCR = SPCR | (1<<SPR1) | (1<<SPR0);
	IN   R30,0xD
	ORI  R30,LOW(0x3)
	OUT  0xD,R30
; 0002 020E             }
_0x400AA:
_0x400A8:
_0x400A6:
; 0002 020F             delay_ms(10);
	LDI  R30,LOW(10)
	LDI  R31,HIGH(10)
	ST   -Y,R31
	ST   -Y,R30
	CALL _delay_ms
; 0002 0210             XBeeSendString("OK");
	__POINTW1MN _0x40084,45
	ST   -Y,R31
	ST   -Y,R30
	RCALL _XBeeSendString
; 0002 0211             *(p_programMemory) = 0x06;
	LDD  R26,Y+15
	LDD  R27,Y+15+1
	LDI  R30,LOW(6)
	ST   X,R30
; 0002 0212             break;
	RJMP _0x40069
; 0002 0213         }
; 0002 0214         case 0x80:
_0x400A4:
	CPI  R30,LOW(0x80)
	LDI  R26,HIGH(0x80)
	CPC  R31,R26
	BRNE _0x400AE
; 0002 0215         {
; 0002 0216             if(ACO == 0)  //napati na baterii po pruchodu delickou napeti je vetsi nez referencni napeti
; 0002 0217             {             //baterie je dostatecne nabita
; 0002 0218                  XBeeSendString("HIGH");
; 0002 0219             }
; 0002 021A             else  //napati na baterii po pruchodu delickou napeti je mensi nez referencni napeti
; 0002 021B             {     //baterii je treba dobit
; 0002 021C                 XBeeSendString("LOW");
	__POINTW1MN _0x40084,53
_0x400B9:
	ST   -Y,R31
	ST   -Y,R30
	RCALL _XBeeSendString
; 0002 021D             }
; 0002 021E         }
; 0002 021F         default: break;
_0x400AE:
; 0002 0220     }
_0x40069:
; 0002 0221 
; 0002 0222 }
	ADIW R28,17
	RET

	.DSEG
_0x40084:
	.BYTE 0x39
;
;void SaveToStackForSensor(char symbol, char * p_stackForSensor, char * p_countStackForSensor)
; 0002 0225 {

	.CSEG
_SaveToStackForSensor:
; 0002 0226     *(p_stackForSensor + *(p_countStackForSensor)) = symbol;
;	symbol -> Y+4
;	*p_stackForSensor -> Y+2
;	*p_countStackForSensor -> Y+0
	LD   R26,Y
	LDD  R27,Y+1
	LD   R30,X
	LDI  R31,0
	LDD  R26,Y+2
	LDD  R27,Y+2+1
	ADD  R30,R26
	ADC  R31,R27
	LDD  R26,Y+4
	STD  Z+0,R26
; 0002 0227     (*(p_countStackForSensor))++;
	LD   R26,Y
	LDD  R27,Y+1
	LD   R30,X
	SUBI R30,-LOW(1)
	ST   X,R30
; 0002 0228     if(*(p_countStackForSensor) == 32)  //ochrana proti preteceni zasobniku
	LD   R26,X
	CPI  R26,LOW(0x20)
	BRNE _0x400AF
; 0002 0229     {
; 0002 022A         *(p_countStackForSensor) = 31;
	LD   R26,Y
	LDD  R27,Y+1
	LDI  R30,LOW(31)
	ST   X,R30
; 0002 022B     }
; 0002 022C }
_0x400AF:
	RJMP _0x2060002
;
;void SensorUsartRecieve(char * p_stackForPC, char * p_countStackForPC)
; 0002 022F {
_SensorUsartRecieve:
; 0002 0230     char symbol = SensorUdrRecieve();
; 0002 0231     *(p_stackForPC + *(p_countStackForPC)) = symbol;
	ST   -Y,R17
;	*p_stackForPC -> Y+3
;	*p_countStackForPC -> Y+1
;	symbol -> R17
	RCALL _SensorUdrRecieve
	MOV  R17,R30
	LDD  R26,Y+1
	LDD  R27,Y+1+1
	LD   R30,X
	LDI  R31,0
	LDD  R26,Y+3
	LDD  R27,Y+3+1
	ADD  R30,R26
	ADC  R31,R27
	ST   Z,R17
; 0002 0232     (*(p_countStackForPC))++;
	LDD  R26,Y+1
	LDD  R27,Y+1+1
	LD   R30,X
	SUBI R30,-LOW(1)
	ST   X,R30
; 0002 0233 
; 0002 0234     if(*(p_countStackForPC) == 32)  //ochrana proti preteceni zasobniku
	LD   R26,X
	CPI  R26,LOW(0x20)
	BRNE _0x400B0
; 0002 0235     {
; 0002 0236         *(p_countStackForPC) = 31;
	LDD  R26,Y+1
	LDD  R27,Y+1+1
	LDI  R30,LOW(31)
	ST   X,R30
; 0002 0237     }
; 0002 0238 }
_0x400B0:
	RJMP _0x2060001
;
;char SPIRecieve (void)
; 0002 023B {
_SPIRecieve:
; 0002 023C     return SPDR;
	IN   R30,0xF
	RET
; 0002 023D }
;
;void SensorSPIRecieve(char * p_stackForPC, char * p_countStackForPC)
; 0002 0240 {
_SensorSPIRecieve:
; 0002 0241     char symbol = SPIRecieve();
; 0002 0242     if(symbol == 'g')
	ST   -Y,R17
;	*p_stackForPC -> Y+3
;	*p_countStackForPC -> Y+1
;	symbol -> R17
	RCALL _SPIRecieve
	MOV  R17,R30
	CPI  R17,103
	BRNE _0x400B1
; 0002 0243     {
; 0002 0244         setPORTC_LED(0x01); //////////////////////////////////////////////////////////////////
	LDI  R30,LOW(1)
	ST   -Y,R30
	RCALL _setPORTC_LED
; 0002 0245     }
; 0002 0246     *(p_stackForPC + *(p_countStackForPC)) = symbol;
_0x400B1:
	LDD  R26,Y+1
	LDD  R27,Y+1+1
	LD   R30,X
	LDI  R31,0
	LDD  R26,Y+3
	LDD  R27,Y+3+1
	ADD  R30,R26
	ADC  R31,R27
	ST   Z,R17
; 0002 0247     (*(p_countStackForPC))++;
	LDD  R26,Y+1
	LDD  R27,Y+1+1
	LD   R30,X
	SUBI R30,-LOW(1)
	ST   X,R30
; 0002 0248 
; 0002 0249     if(*(p_countStackForPC) == 32)  //ochrana proti preteceni zasobniku
	LD   R26,X
	CPI  R26,LOW(0x20)
	BRNE _0x400B2
; 0002 024A     {
; 0002 024B         *(p_countStackForPC) = 31;
	LDD  R26,Y+1
	LDD  R27,Y+1+1
	LDI  R30,LOW(31)
	ST   X,R30
; 0002 024C     }
; 0002 024D }
_0x400B2:
_0x2060001:
	LDD  R17,Y+0
_0x2060002:
	ADIW R28,5
	RET
;
;
	#ifndef __SLEEP_DEFINED__
	#define __SLEEP_DEFINED__
	.EQU __se_bit=0x20
	.SET power_ctrl_reg=mcucr
	#endif

	.CSEG

	.CSEG

	.CSEG

	.DSEG
_stackForSensor:
	.BYTE 0x20
_stackForPC:
	.BYTE 0x20

	.CSEG

	.CSEG
_delay_ms:
	ld   r30,y+
	ld   r31,y+
	adiw r30,0
	breq __delay_ms1
__delay_ms0:
	__DELAY_USW 0xACD
	wdr
	sbiw r30,1
	brne __delay_ms0
__delay_ms1:
	ret

;END OF CODE MARKER
__END_OF_CODE:
