' ========================================================================= ' File....... SSW21-EX04-SciFi_LEDs.SXB ' Purpose.... Advanced LED Flasher ' Author..... (C) 2000 - 2005, Parallax, Inc. ' E-mail..... support@parallax.com ' Started.... 01 SEP 2005 ' Updated.... 23 MAR 2007 by TSaavik for SX28 ' ========================================================================= ' -----[ Program Description ]--------------------------------------------- ' ' "Ping-Pongs" a single LED back-and-forth across a bank of eight. This ' program will work, unmodified, on any BS2-family module. '------{ Device Settings ]------------------------------------------------- DEVICE SX28,TURBO,BANKS8,OSCHS3,SYNC,OPTIONX FREQ 50_000_000 ID "EX03" ' -----[ I/O Definitions ]------------------------------------------------- LEDs VAR RB ' LEDs on RB.0 - RB.7 ' -----[ Constants ]------------------------------------------------------- DelayTm CON 100 ' delay time for LEDs 'DelayTm CON 1 ' delay time for LEDs in SXSIM ' -----[ Initialization ]------------------------------------------------- PROGRAM Start watch LEDs,8,UBIN ' -----[ Program Code ]---------------------------------------------------- Start: LEDS = %00000001 ' start with right LED on Tris_B = %00000000 ' make LEDs outputs Main: LEDS = %00000001 ' start with right LED on DO WHILE LEDs = %10000000 ' test for left extreme PAUSE DelayTm ' on-time for lit LED LEDs = LEDs << 1 ' shift LED left LOOP DO PAUSE DelayTm LEDs = LEDs >> 1 ' shift LEDs right LOOP UNTIL LEDs = %00000001 ' test for right extreme GOTO Main