Gast
#2503836
/*
Der kommt irgendwie mit den Vergleichen nicht kla.. und nur Gott weiß
warum..
Am Ende soll hier ein DUAL -> HEX umwandler für die Zahlen 1-16
einstehen,
Wenn z.B die die Zahl 15 gespeichert ist, dann hat
ports[0] den WErt 1 und ports[1] den Wert 5
*/
c = toupper(cbf_get(rx_buf));
ports[0]=c;
c = toupper(cbf_get(rx_buf));
ports[1]=c;
if (ports[0] >='0' && ports[0] <='1' && ports[1] >='0' && ports[1]
<='F')
{
cbf_put(cmd_buf, 'I');
cbf_put(cmd_buf, 'S');
cbf_put(cmd_buf, myadress );
cbf_put(cmd_buf, 0x00);
cbf_init(rx_buf);
cbf_put(cmd_buf, 0x01);
cbf_put(cmd_buf, 'S');
cbf_put(cmd_buf, 0x01);
cbf_put(cmd_buf, 'C');
cbf_put(tx_buf, 'S');
cbf_put(tx_buf, 'C');
cbf_put(tx_buf, ' ');
}
if (ports[0]==0)
{
cbf_put(rx_buf, ports[0]);
cbf_put(rx_buf, ports[1]);
}
else if(ports[0] == '1' && ports[1] == '0')
{cbf_put(rx_buf, '0');
cbf_put(rx_buf, 'A');}
else if(ports[0] == '1' && ports[1] == '1')
{cbf_put(rx_buf, '0');
cbf_put(rx_buf, 'B');}
else if(ports[0] == '1' && ports[1] == '2')
{cbf_put(rx_buf, '0');
cbf_put(rx_buf, 'C');}
else if(ports[0] == '1' && ports[1] == '3')
{cbf_put(rx_buf, '0');
cbf_put(rx_buf, 'D');}
else if(ports[0] == '1' && ports[1] == '4')
{cbf_put(rx_buf, '0');
cbf_put(rx_buf, 'E');}
else if(ports[0] == '1' && ports[1] == '5')
{cbf_put(rx_buf, '0');
cbf_put(rx_buf, 'F');}
else if(ports[0] == '1' && ports[1] == '6')
{cbf_put(rx_buf, '1');
cbf_put(rx_buf, '0');}
else
{return parse_error(tx_buf, '?', PSTR("Y"));
}