📄 main.asm
字号:
/******************************************************************************
** **
** Name: BF533 EZ-KIT Blink LEDs **
** **
*******************************************************************************
(C) Copyright 2003 - Analog Devices, Inc. All rights reserved.
File Name: BF533_EZ-KIT_BlinkLeds.asm
Date Modified: 3/27/03 Szy
Software: VisualDSP++3.1
Hardware: ADSP-BF533 EZ-KIT Board Rev. 1.1
ADSP-BF533 Rev. 0.1 Silicon
Special Connections: SW9 on EZ-KIT Board, pins 1-4 should be ON.
Purpose: Toggle LEDs on the EZ-KIT
********************************************************************************/
#include <defBF533.h>
#include "startup.h"
.section L1_code;
.global _main;
.extern Flash_Setup;
#define PF_DIR 0x0000 // PF8-11 inputs
#define PF_POL 0x0000 // all PF active high
#define PF_INEN 0x0f00 // PF8-11 inputs to enable
#define SW7 0x0100 // switch SW7, LED pattern 0 (PF8)
#define SW6 0x0200 // switch SW6, LED pattern 1 (PF9)
#define SW4 0x0400 // switch SW4, LED pattern 2 (PF10)
#define SW5 0x0800 // switch SW5, stop (PF11)
#define led_pattern0 0x15 // initial LED pattern (also SW7)
#define led_pattern1 0x3f // LED pattern after pressing SW6
#define led_pattern2 0x33 // LED pattern after pressing SW4
#define delay 0x3800000
_main:
//initialize the flash as the flash pins are linked to the LEDs
//instead of the DSPs PF pins.
CALL Flash_Setup;
// configure programmable flags
// set PF dir reg
p0.l = lo(FIO_DIR);
p0.h = hi(FIO_DIR);
r0.l = PF_DIR;
w[p0] = r0;
ssync;
// set PF polarity reg
p0.l = lo(FIO_POLAR);
p0.h = hi(FIO_POLAR);
r0 = PF_POL;
w[p0] = r0;
ssync;
// enable PF inputs
p0.l = lo(FIO_INEN);
p0.h = hi(FIO_INEN);
r0 = w[p0](z);
r1.l = PF_INEN;
r0 = r0 | r1;
w[p0] = r0;
ssync;
// flash A csio reg (portB data reg)
p1.h = hi(flashA_csio);
p1.l = lo(flashA_csio) + portB_data_out;
r4 = b[p1](z); // read portB
r3 = 0xc0; // mask of bits 5-0
r4 = r4 & r3; // preserve bits 7-6 in r4
r3 = 0x3f; // mask of bits 7-6
r2 = led_pattern0; // set initial LED pattern
loop1:
r2 = r2 & r3; // mask of bits 7-6
r2 = r4 | r2; // set portB content in r2
b[p1] = r2; // write flash A portB
ssync;
r2 = ~r2; // togglem LED
r5 = 0x0; // clear the stop flag
call DELAY;
jump loop1;
/*
// check push button sw7 (led_pattern0)
read_pf:
p0.l = lo(FIO_FLAG_D);
p0.h = hi (FIO_FLAG_D);
r0 = w[p0](z); // read PF data reg
sw7_check:
r1 = SW7;
r1 = r0 & r1;
cc = r1 == 0x0;
if cc jump sw6_check; // sw7 not asserted
r2 = led_pattern0; // sw7 asserted (change LED pattern)
r5 = 0x0; // clear the stop flag
// check push button sw6 (led_pattern1)
sw6_check:
r1 = SW6;
r1 = r0 & r1;
cc = r1 == 0x0;
if cc jump sw4_check; // sw6 not asserted
r2 = led_pattern1; // sw6 asserted (change LED pattern)
r5 = 0x0; // clear the stop flag
// check push button sw4 (led_pattern2)
sw4_check:
r1 = SW4;
r1 = r0 & r1;
cc = r1 == 0x0;
if cc jump sw5_check; // sw4 not asserted
r2 = led_pattern2; // sw4 asserted (change LED pattern)
r5 = 0x0; // cleat the stop flag
// check push button sw5 (stop)
sw5_check:
r1 = SW5;
r1 = r0 & r1;
cc = r1 == 0x0;
if !cc jump stop_flag; // sw5 asserted
// if here then no switch has been pressed;
cc = r5 == 0x0; // check stop flag status
if cc jump loop1; // stop flag = OFF
jump read_pf; // stop flag = ON
stop_flag:
r5 = 0x1; // set the stop flag
jump read_pf; // check switches from start
*/
DELAY:
p2.l = lo(delay);
p2.h = hi(delay);
lsetup(delay_loop, delay_loop) lc0=p2;
delay_loop: nop;
rts;
_main.END:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -