‘ Time between each frame of the icon frm_pause con 75 ‘ Time icon should wait after last frame icon_pause con 1000 ‘ 7219 setup register values decode_reg con $0900 intensity con $0a0a scan_limit con $0b07 shutdown_on con $0c01 shutdown_off con $0c00 test_off con $0f00 test_on con $0f01 ‘ Pin alias’s load con 0 clk con 1 dout con 2 ‘ Application variables frm_addr var word x var byte x_val var byte y var byte frames var byte frm var word icon var word btnwrk var byte '-------- SETUP FRAMES ------ blank data 1 data %00000000 data %00000000 data %00000000 data %00000000 data %00000000 data %00000000 data %00000000 data %00000000 smile data 7 data %01000010 data %10100101 data %01000010 data %00011000 data %00000000 data %00000000 data %01111110 data %00000000 data %01000010 data %10100101 data %01000010 data %00011000 data %00000000 data %00000000 data %01111110 data %00000000 data %01000010 data %10100101 data %01000010 data %00011000 data %00000000 data %01000010 data %00111100 data %00000000 data %01000010 data %10100101 data %01000010 data %00011000 data %00000000 data %10000001 data %01000010 data %00111100 data %01000000 data %10100111 data %01000000 data %00011000 data %00000000 data %10000001 data %01000010 data %00111100 data %01000000 data %10100111 data %01000000 data %00011000 data %00000000 data %10000001 data %01000010 data %00111100 data %01000010 data %10100101 data %01000010 data %00011000 data %00000000 data %10000001 data %01000010 data %00111100 '----- Main ------------- gosub init ‘do the setup stuff btnwrk = 0 ‘ Launch initial startup icon icon = smile gosub play_icon ‘ Main loop looper: button 12,1,1,250,btnwrk,1,Press goto looper Press: ‘ this command should be on a single line branch INC,[oooo,xooo,oxoo,xxoo,ooxo,xoxo,oxxo,xxxo, ooox,xoox,oxox,xxox,ooxx,xoxx,oxxx,xxxx] ‘ easy map of button presses to icon displayed ‘ o - switch open ‘ x - switch closed ‘ replace the word "blank" with the name of the icon ‘ that you want displayed for that button combination oooo: icon = blank goto play_icon xooo: icon = smile goto play_icon oxoo: icon = blank goto play_icon xxoo: icon = blank goto play_icon ooxo: icon = blank goto play_icon xoxo: icon = blank goto play_icon oxxo: icon = blank goto play_icon xxxo: icon = blank goto play_icon ooox: icon = blank goto play_icon xoox: icon = blank goto play_icon oxox: icon = blank goto play_icon xxox: icon = blank goto play_icon ooxx: icon = blank goto play_icon xoxx: icon = blank goto play_icon oxxx: icon = blank goto play_icon xxxx: icon = blank goto play_icon end '---- play icon --------- play_icon: ‘ get the address of the chosen icon frm_addr = icon ‘ read the first icon entry, which is the ‘ number of frames in the icon read frm_addr,frames ‘ increment the address to the first frame byte frm_addr = frm_addr + 1 ‘ do this loop for each frame of the icon for x = 1 to frames ‘ do this loop for each byte in the frame for y = 1 to 8 ‘ get the data from this address read frm_addr,x_val ‘ increment the address to the next byte frm_addr = frm_addr + 1 ‘ get the 7219 call setup with the ‘ address (y * 256) and the data (x_val) frm = y*256+x_val gosub load_reg ‘ go load the 7219 next pause frm_pause ‘ pause after frame next pause icon_pause ‘ pause after icon ‘ return to the main loop goto looper '---- Load 7219 register -------- load_reg: low load ‘ push out the 7219 data a bit at a time, msb first shiftout dout,clk,1,[frm\16] high load return '------- Initialize BS2 & 7219 -------- Init: ‘ setup input/output pins DIRS = %0000000000000111 x_val = 0 ‘ pass the 7219 all it’s setup values for x = 1 to 8 frm = x*256 gosub load_reg next frm = decode_reg ‘ set to bits not characters gosub load_reg frm = intensity ‘ set the brightness gosub load_reg frm = scan_limit ‘ set number of data registers gosub load_reg frm = test_off ‘ set display test to off gosub load_reg frm = shutdown_on ‘ set to all LEDs off gosub load_reg return