Society of Robots - Robot Forum
Software => Software => Topic started by: santiago on October 20, 2010, 04:59:45 PM
-
This Program is in assembly language.
8 leds are connected from PD0-PD7. Therefore, the purpose is to write a program to turn on each LED from pin D0 to pin D7. In addition, I want to call a delay subroutine before turning on the next LED.
Yas help is greatly appreciated,
Santiago
.INCLUDE "M32DEF.INC"
LDI R20, HIGH(RAMEND)
OUT SPH, R20
LDI R20, LOW(RAMEND)
OUT SPL, R20
LDI R20, 0xFF ;initrialize stack pointer
OUT PORTD, R20 ;make PORTD an output port
SBI PORTD, 0 ;set bit PD)
CALL DELAY ;delay before next one
SBI PORTD,1 ;turn on PD1
CALL DELAY ;delay before next one
SBI PORTD,2
CALL DELAY
SBI PORTD,3
CALL DELAY
SBI PORTD,4
CALL DELAY
SBI PORTD,5
CALL DELAY
SBI PORTD,6
CALL DELAY
SBI PORTD,7
CALL DELAY
This is what AVR Studio 4 tells me:
C:\Assembler\ledtest\ledtest.asm(17): error: Undefined symbol: DELAY
C:\Assembler\ledtest\ledtest.asm(19): error: Undefined symbol: DELAY
C:\Assembler\ledtest\ledtest.asm(21): error: Undefined symbol: DELAY
C:\Assembler\ledtest\ledtest.asm(23): error: Undefined symbol: DELAY
C:\Assembler\ledtest\ledtest.asm(25): error: Undefined symbol: DELAY
C:\Assembler\ledtest\ledtest.asm(26): No EEPROM data, deleting C:\Assembler\ledtest\ledtest.eep
-
You've got to write the DELAY routine !
-
Thanks for responding Webbot.
Does anybody have an example of the delay routine?
Thanks.
-
nop
-
Nop--that is no help. However, I found the answer.
-
nop => 'No opereration' instruction used for the minimum delay time.
-
Thanks: Webbot,garrettg8, and waltr.
Its gets a little frustrating when you have to learn 3 or 4 programming languages.
Thank God I can always count on you guys to help out!
Thank you!