Discussion in "AVR Discussion Forum" started by    ENG\ AHMED    May 9, 2008.
Fri May 09 2008, 11:23 am
#1
HI ALL,
I work with MCU 1 st time and i have a problem in programming UART transmision
That my programe is to send 0xff and ON indication LED then OFF the LED for 1 sec
but i found that the LED ON forever ,pls check my programme.
i use at90s8515 with 8mhz crystal
and that my programme.........

LDI R18,0X80   ;STACK POINTER
OUT $3D,R18

SBI $11,4      ;O/P LED INDECATION

LDI R16,51     ;9600 BOUD RATE @8MHZ
OUT $09,R16

NEXT:
SBI $12,4                       ;LED ON
LDI R31,HIGH(2*ASD)
LDI R30,LOW(2*ASD)
RCALL STRANSMIT
RCALL DELAY1 
CBI $12,4                       ;LED OFF
RCALL DELAY1
RJMP NEXT

DELAY1:                           ;ONE SEC DELAY
ldi r20, 20
ldi r21, 255
ldi r22, 255
DELAY:
dec r22
brne DELAY
dec r21
brne DELAY
dec r20
brne DELAY
ret

STRANSMIT:
SBI $0A,3                         ;TXEN  UCR(3)=1
AGAIN1:
LPM R20,Z
CPI R20,0                        ;COMBAR WITH LAST ZERO
BREQ QUIT
OUT $0C,R20                      ;DATA IN UDR
W:
SBIS $0B,5    ; ?
RJMP W
ADIW R31:R30,1
RJMP AGAIN1
QUIT:
CBI $0A,3
RET


ASD: .DB 0XFF
     .DB 0


[ Edited Sat May 10 2008, 03:20 am ]
Sat May 10 2008, 03:59 am
#2
I think you cannot use this instruction
LPM R20,Z

coz you are using 8515 so only LPM is allowed without operands.

Sat May 10 2008, 11:09 am
#3
great thx ........... AJAY :bye

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

KevinTab
Sun Apr 28 2024, 05:35 am
Tumergix
Sun Apr 28 2024, 12:59 am
StevenDrulk
Sat Apr 27 2024, 08:47 pm
StephenHauct
Sat Apr 27 2024, 09:38 am
Adamsaf
Sat Apr 27 2024, 07:12 am
Robertphype
Sat Apr 27 2024, 12:23 am
ktaletrryp
Fri Apr 26 2024, 10:55 pm
Robertrip
Fri Apr 26 2024, 11:20 am