 |
|
 |
' =========================================================================
'
' File...... WDATA.SXB
' Purpose... Display LED patterns from WDATA table
' Author.... (c) Parallax, Inc. -- All Rights Reserved
' E-mail.... support@parallax.com
' Started...
' Updated... 05 JUL 2006
'
' =========================================================================
' -------------------------------------------------------------------------
' Program Description
' -------------------------------------------------------------------------
'
' This program shows how to stre and retrieve 16-bit values from a WDATA
' table. Note that the index for READ is updated by two for each loop
' as the WDATA table uses 2-byte values.
' -------------------------------------------------------------------------
' Device Settings
' -------------------------------------------------------------------------
DEVICE SX28, OSC4MHZ, TURBO, STACKX, OPTIONX
FREQ 4_000_000
ID "WDATA"
' -------------------------------------------------------------------------
' IO Pins
' -------------------------------------------------------------------------
Leds VAR RBC ' 16-bit RB/RC port
' -------------------------------------------------------------------------
' Variables
' -------------------------------------------------------------------------
idx VAR Byte
' =========================================================================
PROGRAM Start
' =========================================================================
' -------------------------------------------------------------------------
' Program Code
' -------------------------------------------------------------------------
Start:
TRIS_B = %00000000 ' make LED pins outputs
TRIS_C = %00000000
Main:
DO
READ Chaser + idx, Leds ' new pattern into LEDs
PAUSE 50
idx = idx + 2 ' update index
IF idx > 14 THEN ' end of table?
idx = 0 ' yes, reset
ENDIF
LOOP
' =========================================================================
' User Data
' =========================================================================
Chaser:
WDATA %00000000_00001111
WDATA %00000000_00111100
WDATA %00000000_11110000
WDATA %00000011_11000000
WDATA %00001111_00000000
WDATA %00111100_00000000
WDATA %11110000_00000000
WDATA %11000000_00000011