' CD case code rev. 4 ' created by Zach Eveland ' last updated Dec 1 2005 ' this code is used for the microcontroller in each of the cases ' in the iTunes Jukebox. Each case is coded with a unique outByte, ' which is the address it gives to the computer. ' for more, see www.itjukebox.com DEFINE OSC 4 start: redpin1 VAR PORTB.0 greenpin1 VAR PORTB.1 bluepin1 VAR PORTB.2 redpin2 VAR PORTA.0 greenpin2 VAR PORTA.1 bluepin2 VAR PORTA.2 rxtxpin VAR PORTB.5 OUTPUT redpin1 OUTPUT greenpin1 OUTPUT bluepin1 OUTPUT redpin2 OUTPUT greenpin2 OUTPUT bluepin2 HIGH redpin1 HIGH greenpin1 HIGH bluepin1 HIGH redpin2 HIGH greenpin2 HIGH bluepin2 colors VAR BYTE[8] i VAR BYTE c1 VAR BYTE c2 VAR BYTE inByte VAR BYTE outByte VAR BYTE colors[0] = %11111111 'all off colors[1] = %11111110 'red on colors[2] = %11111100 'red and green on colors[3] = %11111101 'green on colors[4] = %11111001 'green and blue on colors[5] = %11111000 'all on colors[6] = %11111010 'red and blue on colors[7] = %11111011 'blue on i = 0 c1 = 0 c2 = 0 inByte = 0 outByte = 36 'a "$" - bling-bling yall main: PORTB = colors[c1] PORTA = colors[c2] SERIN2 rxtxpin, 16468, 100, timedout, [inByte] IF (inByte == 63) THEN PAUSE 5 SEROUT2 rxtxpin, 16468, [outByte, 10, 13] inByte = 0 PAUSE 1 GOTO main ENDIF IF (inByte >= 48) && (inByte <= 57) THEN c1 = inByte - 48 inByte = 0 PAUSE 1 GOTO main ENDIF IF (inByte == 122) THEN '"z" c2 = 1 inByte = 0 PAUSE 1 GOTO main ENDIF IF (inByte == 120) THEN '"x" c2 = 2 inByte = 0 PAUSE 1 GOTO main ENDIF IF (inByte == 99) THEN '"c" c2 = 3 inByte = 0 PAUSE 1 GOTO main ENDIF IF (inByte == 118) THEN '"v" c2 = 4 inByte = 0 PAUSE 1 GOTO main ENDIF IF (inByte == 98) THEN '"b" c2 = 5 inByte = 0 PAUSE 1 GOTO main ENDIF IF (inByte == 110) THEN '"n" c2 = 6 inByte = 0 PAUSE 1 GOTO main ENDIF IF (inByte == 109) THEN '"m" c2 = 7 inByte = 0 PAUSE 1 GOTO main ENDIF IF (inByte == 44) THEN '"," c2 = 0 inByte = 0 PAUSE 1 GOTO main ENDIF PAUSE 1 GOTO main timedout: PAUSE 1 GOTO main