' ========================================================================= ' File....... SW21-EX02-Flash_LED-Cntr.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 ]--------------------------------------------- ' Flashes an LED connected to RB.4, controlled by the value of a bit that's ' part of another variable. This program will work, unmodified, on ' the SX28 ' ------------------------------------------------------------------------- '------{ Device Settings ]------------------------------------------------- DEVICE SX28,TURBO,BANKS8,OSCHS3,SYNC,OPTIONX FREQ 50_000_000 ID "EX03" ' -----[ I/O Definitions ]------------------------------------------------- Strobe PIN RB.4 ' LED on RB.4 ' -----[ Constants ]------------------------------------------------------- IsOn CON 1 ' on for active-high LED IsOff CON 0 ' off for active-high LED FlashOn CON 50 ' on for 50 ms FlashOff CON 950 ' off for 950 ms 'for sxsim 'FlashOn CON 1 ' on for 1 ms 'FlashOff CON 2 ' off for 2 ms ' -----[ Variables ]------------------------------------------------------- cntr VAR Byte ' simple counter, 0 - 15 ' -----[ Initialization ]------------------------------------------------- PROGRAM Start ' -----[ Program Code ]---------------------------------------------------- Start: OUTPUT Strobe ' enable pin to drive LED Strobe = IsOff Main: DO Strobe = cntr.0 PAUSE 500 cntr = cntr + 1 LOOP