Servo

> Servo-controller-ATmega8.zip > mega8servo.asm, change: ,size:79176b

;CodeVisionAVR C Compiler V1.25.3 Standard
;(C) Copyright Pavel Haiduc, HP InfoTech s.r.l.
;
;Chip sort : ATmega8
;Program kind : Application
;Clock frequency : 11. MHz
;Memory mannequin : Small
;Optimize for : Size
;(s)printf features : int, width
;(s)scanf options : int, width
;External SRAM dimension : 0
;Data Stack measurement : 256 byte(s)
;Heap dimension : zero byte(s)
;Promote char to int : No
;char is unsigned : Yes
;eight bit enums : Yes
;Word align FLASH struct: No
;Enhanced core instructions : On
;Smart register allocation : On
;Automatic register allocation : On
#pragma AVRPART ADMIN PART_NAME ATmega8
#pragma AVRPART MEMORY PROG_FLASH #pragma AVRPART MEMORY EEPROM #pragma AVRPART MEMORY INT_SRAM SIZE #pragma AVRPART MEMORY INT_SRAM START_ADDR 0x .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 MCUCR=0x35
.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=R .EQU __se_bit=0x80
.EQU __sm_mask=0x70
.EQU __sm_adc_noise_red=0x10
.EQU __sm_powerdown=0x20
.EQU __sm_powersave=0x30
.EQU __sm_standby=0x60
.EQU __sm_ext_standby=0x .MACRO __CPD1N
CPI R30,LOW(@zero)
LDI R26,HIGH(@zero)
CPC R31,R26
LDI R26,BYTE3(@zero)
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(@zero)
CPC R24,R30
LDI R30,BYTE4(@zero)
CPC R25,R30
.ENDM
.MACRO __CPWRR
CP [email protected],[email protected]
CPC [email protected],[email protected]
.ENDM
.MACRO __CPWRN
CPI [email protected],LOW(@2)
LDI R30,HIGH(@2)
CPC [email protected],R30
.ENDM
.MACRO __ADDB1MN
SUBI R30,LOW([email protected](@1))
.ENDM
.MACRO __ADDB2MN
SUBI R26,LOW([email protected](@1))
.ENDM
.MACRO __ADDW1MN
SUBI R30,LOW([email protected](@1))
SBCI R31,HIGH([email protected](@1))
.ENDM
.MACRO __ADDW2MN
SUBI R26,LOW([email protected](@1))
SBCI R27,HIGH([email protected](@1))
.ENDM
.MACRO __ADDW1FN
SUBI R30,LOW(-2*@0-(@1))
SBCI R31,HIGH(-2*@zero-(@1))
.ENDM
.MACRO __ADDD1FN
SUBI R30,LOW(-2*@0-(@1))
SBCI R31,HIGH(-2*@zero-(@1))
SBCI R22,BYTE3(-2*@zero-(@1))
.ENDM
.MACRO __ADDD1N
SUBI R30,LOW([email protected])
SBCI R31,HIGH([email protected])
SBCI R22,BYTE3([email protected])
SBCI R23,BYTE4([email protected])
.ENDM
.MACRO __ADDD2N
SUBI R26,LOW([email protected])
SBCI R27,HIGH([email protected])
SBCI R24,BYTE3([email protected])
SBCI R25,BYTE4([email protected])
.ENDM
.MACRO __SUBD1N
SUBI R30,LOW(@zero)
SBCI R31,HIGH(@zero)
SBCI R22,BYTE3(@zero)
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,@[email protected]
ANDI R30,LOW(@2)
STS @[email protected],R30
.ENDM
.MACRO __ANDWMNN
LDS R30,@[email protected]
ANDI R30,LOW(@2)
STS @[email protected],R30
LDS R30,@[email protected]+1
ANDI R30,HIGH(@2)
STS @[email protected]+1,R30
.ENDM
.MACRO __ANDD1N
ANDI R30,LOW(@zero)
ANDI R31,HIGH(@zero)
ANDI R22,BYTE3(@zero)
ANDI R23,BYTE4(@zero)
.ENDM
.MACRO __ORBMNN
LDS R30,@[email protected]
ORI R30,LOW(@2)
STS @[email protected],R30
.ENDM
.MACRO __ORWMNN
LDS R30,@[email protected]
ORI R30,LOW(@2)
STS @[email protected],R30
LDS R30,@[email protected]+1
ORI R30,HIGH(@2)
STS @[email protected]+1,R30
.ENDM
.MACRO __ORD1N
ORI R30,LOW(@0)
ORI R31,HIGH(@0)
ORI R22,BYTE3(@zero)
ORI R23,BYTE4(@zero)
.ENDM
.MACRO __DELAY_USB
LDI R24,LOW(@zero)
__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 __CLRD1S
LDI R30,zero
STD [email protected],R30
STD [email protected]+1,R30
STD [email protected]+2,R30
STD [email protected]+three,R30
.ENDM
.MACRO __GETD1S
LDD R30,[email protected]
LDD R31,[email protected]+1
LDD R22,[email protected]+2
LDD R23,[email protected]+3
.ENDM
.MACRO __PUTD1S
STD [email protected],R30
STD [email protected]+1,R31
STD [email protected]+2,R22
STD [email protected]+three,R23
.ENDM
.MACRO __PUTD2S
STD [email protected],R26
STD [email protected]+1,R27
STD [email protected]+2,R24
STD [email protected]+3,R25
.ENDM
.MACRO __POINTB1MN
LDI R30,LOW(@[email protected])
.ENDM
.MACRO __POINTW1MN
LDI R30,LOW(@[email protected])
LDI R31,HIGH(@[email protected])
.ENDM
.MACRO __POINTD1M
LDI R30,LOW(@zero)
LDI R31,HIGH(@zero)
LDI R22,BYTE3(@0)
.ENDM
.MACRO __POINTW1FN
LDI R30,LOW(2*@[email protected])
LDI R31,HIGH(2*@[email protected])
.ENDM
.MACRO __POINTD1FN
LDI R30,LOW(2*@[email protected])
LDI R31,HIGH(2*@[email protected])
LDI R22,BYTE3(2*@[email protected])
.ENDM
.MACRO __POINTB2MN
LDI R26,LOW(@[email protected])
.ENDM
.MACRO __POINTW2MN
LDI R26,LOW(@[email protected])
LDI R27,HIGH(@[email protected])
.ENDM
.MACRO __POINTBRM
LDI [email protected],LOW(@1)
.ENDM
.MACRO __POINTWRM
LDI [email protected],LOW(@2)
LDI [email protected],HIGH(@2)
.ENDM
.MACRO __POINTBRMN
LDI [email protected],LOW(@[email protected])
.ENDM
.MACRO __POINTWRMN
LDI [email protected],LOW(@[email protected])
LDI [email protected],HIGH(@[email protected])
.ENDM
.MACRO __POINTWRFN
LDI [email protected],LOW(@2*[email protected])
LDI [email protected],HIGH(@2*[email protected])
.ENDM
.MACRO __GETD1N
LDI R30,LOW(@zero)
LDI R31,HIGH(@0)
LDI R22,BYTE3(@0)
LDI R23,BYTE4(@zero)
.ENDM
.MACRO __GETD2N
LDI R26,LOW(@0)
LDI R27,HIGH(@zero)
LDI R24,BYTE3(@zero)
LDI R25,BYTE4(@zero)
.ENDM
.MACRO __GETD2S
LDD R26,[email protected]
LDD R27,[email protected]+1
LDD R24,[email protected]+2
LDD R25,[email protected]+three
.ENDM
.MACRO __GETB1MN
LDS R30,@[email protected]
.ENDM
.MACRO __GETB1HMN
LDS R31,@[email protected]
.ENDM
.MACRO __GETW1MN
LDS R30,@[email protected]
LDS R31,@[email protected]+1
.ENDM
.MACRO __GETD1MN
LDS R30,@[email protected]
LDS R31,@[email protected]+1
LDS R22,@[email protected]+2
LDS R23,@[email protected]+three
.ENDM
.MACRO __GETBRMN
LDS [email protected],@[email protected]
.ENDM
.MACRO __GETWRMN
LDS [email protected],@[email protected]
LDS [email protected],@[email protected]+1
.ENDM
.MACRO __GETWRZ
LDD [email protected],[email protected]
LDD [email protected],[email protected]+1
.ENDM
.MACRO __GETD2Z
LDD R26,[email protected]
LDD R27,[email protected]+1
LDD R24,[email protected]+2
LDD R25,[email protected]+3
.ENDM
.MACRO __GETB2MN
LDS R26,@[email protected]
.ENDM
.MACRO __GETW2MN
LDS R26,@[email protected]
LDS R27,@[email protected]+1
.ENDM
.MACRO __GETD2MN
LDS R26,@[email protected]
LDS R27,@[email protected]+1
LDS R24,@[email protected]+2
LDS R25,@[email protected]+3
.ENDM
.MACRO __PUTB1MN
STS @[email protected],R30
.ENDM
.MACRO __PUTW1MN
STS @[email protected],R30
STS @[email protected]+1,R31
.ENDM
.MACRO __PUTD1MN
STS @[email protected],R30
STS @[email protected]+1,R31
STS @[email protected]+2,R22
STS @[email protected]+three,R23
.ENDM
.MACRO __PUTBR0MN
STS @[email protected],R0
.ENDM
.MACRO __PUTDZ2
STD [email protected],R26
STD [email protected]+1,R27
STD [email protected]+2,R24
STD [email protected]+three,R25
.ENDM
.MACRO __PUTBMRN
STS @[email protected],[email protected]
.ENDM
.MACRO __PUTWMRN
STS @[email protected],[email protected]
STS @[email protected]+1,[email protected]
.ENDM
.MACRO __PUTBZR
STD [email protected],[email protected]
.ENDM
.MACRO __PUTWZR
STD [email protected],[email protected]
STD [email protected]+1,[email protected]
.ENDM
.MACRO __GETW1R
MOV R30,[email protected]
MOV R31,[email protected]
.ENDM
.MACRO __GETW2R
MOV R26,[email protected]
MOV R27,[email protected]
.ENDM
.MACRO __GETWRN
LDI [email protected],LOW(@2)
LDI [email protected],HIGH(@2)
.ENDM
.MACRO __PUTW1R
MOV [email protected],R30
MOV [email protected],R31
.ENDM
.MACRO __PUTW2R
MOV [email protected],R26
MOV [email protected],R27
.ENDM
.MACRO __ADDWRN
SUBI [email protected],LOW([email protected])
SBCI [email protected],HIGH([email protected])
.ENDM
.MACRO __ADDWRR
ADD [email protected],[email protected]
ADC [email protected],[email protected]
.ENDM
.MACRO __SUBWRN
SUBI [email protected],LOW(@2)
SBCI [email protected],HIGH(@2)
.ENDM
.MACRO __SUBWRR
SUB [email protected],[email protected]
SBC [email protected],[email protected]
.ENDM
.MACRO __ANDWRN
ANDI [email protected],LOW(@2)
ANDI [email protected],HIGH(@2)
.ENDM
.MACRO __ANDWRR
AND [email protected],[email protected]
AND [email protected],[email protected]
.ENDM
.MACRO __ORWRN
ORI [email protected],LOW(@2)
ORI [email protected],HIGH(@2)
.ENDM
.MACRO __ORWRR
OR [email protected],[email protected]
OR [email protected],[email protected]
.ENDM
.MACRO __EORWRR
EOR [email protected],[email protected]
EOR [email protected],[email protected]
.ENDM
.MACRO __GETWRS
LDD [email protected],[email protected]
LDD [email protected],[email protected]+1
.ENDM
.MACRO __PUTWSR
STD [email protected],[email protected]
STD [email protected]+1,[email protected]
.ENDM
.MACRO __MOVEWRR
MOV [email protected],[email protected]
MOV [email protected],[email protected]
.ENDM
.MACRO __INWR
IN [email protected],@2
IN [email protected],@2+1
.ENDM
.MACRO __OUTWR
OUT @2+1,[email protected]
OUT @2,[email protected]
.ENDM
.MACRO __CALL1MN
LDS R30,@[email protected]
LDS R31,@[email protected]+1
ICALL
.ENDM
.MACRO __CALL1FN
LDI R30,LOW(2*@[email protected])
LDI R31,HIGH(2*@[email protected])
RCALL __GETW1PF
ICALL
.ENDM
.MACRO __CALL2EN
LDI R26,LOW(@[email protected])
LDI R27,HIGH(@[email protected])
RCALL __EEPROMRDW
ICALL
.ENDM
.MACRO __GETW1STACK
IN R26,SPL
IN R27,SPH
ADIW R26,@zero+1
LD R30,X+
LD R31,X
.ENDM
.MACRO __NBST
BST [email protected],@1
IN R30,SREG
LDI R31,0x40
EOR R30,R31
OUT SREG,R30
.ENDM
.MACRO __PUTB1SN
LDD R26,[email protected]
LDD R27,[email protected]+1
SUBI R26,LOW([email protected])
SBCI R27,HIGH([email protected])
ST X,R30
.ENDM
.MACRO __PUTW1SN
LDD R26,[email protected]
LDD R27,[email protected]+1
SUBI R26,LOW([email protected])
SBCI R27,HIGH([email protected])
ST X+,R30
ST X,R31
.ENDM
.MACRO __PUTD1SN
LDD R26,[email protected]
LDD R27,[email protected]+1
SUBI R26,LOW([email protected])
SBCI R27,HIGH([email protected])
RCALL __PUTDP1
.ENDM
.MACRO __PUTB1SNS
LDD R26,[email protected]
LDD R27,[email protected]+1
ADIW R26,@1
ST X,R30
.ENDM
.MACRO __PUTW1SNS
LDD R26,[email protected]
LDD R27,[email protected]+1
ADIW R26,@1
ST X+,R30
ST X,R31
.ENDM
.MACRO __PUTD1SNS
LDD R26,[email protected]
LDD R27,[email protected]+1
ADIW R26,@1
RCALL __PUTDP1
.ENDM
.MACRO __PUTB1PMN
LDS R26,@0
LDS R27,@zero+1
SUBI R26,LOW([email protected])
SBCI R27,HIGH([email protected])
ST X,R30
.ENDM
.MACRO __PUTW1PMN
LDS R26,@0
LDS R27,@zero+1
SUBI R26,LOW([email protected])
SBCI R27,HIGH([email protected])
ST X+,R30
ST X,R31
.ENDM
.MACRO __PUTD1PMN
LDS R26,@zero
LDS R27,@0+1
SUBI R26,LOW([email protected])
SBCI R27,HIGH([email protected])
RCALL __PUTDP1
.ENDM
.MACRO __PUTB1PMNS
LDS R26,@zero
LDS R27,@0+1
ADIW R26,@1
ST X,R30
.ENDM
.MACRO __PUTW1PMNS
LDS R26,@zero
LDS R27,@zero+1
ADIW R26,@1
ST X+,R30
ST X,R31
.ENDM
.MACRO __PUTD1PMNS
LDS R26,@0
LDS R27,@zero+1
ADIW R26,@1
RCALL __PUTDP1
.ENDM
.MACRO __PUTB1RN
MOVW R26,[email protected]
SUBI R26,LOW([email protected])
SBCI R27,HIGH([email protected])
ST X,R30
.ENDM
.MACRO __PUTW1RN
MOVW R26,[email protected]
SUBI R26,LOW([email protected])
SBCI R27,HIGH([email protected])
ST X+,R30
ST X,R31
.ENDM
.MACRO __PUTD1RN
MOVW R26,[email protected]
SUBI R26,LOW([email protected])
SBCI R27,HIGH([email protected])
RCALL __PUTDP1
.ENDM
.MACRO __PUTB1RNS
MOVW R26,[email protected]
ADIW R26,@1
ST X,R30
.ENDM
.MACRO __PUTW1RNS
MOVW R26,[email protected]
ADIW R26,@1
ST X+,R30
ST X,R31
.ENDM
.MACRO __PUTD1RNS
MOVW R26,[email protected]
ADIW R26,@1
RCALL __PUTDP1
.ENDM
.MACRO __PUTB1RON
MOV R26,[email protected]
MOV R27,[email protected]
SUBI R26,LOW([email protected])
SBCI R27,HIGH([email protected])
ST X,R30
.ENDM
.MACRO __PUTW1RON
MOV R26,[email protected]
MOV R27,[email protected]
SUBI R26,LOW([email protected])
SBCI R27,HIGH([email protected])
ST X+,R30
ST X,R31
.ENDM
.MACRO __PUTD1RON
MOV R26,[email protected]
MOV R27,[email protected]
SUBI R26,LOW([email protected])
SBCI R27,HIGH([email protected])
RCALL __PUTDP1
.ENDM
.MACRO __PUTB1RONS
MOV R26,[email protected]
MOV R27,[email protected]
ADIW R26,@2
ST X,R30
.ENDM
.MACRO __PUTW1RONS
MOV R26,[email protected]
MOV R27,[email protected]
ADIW R26,@2
ST X+,R30
ST X,R31
.ENDM
.MACRO __PUTD1RONS
MOV R26,[email protected]
MOV R27,[email protected]
ADIW R26,@2
RCALL __PUTDP1
.ENDM
.MACRO __GETB1SX
MOVW R30,R28
SUBI R30,LOW([email protected])
SBCI R31,HIGH([email protected])
LD R30,Z
.ENDM
.MACRO __GETB1HSX
MOVW R30,R28
SUBI R30,LOW([email protected])
SBCI R31,HIGH([email protected])
LD R31,Z
.ENDM
.MACRO __GETW1SX
MOVW R30,R28
SUBI R30,LOW([email protected])
SBCI R31,HIGH([email protected])
LD R0,Z+
LD R31,Z
MOV R30,R0
.ENDM
.MACRO __GETD1SX
MOVW R30,R28
SUBI R30,LOW([email protected])
SBCI R31,HIGH([email protected])
LD R0,Z+
LD R1,Z+
LD R22,Z+
LD R23,Z
MOVW R30,R0
.ENDM
.MACRO __GETB2SX
MOVW R26,R28
SUBI R26,LOW([email protected])
SBCI R27,HIGH([email protected])
LD R26,X
.ENDM
.MACRO __GETW2SX
MOVW R26,R28
SUBI R26,LOW([email protected])
SBCI R27,HIGH([email protected])
LD R0,X+
LD R27,X
MOV R26,R0
.ENDM
.MACRO __GETD2SX
MOVW R26,R28
SUBI R26,LOW([email protected])
SBCI R27,HIGH([email protected])
LD R0,X+
LD R1,X+
LD R24,X+
LD R25,X
MOVW R26,R0
.ENDM
.MACRO __GETBRSX
MOVW R30,R28
SUBI R30,LOW([email protected])
SBCI R31,HIGH([email protected])
LD [email protected],Z
.ENDM
.MACRO __GETWRSX
MOVW R30,R28
SUBI R30,LOW([email protected])
SBCI R31,HIGH([email protected])
LD [email protected],Z+
LD [email protected],Z
.ENDM
.MACRO __LSLW8SX
MOVW R30,R28
SUBI R30,LOW([email protected])
SBCI R31,HIGH([email protected])
LD R31,Z
CLR R30
.ENDM
.MACRO __PUTB1SX
MOVW R26,R28
SUBI R26,LOW([email protected])
SBCI R27,HIGH([email protected])
ST X,R30
.ENDM
.MACRO __PUTW1SX
MOVW R26,R28
SUBI R26,LOW([email protected])
SBCI R27,HIGH([email protected])
ST X+,R30
ST X,R31
.ENDM
.MACRO __PUTD1SX
MOVW R26,R28
SUBI R26,LOW([email protected])
SBCI R27,HIGH([email protected])
ST X+,R30
ST X+,R31
ST X+,R22
ST X,R23
.ENDM
.MACRO __CLRW1SX
MOVW R30,R28
SUBI R30,LOW([email protected])
SBCI R31,HIGH([email protected])
CLR R0
ST Z+,R0
ST Z,R0
.ENDM
.MACRO __CLRD1SX
MOVW R30,R28
SUBI R30,LOW([email protected])
SBCI R31,HIGH([email protected])
CLR R0
ST Z+,R0
ST Z+,R0
ST Z+,R0
ST Z,R0
.ENDM
.MACRO __PUTB2SX
MOVW R30,R28
SUBI R30,LOW([email protected])
SBCI R31,HIGH([email protected])
ST Z,R26
.ENDM
.MACRO __PUTW2SX
MOVW R30,R28
SUBI R30,LOW([email protected])
SBCI R31,HIGH([email protected])
ST Z+,R26
ST Z,R27
.ENDM
.MACRO __PUTD2SX
MOVW R30,R28
SUBI R30,LOW([email protected])
SBCI R31,HIGH([email protected])
ST Z+,R26
ST Z+,R27
ST Z+,R24
ST Z,R25
.ENDM
.MACRO __PUTBSRX
MOVW R30,R28
SUBI R30,LOW([email protected])
SBCI R31,HIGH([email protected])
ST Z,[email protected]
.ENDM
.MACRO __PUTWSRX
MOVW R30,R28
SUBI R30,LOW([email protected])
SBCI R31,HIGH([email protected])
ST Z+,[email protected]
ST Z,[email protected]
.ENDM
.MACRO __PUTB1SNX
MOVW R26,R28
SUBI R26,LOW([email protected])
SBCI R27,HIGH([email protected])
LD R0,X+
LD R27,X
MOV R26,R0
SUBI R26,LOW([email protected])
SBCI R27,HIGH([email protected])
ST X,R30
.ENDM
.MACRO __PUTW1SNX
MOVW R26,R28
SUBI R26,LOW([email protected])
SBCI R27,HIGH([email protected])
LD R0,X+
LD R27,X
MOV R26,R0
SUBI R26,LOW([email protected])
SBCI R27,HIGH([email protected])
ST X+,R30
ST X,R31
.ENDM
.MACRO __PUTD1SNX
MOVW R26,R28
SUBI R26,LOW([email protected])
SBCI R27,HIGH([email protected])
LD R0,X+
LD R27,X
MOV R26,R0
SUBI R26,LOW([email protected])
SBCI R27,HIGH([email protected])
ST X+,R30
ST X+,R31
ST X+,R22
ST X,R23
.ENDM
.MACRO __MULBRR
MULS [email protected],[email protected]
MOVW R30,R0
.ENDM
.MACRO __MULBRRU
MUL [email protected],[email protected]
MOVW R30,R0
.ENDM
.MACRO __MULBRR0
MULS [email protected],[email protected]
.ENDM
.MACRO __MULBRRU0
MUL [email protected],[email protected]
.ENDM
.MACRO __MULBNWRU
LDI R26,@2
MUL R26,[email protected]
MOVW R30,R0
MUL R26,[email protected]
ADD R31,R0
.ENDM
.CSEG
.ORG .INCLUDE “mega8servo.vec”
.INCLUDE “mega8servo.inc”
__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
;DISABLE WATCHDOG
LDI R31,0x18
OUT WDTCR,R31
OUT WDTCR,R30
;CLEAR R2-R14
LDI R24,thirteen
LDI R26,2
CLR R27
__CLEAR_REG:
ST X+,R30
DEC R24
BRNE __CLEAR_REG
;CLEAR SRAM
LDI R24,LOW(0x400)
LDI R25,HIGH(0x400)
LDI R26,0x60
__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:
;STACK POINTER INITIALIZATION
LDI R30,LOW(0x45F)
OUT SPL,R30
LDI R30,HIGH(0x45F)
OUT SPH,R30
;DATA STACK POINTER INITIALIZATION
LDI R28,LOW(0x160)
LDI R29,HIGH(0x160)
RJMP _main
.ESEG
.ORG .DSEG
.ORG 0x160
; /*****************************************************
; This program was produced by the
; CodeWizardAVR V1.25.three Standard
; Automatic Program Generator
; � Copyright Pavel Haiduc, HP InfoTech s.r.l.
;
; ; Project :
; Version :
; Date : 5/25/ ; Author : inzar
; Company : NAD
; Comments:
; ; ; Chip kind : ATmega8
; Program kind : Application
; Clock frequency : 11. MHz
; Memory mannequin : Small
; External SRAM size : zero
; Data Stack size : ; *****************************************************/
; ; #embody
; ; // Standard Input/Output features
; #embrace
; #include
; ; #embrace “variable.c”
; int a=0,i;
; unsigned char s;
; unsigned char tes,bahuka,bahuki,tapakka,tapakki,engkelka,engkelki,lututka,lututki,pahaka,pahaki,pinggulka,pinggulki,pinggangka,pinggangki;
_engkelka:
.BYTE 0x1
_engkelki:
.BYTE 0x1
_lututka:
.BYTE 0x1
_lututki:
.BYTE 0x1
_pahaka:
.BYTE 0x1
_pahaki:
.BYTE 0x1
_pinggulka:
.BYTE 0x1
_pinggulki:
.BYTE 0x1
_pinggangka:
.BYTE 0x1
_pinggangki:
.BYTE 0x1
; unsigned char j,y,step=0,tanda;
_j:
.BYTE 0x1
_y:
.BYTE 0x1
_step:
.BYTE 0x1
_tanda:
.BYTE 0x1
; #embrace “gerakan.c”
; void siap()
;
.CSEG
_siap:
; //tapakka=67; //tengah
; ; //============
; // PUTAR kanan (kurang)(CW )
; // PUTAR kiri (tambah)(CCW)
; //============
; ; //pinggulki=62; //lurus
; pinggulka=75; //lurus
LDI R30,LOW(75)
STS _pinggulka,R30
; ; pinggulki=65; //lurus
LDI R30,LOW(65)
STS _pinggulki,R30
; //pinggulka=72; //lurus
; ; pahaki=63; //lurus
LDI R30,LOW(63)
RCALL SUBOPT_0x0
; pahaka=72; //lurus
LDI R30,LOW(72)
RCALL SUBOPT_0x1
; ; lututki=89; //lurus
LDI R30,LOW(89)
RCALL SUBOPT_0x2
; lututka=38; //lurus
LDI R30,LOW(38)
RCALL SUBOPT_0x3
; ; engkelki=62; //lurus
LDI R30,LOW(62)
RCALL SUBOPT_0x4
; engkelka=63; //lurus
LDI R30,LOW(63)
RCALL SUBOPT_0x5
; ; tapakki=67; //lurus
LDI R30,LOW(67)
MOV R12,R30
; tapakka=66; //lurus
LDI R30,LOW(66)
MOV R13,R30
; ; bahuki=95; //lurus
LDI R30,LOW(95)
MOV R10,R30
; bahuka=38; //lurus
LDI R30,LOW(38)
MOV R11,R30
;
RET
; ; void joging()
;
; //condong kedepan sedikit
; for(i=0;i Y+0
RCALL SUBOPT_0x6
_0xFA:
CLR R0
CP R0,R6
CPC R0,R7
BRLT _0xFB
;
; ; pahaka–;
RCALL SUBOPT_0x7
; engkelka++;
; //lututka+=2;
; ; pahaki++;
RCALL SUBOPT_0x8
; engkelki–;
; //lututki-=2;
; ; delay_ms(500);
LDI R30,LOW(500)
LDI R31,HIGH(500)
RCALL SUBOPT_0x9
;
RCALL SUBOPT_0xA
RJMP _0xFA
_0xFB:
; delay_ms(200);
LDI R30,LOW(200)
LDI R31,HIGH(200)
RCALL SUBOPT_0x9
; ; //jongkok sedikit
; for(i=0;i Y+zero
;
; tapakki–;
; tapakka–;
; delay_ms(3);
;
; //bahuki-=14;
; delay_ms(50);
; ; /////////////////mulai program utama
; for (s=zero;s