In SX Microcontrollers, SX/B Compiler and SX-Key Tool, tdg8934 wrote: I have been able to use a Parallax SX-28 micro-controller and get the board to perform basic LED scrolling. [b]However, I really need some example help as I can not seem to control the scanning.[/b] If I use the A, B, C, D pins either in the micro-controller program inside of an interrupt OR externally connected to a 74LS193 IC, I need more than 100 Hz and used a 1KHz clock (e.g. Pulse generator on the professional development board) to even see anything on the display. Here is my working code to scroll a set of 16 LEDs from the left side of the display to the right side. The picture indicates using the RA output to A, B, C, and D - not the 74LS193 IC and pulse generator test. By changing the SHIFTOUT command to have either R1_Dpin, R2_Dpin, G1_Dpin or G2_Dpin entered, it will allow either the top 16 rows or bottom 16 rows in either red or green. If the scanning is fast (within the Interrupt routine), all I see is a straight line from the top row to the bottom 16th row (using R1_Dpin - means the top 16 rows in color RED). If I change the data going into the SHIFTOUT command (e.g. pattern(temp1)), I can see that but all 16 rows have that same pattern (in this case a straight line). I know that picture looks like there are 2 columns of 16 rows of LEDs on - it is only 1 as I could not snap the picture fast enough . [code] ' ========================================================================= ' ' File...... 6432a.SXB ' Purpose... Display information on 64x32 BiColor LED display ' Author.... Tim Gilmore ' E-mail.... ' Started... 13 June 2008 ' Updated... ' ' ========================================================================= ' ------------------------------------------------------------------------- ' Program Description ' ------------------------------------------------------------------------- ' ------------------------------------------------------------------------- ' Device Settings ' ------------------------------------------------------------------------- DEVICE SX28, OSC4MHZ, TURBO, STACKX, OPTIONX, BOR22 FREQ 4_000_000 ' ------------------------------------------------------------------------- ' IO Pins ' ------------------------------------------------------------------------- Row PIN RA OUTPUT 'Controls A, B, C, and D on the display board (0-15 rows) S_Cpin VAR RB.0 ' shift clock L_Latch VAR RB.1 ' latch outputs R1_Dpin VAR RB.2 ' shift R1 data 'Red LEDs in top 16 rows R2_Dpin VAR RB.3 ' shift R2 data 'Red LEDs in bottom 16 rows G1_Dpin VAR RB.4 ' shift G1 data 'Green LEDS in top 16 rows G2_Dpin VAR RB.5 ' shift G2 data 'Green LEDS in bottom 16 rows ' ------------------------------------------------------------------------- ' Constants ' ------------------------------------------------------------------------- DelayTime CON 50 'Column speed of scrolling LED display ' ------------------------------------------------------------------------- ' Variables ' ------------------------------------------------------------------------- tmpW1 VAR Word temp1 VAR Byte ' subroutine work vars pattern VAR Byte(8) ' pattern for LEDs idx VAR Byte ' ------------------------------------------------------------------------- INTERRUPT 2500 ' 0.4 ms rate ' ------------------------------------------------------------------------- 'Scans 16 rows of LED Display board - RA. ISR_Start: IF Row < 15 THEN INC Row ' point to next row ELSE Row =0 ' wrap back ENDIF ISR_Exit: RETURNINT ' ========================================================================= PROGRAM Start ' ========================================================================= ' ------------------------------------------------------------------------- ' Subroutine Declarations ' ------------------------------------------------------------------------- DELAY_MS SUB 1, 2 ' delay in milliseconds OUT SUB 0 ' move value to 74HC595 FORWARD SUB 0 ' ------------------------------------------------------------------------- ' Program Code ' ------------------------------------------------------------------------- Start: 'PLP_B = %10000000 ' pull-up unused pins PLP_A = %1111 ' pull-up unused pins PLP_B = %00111111 PLP_C = %00000000 LOW L_Latch ' make an output and low pattern = %00000001 ' initialize pattern Main: FORWARD GOTO Main End ' ------------------------------------------------------------------------- ' Subroutine Code ' ------------------------------------------------------------------------- ' Use: DELAY_MS ms ' -- delay program for 'ms' milliseconds SUB DELAY_MS IF __PARAMCNT = 1 THEN ' byte parameter? tmpW1 = __PARAM1 ELSE tmpW1 = __WPARAM12 ENDIF PAUSE tmpW1 ENDSUB ' ------------------------------------------------------------------------- SUB OUT FOR temp1 = 7 to 0 step -1 SHIFTOUT R1_Dpin, S_Cpin, MSBFIRST, ~pattern(temp1)' send the bits NEXT PULSOUT L_Latch, 1 ' transfer to outputs ENDSUB 'R1_Dpin is used to use Red LEDS in the top 16 rows of the LED Display ' ------------------------------------------------------------------------- 'Routine to scroll columns (64 LEDs) on the LED Display board's multiple 74HC595 ICs. SUB FORWARD idx = 0 pattern(0) = %00000001 DO OUT DELAY_MS DelayTime ' hold pattern(0) = pattern(0) << 1 ' shift pattern left INC idx LOOP UNTIL idx = 8 idx = 0 pattern(1) = %00000001 DO OUT DELAY_MS DelayTime ' hold pattern(1) = pattern(1) << 1 ' shift pattern left INC idx LOOP UNTIL idx = 8 idx = 0 pattern(2) = %00000001 DO OUT DELAY_MS DelayTime ' hold pattern(2) = pattern(2) << 1 ' shift pattern left INC idx LOOP UNTIL idx = 8 idx = 0 pattern(3) = %00000001 DO OUT DELAY_MS DelayTime ' hold pattern(3) = pattern(3) << 1 ' shift pattern left INC idx LOOP UNTIL idx = 8 idx = 0 pattern(4) = %00000001 DO OUT DELAY_MS DelayTime ' hold pattern(4) = pattern(4) << 1 ' shift pattern left INC idx LOOP UNTIL idx = 8 idx = 0 pattern(5) = %00000001 DO OUT DELAY_MS DelayTime ' hold pattern(5) = pattern(5) << 1 ' shift pattern left INC idx LOOP UNTIL idx = 8 idx = 0 pattern(6) = %00000001 DO OUT DELAY_MS DelayTime ' hold pattern(6) = pattern(6) << 1 ' shift pattern left INC idx LOOP UNTIL idx = 8 idx = 0 pattern(7) = %00000001 DO OUT DELAY_MS DelayTime ' hold pattern(7) = pattern(7) << 1 ' shift pattern left INC idx LOOP UNTIL idx = 8 ENDSUB [/code] The 6432 Bicolor LED display and manual (too big to attach) can be found here: [url=http://www.sureelectronics.net/goods.php?id=147]http://www.sureelectronics.net/goods.php?id=147[/url] ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=273480#m273560 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)