Code: Select all
/*
subroutine HTTouchMuxValue
set __signed_stack_001HTTouchMuxValue, 1023
getin __D0HTTouchMuxValue, __constVal1, 2
sub __HTTouchMuxValue_7qG2_value_7qG2_000, __signed_stack_001HTTouchMuxValue, __D0HTTouchMuxValue
mul __HTTouchMuxValue_7qG2_switches_7qG2_000, __constVal339, __HTTouchMuxValue_7qG2_value_7qG2_000
sub __D0HTTouchMuxValue, __constVal1023, __HTTouchMuxValue_7qG2_value_7qG2_000
div __HTTouchMuxValue_7qG2_switches_7qG2_000, __HTTouchMuxValue_7qG2_switches_7qG2_000, __D0HTTouchMuxValue
add __HTTouchMuxValue_7qG2_switches_7qG2_000, __HTTouchMuxValue_7qG2_switches_7qG2_000, __constVal5
div __HTTouchMuxValue_7qG2_switches_7qG2_000, __HTTouchMuxValue_7qG2_switches_7qG2_000, __constVal10
set __signed_stack_001HTTouchMuxValue, 3
and __signed_stack_002HTTouchMuxValue, __HTTouchMuxValue_7qG2_switches_7qG2_000, __constVal8
set __D0HTTouchMuxValue, 8
cmp 4, __zfHTTouchMuxValue, __signed_stack_002HTTouchMuxValue, __D0HTTouchMuxValue
mov __D0HTTouchMuxValue, __zfHTTouchMuxValue
replace __HTTouchMuxValue_7qG2__t_7qG2_000, __HTTouchMuxValue_7qG2__t_7qG2_000, __signed_stack_001HTTouchMuxValue, __D0HTTouchMuxValue
set __signed_stack_001HTTouchMuxValue, 2
and __signed_stack_002HTTouchMuxValue, __HTTouchMuxValue_7qG2_switches_7qG2_000, __constVal4
set __D0HTTouchMuxValue, 4
cmp 4, __zfHTTouchMuxValue, __signed_stack_002HTTouchMuxValue, __D0HTTouchMuxValue
mov __D0HTTouchMuxValue, __zfHTTouchMuxValue
replace __HTTouchMuxValue_7qG2__t_7qG2_000, __HTTouchMuxValue_7qG2__t_7qG2_000, __signed_stack_001HTTouchMuxValue, __D0HTTouchMuxValue
set __signed_stack_001HTTouchMuxValue, 1
and __signed_stack_002HTTouchMuxValue, __HTTouchMuxValue_7qG2_switches_7qG2_000, __constVal2
set __D0HTTouchMuxValue, 2
cmp 4, __zfHTTouchMuxValue, __signed_stack_002HTTouchMuxValue, __D0HTTouchMuxValue
mov __D0HTTouchMuxValue, __zfHTTouchMuxValue
replace __HTTouchMuxValue_7qG2__t_7qG2_000, __HTTouchMuxValue_7qG2__t_7qG2_000, __signed_stack_001HTTouchMuxValue, __D0HTTouchMuxValue
set __signed_stack_001HTTouchMuxValue, 0
and __signed_stack_002HTTouchMuxValue, __HTTouchMuxValue_7qG2_switches_7qG2_000, __constVal1
set __D0HTTouchMuxValue, 1
cmp 4, __zfHTTouchMuxValue, __signed_stack_002HTTouchMuxValue, __D0HTTouchMuxValue
mov __D0HTTouchMuxValue, __zfHTTouchMuxValue
replace __HTTouchMuxValue_7qG2__t_7qG2_000, __HTTouchMuxValue_7qG2__t_7qG2_000, __signed_stack_001HTTouchMuxValue, __D0HTTouchMuxValue
subret __HTTouchMuxValue_return
ends
*/
void HTTouchMuxValue(byte port, int & _t[]) {
long switches, value;
value=1023-SensorRaw(S2);
switches=339*value;
switches/=1023-value;
switches+=5;
switches/=10;
_t[3]=((switches&8)==8);
_t[2]=((switches&4)==4);
_t[1]=((switches&2)==2);
_t[0]=((switches&1)==1);
}
task main()
{
int t1, t2, t3, t4;
SetSensorTouch(S1);
/*
getin __HTMplexRaw, __constVal0, 2
mul __HTMplexScaled, __HTMplexRaw, __constVal339
sub __HTMplexScaled, __constVal346797, __HTMplexScaled
div __HTMplexScaled, __HTMplexScaled, __HTMplexRaw
add __HTMplexScaled, __HTMplexScaled, __constVal5
div __HTMplexScaled, __HTMplexScaled, __constVal10
and __main_7qG2_t4_7qG2_000, __HTMplexScaled, __constVal8
and __main_7qG2_t3_7qG2_000, __HTMplexScaled, __constVal4
and __main_7qG2_t2_7qG2_000, __HTMplexScaled, __constVal2
and __main_7qG2_t1_7qG2_000, __HTMplexScaled, __constVal1
*/
ReadSensorHTTouchMultiplexer(S1, t1, t2, t3, t4);
/*
arrinit __main_7qG2_x_7qG2_000, __constVal0, __constVal4
set __signed_stack_001main, 0
mov __D0main, __main_7qG2_t1_7qG2_000
replace __main_7qG2_x_7qG2_000, __main_7qG2_x_7qG2_000, __signed_stack_001main, __D0main
set __signed_stack_001main, 1
mov __D0main, __main_7qG2_t2_7qG2_000
replace __main_7qG2_x_7qG2_000, __main_7qG2_x_7qG2_000, __signed_stack_001main, __D0main
set __signed_stack_001main, 2
mov __D0main, __main_7qG2_t3_7qG2_000
replace __main_7qG2_x_7qG2_000, __main_7qG2_x_7qG2_000, __signed_stack_001main, __D0main
set __signed_stack_001main, 3
mov __D0main, __main_7qG2_t4_7qG2_000
replace __main_7qG2_x_7qG2_000, __main_7qG2_x_7qG2_000, __signed_stack_001main, __D0main
*/
int x[4];
x[0]=t1;
x[1]=t2;
x[2]=t3;
x[3]=t4;
/*
arrbuild __main_7qG2_y_7qG2_000, __main_7qG2_t1_7qG2_000, __main_7qG2_t2_7qG2_000, __main_7qG2_t3_7qG2_000, __main_7qG2_t4_7qG2_000
*/
int y[];
ArrayBuild(y, t1, t2, t3, t4);
/*
arrinit __main_7qG2_z_7qG2_000, __constVal0, __constVal4
mov __HTTouchMuxValue_7qG2__t_7qG2_000, __main_7qG2_z_7qG2_000
subcall HTTouchMuxValue, __HTTouchMuxValue_return
mov __main_7qG2_z_7qG2_000, __HTTouchMuxValue_7qG2__t_7qG2_000
*/
int z[4];
HTTouchMuxValue(S1, z);
// this code is only here to keep the compiler from optimizing out variables
NumOut(0, LCD_LINE1, t1);
NumOut(0, LCD_LINE2, t2);
NumOut(0, LCD_LINE3, t3);
NumOut(0, LCD_LINE4, t4);
NumOut(0, LCD_LINE5, y[0]);
NumOut(0, LCD_LINE6, z[0]);
}