' ========================================================================= ' File....... SW21-EX08-7-Seg_Counter-Hex.SXB ' Purpose.... Single digit, 7-Segment LED counter ' 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 ]--------------------------------------------- ' Displays Hedadecimal digits (0 - F) on a 7-Segment display connected to ' rb.0-rb.7. This program will work, unmodified, on the SX28. '------{ Device Settings ]------------------------------------------------- DEVICE SX28,TURBO,BANKS8,OSCHS3,SYNC,OPTIONX FREQ 50_000_000 ID "EX07.1" ' -----[ I/O Definitions ]------------------------------------------------- Segs VAR RB ' Segments on RB.0 - RB.7 ' -----[ Constants ]------------------------------------------------------- ' -----[ Variables ]------------------------------------------------------- idx VAR Byte ' counter variable ' -----[ Initialization ]------------------------------------------------- PROGRAM Start watch Segs, 8, UBIN watch idx, 8, UDEC ' -----[Subs ]------------------------------------------------------------ ' -----[ Program Code ]---------------------------------------------------- Start: Tris_B = %10000000 ' make LEDs outputs Main: FOR idx = 0 TO 10 ' loop through digits READ Digit0 + idx, Segs ' move pattern to display Break PAUSE 1000 NEXT GOTO Main ' -----[ EEPROM Data ]----------------------------------------------------- ' .GFEDCBA ' -------- Digit0: DATA %00111111 Digit1: DATA %00000110 Digit2: DATA %01011011 Digit3: DATA %01001111 Digit4: DATA %01100110 Digit5: DATA %01101101 Digit6: DATA %01111101 Digit7: DATA %00000111 Digit8: DATA %01111111 Digit9: DATA %01100111 Digit10: DATA %01110111