<root>
<document schema='101' license='1,,eds.
' title='' description='' target='PIC.16F.16F88' >
	<config data='!0,3f0a!10,3ffe%0,2%2,0%3,1%5,0%6,0%7,0%8,1%9,3%b,1%c,1%d,1%10,0%11,1' clkspd='20000000' simspd='4' usewdt='0' constif='0' />
	<plugins >
		<dll_dbg_icd enabled='0' >
			<data name='debug' value='1' />
			<data name='userpins' value='0' />
			<data name='speed' value='0' />
			<data name='usev9' value='0' />
			<data name='breaks' value='8' />
			<data name='stacks' value='8' />
			<data name='clkport' value='1' />
			<data name='clkbit' value='6' />
			<data name='dataport' value='1' />
			<data name='databit' value='7' />
			<data name='ghostype' value='0' />
			<data name='monitor' value='1' />
			<data name='ictloop' value='0' />
			<data name='ictrate' value='20000' />
			<data name='ictmask' value='0' />
			<data name='anlpres' value='19' />
			<data name='digmask1' value='-1' />
			<data name='digmask2' value='-1' />
		</dll_dbg_icd>
		<dll_models enabled='1' />
		<dll_upgrader enabled='1' />
		<dll_webhelp enabled='1' />
	</plugins>
	<supplement use='0' head='' body='' />
	<debug >
		<watch expr='maksVol' />
		<watch expr='gnsVol' />
		<watch expr='volumen' />
	</debug>
	<components >
		<settings autoimg='1' center='1' unitscale='0' fixedscale='0' fixedx='1' fixedy='1' fixedz='1' headcode='0' />
		<definition guid='' vstate='40' vmin='0' vmaj='1' srcleaf='' visiblename='' description='' category='' catenable='1' author='' manuname='' manucode='' sysinfo='0' keywords='' dynamic='0' iconpath='' />
		<component class_type='root' codename='panel' x='0' y='0' z='0' xsz='1' ysz='1' zsz='1' xang='0' yang='0' zang='0' xquat='0' yquat='0' zquat='0' wquat='1' visible='1' interactive='1' solid='1' layer='0' poslock='0' >
			<resources />
			<properties />
			<values />
			<events />
			<apis />
			<variables >
				<variable public='0' >
					<def class_type='variable' name='farve32' type='u32' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='antalLED' type='u8' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='lysStyrke' type='s16' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='maks' type='s16' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='halvLED' type='u8' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='false' type='b1' description='' isconst='1' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='blueArray' type='u8' description='' isconst='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
						<array size='14' />
					</def>
				</variable>
				<variable public='0' >
					<def class_type='variable' name='gnsBump' type='s16' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='sidstVol' type='s16' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='redArray' type='u8' description='' isconst='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
						<array size='14' />
					</def>
				</variable>
				<variable public='0' >
					<def class_type='variable' name='farve' type='s16' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='min' type='s16' description='' isconst='0' isinit='1' usrinit='1023' setinit='1023' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='bump' type='b1' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='volumen' type='s16' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='lyd' type='s16' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='gnsVol' type='s16' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='greenArray' type='u8' description='' isconst='0' isinit='0' usrinit='&quot;&quot;' setinit='' >
						<array size='14' />
					</def>
				</variable>
				<variable public='0' >
					<def class_type='variable' name='j' type='u8' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='true' type='b1' description='' isconst='1' isinit='1' usrinit='1' setinit='1' />
				</variable>
				<variable public='0' >
					<def class_type='variable' name='maksVol' type='s16' description='' isconst='0' isinit='1' usrinit='15' setinit='15' />
				</variable>
			</variables>
			<macros >
				<macro >
					<flowline name='EN' description='Denne Makro sender et logisk 1 til LED&apos;erne' >
						<return name='Return' type='v0' description='' isconst='0' isinit='0' usrinit='' setinit='' />
						<command class_type='native' title='C Kode' textarea='36,0,511,300' ccode='//EN
//Denne tænder slukker LED&apos;en.
#asm
        ;MOVLW  0
        ;MOVWF  _trisa
        ;MOVLW   25
        ;MOVWF   _FCV_GENTAG
;begin1:  DECFSZ  _FCV_GENTAG, F
;        GOTO    send1
;        GOTO    slut1

        BCF    STATUS, 5
        BCF    STATUS, 6
send1:   BSF     PORTA, 0
        NOP     ;&lt;=2 NOP = 0 og &gt;2 NOP = 1
        NOP
        NOP
        BCF     PORTA, 0
;        GOTO    begin1
slut1:   ;END
#endasm' cmdcolor='3389439' cmdcolor_sec='3389439' language='C' />
						<command class_type='native' title='C Kode' textarea='36,0,511,300' disable='1' ccode='//EN
//Denne tænder slukker LED&apos;en.
#asm
        ;MOVLW  0
        ;MOVWF  _TRISA
        ;MOVLW   25
        ;MOVWF   _FCV_GENTAG
;begin1:  DECFSZ  _FCV_GENTAG, F
;        GOTO    send1
;        GOTO    slut1


send1:   BSF     PORTA, 0
        NOP     ;&lt;=2 NOP = 0 og &gt;2 NOP = 1
        NOP
        NOP
        BCF     PORTA, 0
;        GOTO    begin1
slut1:   ;END
#endasm' cmdcolor='3389439' cmdcolor_sec='3389439' language='C' />
					</flowline>
				</macro>
				<macro >
					<flowline name='VIS' description='This makro is very time-critical because it output data to WS2812 addressable LEDs
This is why it is mostly written in assembly
This macro calls EN (one) and nul (zero) which creates an output sekvense which is recognized by the LED&apos;s as a 1 or 0' >
						<return name='Return' type='v0' description='' isconst='0' isinit='0' usrinit='' setinit='' />
						<local name='sammenligner' type='u8' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
						<local name='n' type='u8' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
						<local name='m' type='u8' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<local name='R' type='u8' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
						<local name='G' type='u8' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
						<local name='B' type='u8' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
						<command class_type='native' title='C Kode' textarea='36,0,511,300' ccode='//Denne blok er tilsyneladende ligegyldig
//Blokken er beholdt af hensyn til stabilitet
#asm
        BSF    STATUS, 5
        BCF    STATUS, 6
        MOVLW  250
        MOVWF  TRISA
        BCF    STATUS, 5
        BCF    STATUS, 6
#endasm' cmdcolor='3389439' cmdcolor_sec='3389439' language='C' />
						<command class_type='calculation' title='Beregning' cmdcolor='7895044' cmdcolor_sec='7895044' >
							<exp exp='.m = 0' />
						</command>
						<command class_type='native' title='C Kode' ccode='#asm
ledloop
#endasm' cmdcolor='3389439' cmdcolor_sec='3389439' language='C' />
						<command class_type='native' title='C Kode' ccode='#asm
    MOVF     FCM_VIS@FCL_M, W
    ADDLW    _FCV_REDARRAY
    MOVWF    FSR
    BCF      STATUS, 7
    MOVF     INDF, W
    MOVWF    FCM_VIS@FCL_R
#endasm' cmdcolor='3389439' cmdcolor_sec='3389439' language='C' />
						<command class_type='native' title='C Kode' ccode='#asm
    MOVF     FCM_VIS@FCL_M, W
    ADDLW    _FCV_GREENARRAY
    MOVWF    FSR
    BCF      STATUS, 7
    MOVF     INDF, W
    MOVWF    FCM_VIS@FCL_G
#endasm' cmdcolor='3389439' cmdcolor_sec='3389439' language='C' />
						<command class_type='native' title='C Kode' ccode='#asm
    MOVF     FCM_VIS@FCL_M, W
    ADDLW    _FCV_BLUEARRAY
    MOVWF    FSR
    BCF      STATUS, 7
    MOVF     INDF, W
    MOVWF    FCM_VIS@FCL_B
#endasm' cmdcolor='3389439' cmdcolor_sec='3389439' language='C' />
						<command class_type='native' title='C Kode' ccode='#asm
    MOVLW    8
    MOVWF    FCM_VIS@FCL_N
    MOVLW    128
    MOVWF    FCM_VIS@FCL_SAMMENLIGNER
loopred:
    MOVF     FCM_VIS@FCL_SAMMENLIGNER, W    
    ANDWF    FCM_VIS@FCL_R, W
    SUBWF    FCM_VIS@FCL_SAMMENLIGNER, W
    BTFSS    STATUS, 2
    GOTO     nulred
    CALL     _FCM_EN
    GOTO     contred
nulred:
    CALL     _FCM_NUL
contred:
    BCF      STATUS, 0
    RRF      FCM_VIS@FCL_SAMMENLIGNER, F
    ;BCF      STATUS, 2
    MOVLW    1
    SUBWF    FCM_VIS@FCL_N, F
    BTFSS    STATUS, 2
    GOTO     loopred
    BCF      STATUS, 2
#endasm
' cmdcolor='3389439' cmdcolor_sec='3389439' language='C' />
						<command class_type='native' title='C Kode' ccode='#asm
    MOVLW 8
    MOVWF FCM_VIS@FCL_N
    MOVLW 128
    MOVWF FCM_VIS@FCL_SAMMENLIGNER
loopgreen:
    MOVF     FCM_VIS@FCL_SAMMENLIGNER, W    
    ANDWF    FCM_VIS@FCL_G, W
    SUBWF    FCM_VIS@FCL_SAMMENLIGNER, W
    BTFSS    STATUS, 2
    GOTO     nulgreen
    CALL     _FCM_EN
    GOTO     contgreen
nulgreen:
    CALL     _FCM_NUL
contgreen:
    BCF      STATUS, 0
    RRF      FCM_VIS@FCL_SAMMENLIGNER, F
    MOVLW    1
    SUBWF    FCM_VIS@FCL_N, F
    BTFSS    STATUS, 2
    GOTO     loopgreen
    BCF      STATUS, 2
#endasm' cmdcolor='3389439' cmdcolor_sec='3389439' language='C' />
						<command class_type='native' title='C Kode' ccode='#asm
    MOVLW 8
    MOVWF FCM_VIS@FCL_N
    MOVLW 128
    MOVWF FCM_VIS@FCL_SAMMENLIGNER
loopblue:
    MOVF     FCM_VIS@FCL_SAMMENLIGNER, W    
    ANDWF    FCM_VIS@FCL_B, W
    SUBWF    FCM_VIS@FCL_SAMMENLIGNER, W
    BTFSS    STATUS, 2
    GOTO     nulblue
    CALL     _FCM_EN
    GOTO     contblue
nulblue:
    CALL     _FCM_NUL
contblue:
    BCF      STATUS, 0
    RRF      FCM_VIS@FCL_SAMMENLIGNER, F
    ;BCF      STATUS, 2
    MOVLW    1
    SUBWF    FCM_VIS@FCL_N, F
    BTFSS    STATUS, 2
    GOTO     loopblue
    BCF      STATUS, 2
#endasm' cmdcolor='3389439' cmdcolor_sec='3389439' language='C' />
						<command class_type='native' title='C Kode' ccode='#asm
    INCF       FCM_VIS@FCL_M, F
    MOVF       FCM_VIS@FCL_M, W
    BCF        STATUS, 2
    SUBWF      _FCV_ANTALLED, W
    BTFSS      STATUS, 2
    GOTO       ledloop
#endasm' cmdcolor='3389439' cmdcolor_sec='3389439' language='C' />
					</flowline>
				</macro>
				<macro >
					<flowline name='Split' description='This makro collects a 32 bit RGB-value and returns on of the bytes, depending on the value of parameter i' >
						<return name='Return' type='u8' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<param name='i' type='u8' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<param name='farve32' type='u32' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<command class_type='switch' title='Switch' textarea='36,25,511,325' cmdcolor='3568629' cmdcolor_sec='3568629' exp='.i' >
							<case >
								<flowline />
							</case>
							<case exp='0' >
								<flowline >
									<command class_type='calculation' title='Beregning' textarea='36,0,511,300' cmdcolor='7895044' cmdcolor_sec='7895044' >
										<exp exp='.farve32 = .farve32 &gt;&gt; 16 //rød' />
										<exp exp='.farve32 = .farve32 AND 255' />
										<exp exp='.Return = .farve32' />
									</command>
								</flowline>
							</case>
							<case exp='1' >
								<flowline >
									<command class_type='calculation' title='Beregning' textarea='36,0,511,300' cmdcolor='7895044' cmdcolor_sec='7895044' >
										<exp exp='.farve32 = .farve32 &gt;&gt; 8 //grøn' />
										<exp exp='.farve32 = .farve32 AND 255' />
										<exp exp='.Return = .farve32' />
									</command>
								</flowline>
							</case>
							<case exp='2' >
								<flowline >
									<command class_type='calculation' title='Beregning' textarea='36,0,511,300' cmdcolor='7895044' cmdcolor_sec='7895044' >
										<exp exp='.farve32 = .farve32 &gt;&gt; 0 //blå' />
										<exp exp='.farve32 = .farve32 AND 255' />
										<exp exp='.Return = .farve32' />
									</command>
								</flowline>
							</case>
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='regnbue' description='This macro is changing the colors on the LED&apos;s in a rainbow pattern' >
						<return name='Return' type='u32' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<param name='i' type='s16' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<command class_type='native' title='C Kode' textarea='36,0,511,300' ccode='//Ikke rekursiv
//1530=255*6: der er 6 kombinationer
if (FCL_I&gt;1529) FCL_I=FCL_I%1530; //FCR_RETVAL=FCM_regnbue(FCL_I%1530);
if (FCL_I&gt;1274) FCR_RETVAL=FCM_saml(255,0,255-(FCL_I%255));
else if (FCL_I&gt;1019) FCR_RETVAL=FCM_saml((FCL_I%255),0,255);
else if (FCL_I&gt;764) FCR_RETVAL=FCM_saml(0,255-(FCL_I%255),255);
else if (FCL_I&gt;509) FCR_RETVAL=FCM_saml(0,255,(FCL_I%255));
else if (FCL_I&gt;255) FCR_RETVAL=FCM_saml(255-(FCL_I%255),255,0);
else FCR_RETVAL=FCM_saml(255,FCL_I,0);' cmdcolor='3389439' cmdcolor_sec='3389439' language='C' />
					</flowline>
				</macro>
				<macro >
					<flowline name='Setup' description='Sets up the collors on one of the leds.
' >
						<return name='Return' type='v0' description='' isconst='0' isinit='0' usrinit='' setinit='' />
						<param name='led' type='u8' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<param name='r' type='u8' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<param name='g' type='u8' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<param name='b' type='u8' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<command class_type='calculation' title='Beregning' textarea='36,0,511,300' cmdcolor='7895044' cmdcolor_sec='7895044' >
							<exp exp='redArray[.led - 1] = .r' />
							<exp exp='greenArray[.led - 1] = .g' />
							<exp exp='blueArray[.led - 1] = .b' />
						</command>
					</flowline>
				</macro>
				<macro >
					<flowline name='NUL' description='Denne Makro sender et logisk 0 til LED&apos;erne' >
						<return name='Return' type='v0' description='' isconst='0' isinit='0' usrinit='' setinit='' />
						<command class_type='native' title='C Kode' textarea='36,0,511,300' ccode='//NUL
//Denne kode slukker LED&apos;en.
#asm
        ;MOVLW  0
        ;MOVWF  _trisa
        ;MOVLW   25
        ;MOVWF   _FCV_GENTAG
;begin0:  DECFSZ  _FCV_GENTAG, F
        ;GOTO    send0
        ;GOTO    slut0

        BCF    STATUS, 5
        BCF    STATUS, 6
send0:   BSF     PORTA, 0
        NOP     ;&lt;=2 NOP = 0 og &gt;2 NOP = 1
        BCF     PORTA, 0
        ;GOTO    begin0
slut0:   ;END
#endasm' cmdcolor='3389439' cmdcolor_sec='3389439' language='C' />
						<command class_type='native' title='C Kode' textarea='36,0,511,300' disable='1' ccode='//NUL
//Denne kode slukker LED&apos;en.
#asm
        ;MOVLW  0
        ;MOVWF  TRISA
        ;MOVLW   25
        ;MOVWF   _FCV_GENTAG
;begin0:  DECFSZ  _FCV_GENTAG, F
        ;GOTO    send0
        ;GOTO    slut0


send0:   BSF     PORTA, 0
        NOP     ;&lt;=2 NOP = 0 og &gt;2 NOP = 1
        BCF     PORTA, 0
        ;GOTO    begin0
slut0:   ;END
#endasm' cmdcolor='3389439' cmdcolor_sec='3389439' language='C' />
					</flowline>
				</macro>
				<macro >
					<flowline name='saml' description='This macro collects 3 bytes and concatenate those to one 32 bit RGB-value' >
						<return name='Return' type='u32' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<param name='r' type='u8' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<param name='g' type='u8' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<param name='b' type='u8' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<local name='bit32' type='u32' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
						<command class_type='native' title='C Kode' textarea='36,0,511,300' ccode='FCL_BIT32 = FCL_R;
FCL_BIT32 = FCL_BIT32 &lt;&lt; 8;
FCL_BIT32 = FCL_BIT32 + FCL_G;
FCL_BIT32 = FCL_BIT32 &lt;&lt; 8;
FCL_BIT32 = FCL_BIT32 + FCL_B;
FCR_RETVAL = FCL_BIT32;
//return FCL_BIT32;' cmdcolor='3389439' cmdcolor_sec='3389439' language='C' />
					</flowline>
				</macro>
				<macro >
					<flowline name='Fade' description='' >
						<return name='Return' type='v0' description='' isconst='0' isinit='0' usrinit='' setinit='' />
						<param name='fader' type='u8' description='' isconst='0' isinit='0' usrinit='0' setinit='' />
						<local name='RGBArray' type='u16' description='' isconst='0' isinit='0' usrinit='0' setinit='' >
							<array size='3' />
						</local>
						<local name='farve32' type='u32' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
						<local name='i' type='u8' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
						<local name='j' type='u8' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
						<command class_type='comment' title='' comment='Oprettet: FCL_I og FCL_J //er ikke oprettet i FlowCode og kan derfor skabe problemer' textarea='12,0,487,300' cmdcolor='1975743' cmdcolor_sec='1975743' />
						<command class_type='native' title='C Kode' textarea='36,0,511,300' ccode='for (FCL_I = 0; FCL_I &lt; FCV_ANTALLED; FCL_I++)
{
     FCL_FARVE32 = FCM_saml(FCV_REDARRAY[FCL_I], FCV_GREENARRAY[FCL_I], FCV_BLUEARRAY[FCL_I]);

     FCL_FARVE32 = (FCL_FARVE32) ? FCL_FARVE32 : 0; //MÅSKE: der spørges om farve32 er sand (har en værdi), hvis det er tilfældet sættes farve32=farve32 ellers sættes farve32=0

     if (FCL_FARVE32 == 0) continue;

     for (FCL_J = 0; FCL_J &lt; 3; FCL_J++)
     {
          FCL_RGBARRAY[FCL_J] = (FCM_Split(FCL_J, FCL_FARVE32) * FCL_FADER)/255;
     }

     FCM_Setup(FCL_I+1, FCL_RGBARRAY[0], FCL_RGBARRAY[1], FCL_RGBARRAY[2]);
}' cmdcolor='3389439' cmdcolor_sec='3389439' language='C' />
					</flowline>
				</macro>
				<macro >
					<flowline name='Pulse' description='This macro is deciding the color an light-intensity on each LED, sets the color value on the LED, by calling setup, on the LED' >
						<return name='Return' type='v0' description='' isconst='0' isinit='0' usrinit='' setinit='' />
						<local name='startLED' type='s16' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
						<local name='slutLED' type='s16' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
						<local name='k' type='u8' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
						<local name='re' type='s32' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
						<local name='gr' type='s32' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
						<local name='bl' type='s32' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
						<local name='a' type='s16' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
						<local name='l' type='u8' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
						<local name='lydDaemp' type='s32' description='' isconst='0' isinit='1' usrinit='0' setinit='0' />
						<local name='daemp' type='u8' description='' isconst='0' isinit='1' usrinit='255' setinit='255' />
						<command class_type='call' title='Kald Macro' textarea='36,0,511,300' cmdcolor='1975743' cmdcolor_sec='1975743' macro='Fade' >
							<argument exp='191' />
						</command>
						<command class_type='decision' title='Beslutning' textarea='36,0,511,300' cmdcolor='3568629' cmdcolor_sec='3568629' exp='bump' swap='0' >
							<flowline >
								<command class_type='calculation' title='Beregning' textarea='36,0,511,300' cmdcolor='7895044' cmdcolor_sec='7895044' >
									<exp exp='farve = farve + 32 //64' />
								</command>
							</flowline>
							<flowline />
						</command>
						<command class_type='decision' title='Beslutning' textarea='36,0,511,300' cmdcolor='3568629' cmdcolor_sec='3568629' exp='volumen &gt; 0' swap='0' >
							<flowline >
								<command class_type='calculation' title='Beregning' textarea='36,0,511,300' cmdcolor='7895044' cmdcolor_sec='7895044' >
									<exp exp='farve32 = regnbue (farve)' />
								</command>
								<command class_type='comment' title='' comment='Nu virker startLED og slutLED korrekt (sammen med FlowCode-blokkene, frem for den nedestående C-blok)
Mangler dog at gange med daemp-faktoren
Problemet med daempfaktoren er at de yderste LED&apos;er, anltid er 0' textarea='102,23,577,323' cmdcolor='1975743' cmdcolor_sec='1975743' />
								<command class_type='calculation' title='Beregning' textarea='36,0,511,300' cmdcolor='7895044' cmdcolor_sec='7895044' >
									<exp exp='.startLED = halvLED - ((halvLED * volumen) / maksVol)' />
									<exp exp='.slutLED = halvLED + ((halvLED * volumen) / maksVol) + antalLED % 2' />
									<exp exp='//.startLED = 2' />
									<exp exp='//.slutLED = 3' />
								</command>
								<command class_type='calculation' title='Beregning' textarea='36,0,511,300' cmdcolor='7895044' cmdcolor_sec='7895044' >
									<exp exp='.k = .startLED' />
								</command>
								<command class_type='loop' title='Loop' textarea='36,0,511,300' cmdcolor='3568629' cmdcolor_sec='3568629' type='0' exp='.k &lt; .slutLED' >
									<flowline >
										<command class_type='comment' title='' comment='Problemer skulle være løst nu
Der tages ikke højde for at den yderste tændte LED-skal lyse mindst
En LED lyser altid med den samme styrke, uanset antallet af tændte LED&apos;er' textarea='12,0,487,300' cmdcolor='1975743' cmdcolor_sec='1975743' />
										<command class_type='calculation' title='Beregning' textarea='36,0,511,300' cmdcolor='7895044' cmdcolor_sec='7895044' >
											<exp exp='.l = .k - .startLED' />
										</command>
										<command class_type='calculation' title='Beregning' textarea='36,0,511,300' cmdcolor='7895044' cmdcolor_sec='7895044' >
											<exp exp='//.a = (255 * 2) / (antalLED + (antalLED % 2))' />
											<exp exp='.a = (510) / ((.slutLED - .startLED) + ((.slutLED - .startLED) % 2))' />
											<exp exp='//510=255*2' />
										</command>
										<command class_type='comment' title='' comment='Nedestående IF-sætning regner en værdi forkert for midten ved et lige antal LED&apos;er' textarea='12,0,487,300' cmdcolor='1975743' cmdcolor_sec='1975743' />
										<command class_type='decision' title='Beslutning' textarea='36,0,511,300' cmdcolor='3568629' cmdcolor_sec='3568629' exp='.k &gt; halvLED' swap='0' >
											<flowline >
												<command class_type='calculation' title='Beregning' textarea='36,0,511,300' cmdcolor='7895044' cmdcolor_sec='7895044' >
													<exp exp='//daemp = - .a * .k + 510 - ((antalLED % 2) * .a)' />
													<exp exp='.daemp = - .a * .l + 510 - (((.slutLED - .startLED) % 2) * .a)' />
												</command>
											</flowline>
											<flowline >
												<command class_type='calculation' title='Beregning' textarea='36,0,511,300' cmdcolor='7895044' cmdcolor_sec='7895044' >
													<exp exp='.daemp = .a * .l + .a' />
												</command>
											</flowline>
										</command>
										<command class_type='call' title='Kald Macro' textarea='36,0,511,300' cmdcolor='1975743' cmdcolor_sec='1975743' macro='Split' >
											<return exp='.re' />
											<argument exp='0' />
											<argument exp='farve32' />
										</command>
										<command class_type='call' title='Kald Macro' textarea='36,0,511,300' cmdcolor='1975743' cmdcolor_sec='1975743' macro='Split' >
											<return exp='.gr' />
											<argument exp='1' />
											<argument exp='farve32' />
										</command>
										<command class_type='call' title='Kald Macro' textarea='36,0,511,300' cmdcolor='1975743' cmdcolor_sec='1975743' macro='Split' >
											<return exp='.bl' />
											<argument exp='2' />
											<argument exp='farve32' />
										</command>
										<command class_type='calculation' title='Beregning' textarea='36,0,511,300' cmdcolor='7895044' cmdcolor_sec='7895044' >
											<exp exp='.re = (.re * .daemp) / 255' />
											<exp exp='.gr = (.gr * .daemp) / 255' />
											<exp exp='.bl = (.bl * .daemp) / 255' />
										</command>
										<command class_type='calculation' title='Beregning' textarea='36,0,511,300' ccode='// Beregning
// Beregning:
//  .re = (.re * lysStyrke) / 1023
//  .gr = (.gr * lysStyrke) / 1023
//  .bl = (.bl * lysStyrke) / 1023
FCL_RE = (FCL_RE * FCV_LYSSTYRKE) / 1023;
FCL_GR = (FCL_GR * FCV_LYSSTYRKE) / 1023;
FCL_BL = (FCL_BL * FCV_LYSSTYRKE) / 1023;
' cmdcolor='7895044' cmdcolor_sec='7895044' >
											<exp exp='.re = (.re * lysStyrke) / 1023' />
											<exp exp='.gr = (.gr * lysStyrke) / 1023' />
											<exp exp='.bl = (.bl * lysStyrke) / 1023' />
										</command>
										<command class_type='calculation' title='Beregning' textarea='36,0,511,300' disable='1' cmdcolor='7895044' cmdcolor_sec='7895044' >
											<exp exp='//.lydDaemp = (255 * volumen * volumen) / (maksVol * maksVol)' />
											<exp exp='//.lydDaemp = .lydDaemp AND 255' />
											<exp exp='.lydDaemp = 255 * gnsVol' />
											<exp exp='.lydDaemp = .lydDaemp / maksVol' />
											<exp exp='//.lydDaemp = .lydDaemp * volumen' />
											<exp exp='//.lydDaemp = .lydDaemp / maksVol' />
										</command>
										<command class_type='calculation' title='Beregning' textarea='36,0,511,300' disable='1' cmdcolor='7895044' cmdcolor_sec='7895044' >
											<exp exp='.re = (.re * .lydDaemp) / 255' />
											<exp exp='.gr = (.gr * .lydDaemp) / 255' />
											<exp exp='.bl = (.bl * .lydDaemp) / 255' />
										</command>
										<command class_type='calculation' title='Beregning' textarea='36,0,511,300' cmdcolor='7895044' cmdcolor_sec='7895044' >
											<exp exp='//dæmper i forhold til lydstyrken' />
											<exp exp='//det der før var omfattet af .lydDaemp' />
											<exp exp='.re = (.re * gnsVol) / maksVol' />
											<exp exp='.gr = (.gr * gnsVol) / maksVol' />
											<exp exp='.bl = (.bl * gnsVol) / maksVol' />
										</command>
										<command class_type='call' title='Kald Macro' textarea='36,0,511,300' cmdcolor='1975743' cmdcolor_sec='1975743' macro='Setup' >
											<argument exp='.k + 1' />
											<argument exp='.re' />
											<argument exp='.gr' />
											<argument exp='.bl' />
										</command>
										<command class_type='calculation' title='Beregning' textarea='36,0,511,300' cmdcolor='7895044' cmdcolor_sec='7895044' >
											<exp exp='.k = .k + 1' />
										</command>
									</flowline>
								</command>
								<command class_type='comment' title='' comment='I sidste linje af forrige C-block kunne man indføre noget alla følgende som en faktor på farven
*(255*(volumen*volumen)/(maksVol*maksVol)
På den måde skulle lyset blive skarpere ved højere lyd' textarea='12,0,487,300' disable='1' cmdcolor='1975743' cmdcolor_sec='1975743' />
							</flowline>
							<flowline />
						</command>
						<command class_type='call' title='Kald Macro' textarea='36,0,511,300' cmdcolor='1975743' cmdcolor_sec='1975743' macro='VIS' />
					</flowline>
				</macro>
				<macro >
					<flowline name='Main' description='The whole idea with the program is to collect som sound from a microphone into the ADC on port A1, and then making the LED&apos;s light up in response to the sounds the microphone collects' >
						<return name='Return' type='v0' description='' isconst='0' isinit='0' usrinit='' setinit='' />
						<command class_type='calculation' title='Beregning' textarea='36,0,511,300' cmdcolor='7895044' cmdcolor_sec='7895044' >
							<exp exp='j = 1' />
						</command>
						<command class_type='loop' title='Loop' textarea='36,0,511,300' cmdcolor='3568629' cmdcolor_sec='3568629' type='1' exp='j &gt;= 13' >
							<flowline >
								<command class_type='call' title='Kald Macro' textarea='36,0,511,300' cmdcolor='1975743' cmdcolor_sec='1975743' macro='Setup' >
									<argument exp='j' />
									<argument exp='0' />
									<argument exp='0' />
									<argument exp='0' />
								</command>
								<command class_type='calculation' title='Beregning' textarea='36,0,511,300' cmdcolor='7895044' cmdcolor_sec='7895044' >
									<exp exp='j = j + 1' />
								</command>
							</flowline>
						</command>
						<command class_type='calculation' title='Beregning' textarea='36,0,511,300' cmdcolor='7895044' cmdcolor_sec='7895044' >
							<exp exp='antalLED = 13 //the number of LED&apos;s (equal array size)' />
							<exp exp='halvLED = antalLED / 2' />
						</command>
						<command class_type='call' title='Kald Macro' textarea='36,0,511,300' ccode='//Kald Macro
//Kald Macro: Vis()
FCM_Vis();
' cmdcolor='1975743' cmdcolor_sec='1975743' macro='VIS' />
						<command class_type='loop' title='Loop' textarea='36,0,511,300' cmdcolor='3568629' cmdcolor_sec='3568629' type='0' exp='1' >
							<flowline >
								<command class_type='call' title='Kald Komponent Macro' textarea='36,0,511,300' cmdcolor='1975743' cmdcolor_sec='1975743' component='v5__adc1' macro='GetInt' >
									<return exp='lysStyrke' />
								</command>
								<command class_type='calculation' title='Beregning' textarea='36,0,511,300' cmdcolor='7895044' cmdcolor_sec='7895044' >
									<exp exp='min = 1023' />
									<exp exp='maks = 0' />
								</command>
								<command class_type='loop' title='Loop' textarea='36,0,511,300' cmdcolor='3568629' cmdcolor_sec='3568629' type='2' exp='200' >
									<flowline >
										<command class_type='call' title='Kald Komponent Macro' textarea='36,0,511,300' cmdcolor='1975743' cmdcolor_sec='1975743' component='v5__adc0' macro='GetInt' >
											<return exp='lyd' />
										</command>
										<command class_type='decision' title='Beslutning' textarea='36,0,511,300' cmdcolor='3568629' cmdcolor_sec='3568629' exp='lyd &gt; maks' swap='0' >
											<flowline >
												<command class_type='calculation' title='Beregning' textarea='36,0,511,300' cmdcolor='7895044' cmdcolor_sec='7895044' >
													<exp exp='maks = lyd' />
												</command>
											</flowline>
											<flowline >
												<command class_type='decision' title='Beslutning' textarea='36,0,511,300' cmdcolor='3568629' cmdcolor_sec='3568629' exp='lyd &lt; min' swap='0' >
													<flowline >
														<command class_type='calculation' title='Beregning' textarea='36,0,511,300' cmdcolor='7895044' cmdcolor_sec='7895044' >
															<exp exp='min = lyd' />
														</command>
													</flowline>
													<flowline />
												</command>
											</flowline>
										</command>
										<command class_type='delay' title='Delay ' textarea='36,0,511,300' cmdcolor='7895044' cmdcolor_sec='7895044' exp='50' type='0' />
									</flowline>
								</command>
								<command class_type='calculation' title='Beregning' textarea='36,0,511,300' cmdcolor='7895044' cmdcolor_sec='7895044' >
									<exp exp='volumen = maks - min' />
									<exp exp='gnsVol = (gnsVol + volumen) / 2' />
								</command>
								<command class_type='decision' title='Beslutning' cmdcolor='3568629' cmdcolor_sec='3568629' exp='(volumen &lt; (gnsVol / 2)) || (volumen &lt; 40)' swap='0' >
									<flowline >
										<command class_type='calculation' title='Beregning' textarea='36,0,511,300' cmdcolor='7895044' cmdcolor_sec='7895044' >
											<exp exp='volumen = 0' />
										</command>
									</flowline>
									<flowline />
								</command>
								<command class_type='decision' title='Beslutning' textarea='36,0,511,300' cmdcolor='3568629' cmdcolor_sec='3568629' exp='volumen &gt; maksVol' swap='0' >
									<flowline >
										<command class_type='calculation' title='Beregning' textarea='36,0,511,300' cmdcolor='7895044' cmdcolor_sec='7895044' >
											<exp exp='maksVol = Volumen' />
										</command>
									</flowline>
									<flowline />
								</command>
								<command class_type='decision' title='Beslutning' textarea='36,0,511,300' cmdcolor='3568629' cmdcolor_sec='3568629' exp='farve &gt; 1529' swap='0' >
									<flowline >
										<command class_type='calculation' title='Beregning' textarea='36,0,511,300' cmdcolor='7895044' cmdcolor_sec='7895044' >
											<exp exp='farve = farve % 1530' />
											<exp exp='maksVol = (maksVol + volumen) / 2' />
										</command>
									</flowline>
									<flowline />
								</command>
								<command class_type='decision' title='Beslutning' textarea='36,0,511,300' cmdcolor='3568629' cmdcolor_sec='3568629' exp='((volumen - sidstVol) &gt; (gnsVol - sidstVol)) &amp;&amp; ((gnsVol - sidstVol) &gt; 0)' swap='0' >
									<flowline >
										<command class_type='calculation' title='Beregning' textarea='36,0,511,300' cmdcolor='7895044' cmdcolor_sec='7895044' >
											<exp exp='gnsBump = (gnsBump + (volumen - sidstVol)) / 2' />
										</command>
									</flowline>
									<flowline />
								</command>
								<command class_type='calculation' title='Beregning' textarea='36,0,511,300' cmdcolor='7895044' cmdcolor_sec='7895044' >
									<exp exp='bump = (volumen - sidstVol) &gt; gnsBump' />
								</command>
								<command class_type='call' title='Kald Macro' textarea='36,0,511,300' cmdcolor='1975743' cmdcolor_sec='1975743' macro='Pulse' />
								<command class_type='calculation' title='Beregning' textarea='36,0,511,300' cmdcolor='7895044' cmdcolor_sec='7895044' >
									<exp exp='farve = farve + 1' />
								</command>
								<command class_type='delay' title='Delay ' textarea='36,0,511,300' cmdcolor='7895044' cmdcolor_sec='7895044' exp='3' type='1' />
							</flowline>
						</command>
					</flowline>
				</macro>
			</macros>
			<component class_type='ref' guid='0953aac0-9c23-4c2f-9843-88954a4191ea' vmin='3' vmaj='2' codename='v5__lcddisplay0' x='-46.8571' y='22.2857' z='0' xsz='78.2857' ysz='13.1429' zsz='1.14286' xang='0' yang='0' zang='0' xquat='0' yquat='0' zquat='0' wquat='1' visible='1' interactive='1' solid='1' layer='0' poslock='0' >
				<resources />
				<properties />
				<values >
					<value target='LCD_Mode' data='000' />
					<value target='Pin_Data_0' data='$PORTB0.0' />
					<value target='Pin_Data_1' data='$PORTB0.1' />
					<value target='Pin_Data_2' data='$PORTB0.2' />
					<value target='Pin_Data_3' data='$PORTB0.3' />
					<value target='Pin_Data_4' data='$PORTA.1' />
					<value target='Pin_Data_5' data='$PORTA.1' />
					<value target='Pin_Data_6' data='$PORTA.1' />
					<value target='Pin_Data_7' data='$PORTA.1' />
					<value target='LCD_Port' data='$PORTA' />
					<value target='Pin_RS' data='$PORTB0.4' />
					<value target='Pin_E' data='$PORTB0.5' />
					<value target='LCD_Use_Write' data='0' />
					<value target='Pin_RW' data='$PORTA.0' />
					<value target='Rows' data='2' />
					<value target='Columns' data='16' />
					<value target='DelayTiming' data='100' />
					<value target='BackgroundColor' data='0x808080' />
					<value target='LineColor' data='0' />
					<value target='TextColor' data='0x000000' />
					<value target='Font' data='Fixedsys' />
					<value target='CursorPosX' data='5' />
					<value target='CursorPosY' data='0' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
			<component class_type='ref' guid='14683ea8-5a08-4b3a-be2d-3dea3e17e720' vmin='3' vmaj='1' codename='v5__adc0' x='40' y='2.28571' z='0' xsz='25.1419' ysz='25.1419' zsz='18.45' xang='0' yang='0' zang='0' xquat='0' yquat='0' zquat='0' wquat='1' visible='1' interactive='1' solid='1' layer='0' poslock='0' >
				<resources />
				<properties />
				<values >
					<value target='angle_start' data='225.000000' />
					<value target='angle_sweep' data='270.000000' />
					<value target='cap_color' data='192' />
					<value target='point_color' data='16777215' />
					<value target='ScopeTraces' data='0' />
					<value target='channel' data='1' />
					<value target='vrefvol' data='500' />
					<value target='vrefop' data='000' />
					<value target='convspd' data='003' />
					<value target='actime' data='40' />
					<value target='bits' data='10' />
					<value target='bitmul' data='0.004883' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
			<component class_type='ref' guid='1fb787a5-54fb-4847-9299-3adbf9927b59' vmin='3' vmaj='1' codename='v5__ledrgb0' x='164' y='3.14286' z='0' xsz='6.85714' ysz='6.85714' zsz='1.14286' xang='0' yang='0' zang='0' xquat='0' yquat='0' zquat='0' wquat='1' visible='1' interactive='1' solid='1' layer='0' poslock='0' >
				<resources />
				<properties />
				<values >
					<value target='red_pin' data='$PORTA0.0' />
					<value target='green_pin' data='$PORTA0.1' />
					<value target='blue_pin' data='$PORTA0.2' />
					<value target='polarity' data='0' />
					<value target='colorbitsize' data='008' />
					<value target='rollover' data='256' />
					<value target='target' data='' />
					<value target='Shape' data='007' />
					<value target='Width' data='5.000000' />
					<value target='Height' data='5.000000' />
					<value target='Depth' data='2.500000' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
			<component class_type='ref' guid='14683ea8-5a08-4b3a-be2d-3dea3e17e720' vmin='3' vmaj='1' codename='v5__adc1' x='62.8571' y='2.28571' z='0' xsz='25.1419' ysz='25.1419' zsz='18.45' xang='0' yang='0' zang='0' xquat='0' yquat='0' zquat='0' wquat='1' visible='1' interactive='1' solid='1' layer='0' poslock='0' >
				<resources />
				<properties />
				<values >
					<value target='angle_start' data='225.000000' />
					<value target='angle_sweep' data='270.000000' />
					<value target='cap_color' data='192' />
					<value target='point_color' data='16777215' />
					<value target='ScopeTraces' data='0' />
					<value target='channel' data='3' />
					<value target='vrefvol' data='500' />
					<value target='vrefop' data='0' />
					<value target='convspd' data='3' />
					<value target='actime' data='40' />
					<value target='bits' data='10' />
					<value target='bitmul' data='0.004883' />
				</values>
				<events />
				<apis />
				<variables />
				<macros />
			</component>
		</component>
	</components>
	<keymap />
	<panel2d shadows='0' lighting='2' brightness='0' perspective='0' >
		<background rgb='2105930' img='' style='0' />
		<camera xe='0' ye='0' ze='300' xt='0' yt='0' zt='0' xquat='0' yquat='0' zquat='0' wquat='1' />
	</panel2d>
	<panel3d shadows='0' lighting='2' brightness='0' perspective='0' >
		<background rgb='8409120' img='' style='0' />
		<table rgb='7360576' img='' style='0' size='25' />
		<camera xe='64.2225' ye='1.23979' ze='413.502' xt='64.2225' yt='1.23979' zt='0' xquat='0' yquat='0' zquat='0' wquat='1' />
		<camerakey0 xe='0' ye='0' ze='300' xt='0' yt='0' zt='0' xquat='0' yquat='0' zquat='0' wquat='1' />
		<camerakey1 xe='-3.67394e-14' ye='0' ze='-300' xt='0' yt='0' zt='0' xquat='0' yquat='1' zquat='0' wquat='6.12323e-17' />
		<camerakey2 xe='0' ye='-300' ze='6.66134e-14' xt='0' yt='0' zt='0' xquat='-0.707107' yquat='0' zquat='0' wquat='0.707107' />
		<camerakey3 xe='-3.67394e-14' ye='300' ze='6.66134e-14' xt='0' yt='0' zt='0' xquat='-4.32978e-17' yquat='0.707107' zquat='0.707107' wquat='4.32978e-17' />
		<camerakey4 xe='-300' ye='-6.66134e-14' ze='6.66134e-14' xt='0' yt='0' zt='0' xquat='-0.5' yquat='0.5' zquat='0.5' wquat='0.5' />
		<camerakey5 xe='300' ye='-6.66134e-14' ze='6.66134e-14' xt='0' yt='0' zt='0' xquat='-0.5' yquat='-0.5' zquat='-0.5' wquat='0.5' />
		<camerakey6 xe='-173.205' ye='-173.205' ze='173.205' xt='0' yt='0' zt='0' xquat='-0.424708' yquat='0.17592' zquat='0.339851' wquat='0.820473' />
	</panel3d>
	<layout >
		<view type='0' name='saml' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAYAAAAIwMAAKYBAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='VIS' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAYAAAAIwMAAKYBAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='Main' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAYAAAAIwMAAKYBAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='Pulse' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAYAAAAIwMAAKYBAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='NUL' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAYAAAAIwMAAKYBAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='EN' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAYAAAAIwMAAKYBAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='Split' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAYAAAAIwMAAKYBAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='Setup' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAYAAAAIwMAAKYBAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='Fade' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAYAAAAIwMAAKYBAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
		<view type='0' name='regnbue' mode='0' placement='LAAAAAAAAAABAAAA---------------------wUAAAAYAAAAIwMAAKYBAAA' zoom='75' scrollx='0' scrolly='0' flags='0' />
	</layout>
</document>
</root>
