| 1 |
;******************************************************************** |
| 2 |
;* LED flasher: LED will flash with a X on/off ratio at PD6 |
| 3 |
;* |
| 4 |
;* NOTE: delay depends in the value of X, 1 is fast, 255 is slow |
| 5 |
;* |
| 6 |
;* No copyright ©1998 RES® * FREEWARE * |
| 7 |
;* |
| 8 |
;* NOTE: Connect a low current LED with a 1k resistor in serie from |
| 9 |
;* Vdd to pin 11 of the MCU. (Or a normal LED with a 330ohm) |
| 10 |
;* |
| 11 |
;* RES® can be reached by email: [email protected] |
| 12 |
;* or visit the website: http://home.wanadoo.nl/electro1/avr |
| 13 |
;* |
| 14 |
;* Version :1.0 |
| 15 |
;* Date :12/26/98 |
| 16 |
;* Author :Rob's ElectroSoft® |
| 17 |
;* Target MCU :AT90S1200-12PI@4MHz |
| 18 |
;******************************************************************** |
| 19 |
|
| 20 |
.include "1200def.inc" |
| 21 |
|
| 22 |
rjmp RESET ;reset handle |
| 23 |
|
| 24 |
|
| 25 |
;* Long delay |
| 26 |
|
| 27 |
;* Register variables |
| 28 |
|
| 29 |
.def T1 = r1 |
| 30 |
.def T2 = r2 |
| 31 |
.def temp = r19 |
| 32 |
|
| 33 |
;* Code |
| 34 |
|
| 35 |
longDelay: |
| 36 |
clr T1 ;T1 used as delay 2nd count |
| 37 |
clr T2 ;T2 used as delay 3d count |
| 38 |
delay_1: |
| 39 |
dec T2 |
| 40 |
brne delay_1 |
| 41 |
dec T1 |
| 42 |
brne delay_1 |
| 43 |
dec temp ;temp must be preset as |
| 44 |
brne delay_1 ; delay master count |
| 45 |
ret |
| 46 |
|
| 47 |
|
| 48 |
;* Resets the data direction register D |
| 49 |
|
| 50 |
;* Defines |
| 51 |
|
| 52 |
.equ led = 6 ;LED at PD6 |
| 53 |
|
| 54 |
;* Code |
| 55 |
|
| 56 |
RESET: |
| 57 |
sbi DDRD, led ;connect LED to PORTD pin 6 |
| 58 |
|
| 59 |
|
| 60 |
;* Main program |
| 61 |
|
| 62 |
;* This part will let the LED go on and off by X |
| 63 |
|
| 64 |
;* Register variables |
| 65 |
|
| 66 |
.equ X = 10 ;enter delaytime X |
| 67 |
|
| 68 |
flash: |
| 69 |
sbi PORTD, led ;LED on |
| 70 |
ldi temp, X ;X sec delay |
| 71 |
rcall longDelay |
| 72 |
cbi PORTD, led ;LED off |
| 73 |
ldi temp, X ;X sec delay |
| 74 |
rcall longDelay |
| 75 |
rjmp flash ;another run |
| 76 |
|
| 77 |
/* other |
| 78 |
tests */ |
| 79 |
|
| 80 |
.org LARGEBOOTSTART |
| 81 |
; the following sets up RAMPZ:Z to point to a FLASH data object, typically |
| 82 |
; for use with ELPM. |
| 83 |
ldi ZL, low (cmdtable * 2) |
| 84 |
ldi ZH, high (cmdtable * 2) |
| 85 |
.if ((cmdtable * 2) > 65535) |
| 86 |
ldi r16, 1 |
| 87 |
sts RAMPZ, r16 |
| 88 |
.endif |
| 89 |
; more code follows here |
| 90 |
cmdtable: .db "foo", 0x0 |
| 91 |
.db "Hello\n" // is equivalent to: |
| 92 |
.db 'H', 'e', 'l', 'l', 'o', '\\', 'n' |
| 93 |
.db '\0', '\177', '\xff' |
| 94 |
.db "\nx\rx\ax\bx\fx\tx\vx\\x\0000\xfff\0\1" |
| 95 |
0b10_111_2 0xaf3_4 0_12 32_32 $32_3 |
| 96 |
|
| 97 |
.macro m |
| 98 |
ldi @0, @1 |
| 99 |
.endm m r16,\ 0 |
| 100 |
|
| 101 |
#define TEST \ |
| 102 |
.IF val \ |
| 103 |
.DW __TIME__ \ |
| 104 |
.ELSE \ |
| 105 |
.DW 1 \ |
| 106 |
.ENDIF |
| 107 |
|
| 108 |
#defi TEST |