/*
* #################################### define parameters to fixed values
*/
-#define FIRMWARE_VERSION 0x001
+#define FIRMWARE_VERSION 0x002
#define ISMYADDR() (rxbuf[1] == '0' && rxbuf[2] == '0')
ADMUX &= 0xe0;
ADMUX |= (channel & 0x7);
+// if(channel == 5)
+// ADMUX |= 0x10; //differential for temperature
if (channel >= 10)
ADCSRB |= (1 << MUX5);
else
ISR(USART1_UDRE_vect) {
// interupt for transmitting answer message
- if (txbuf[txpoint] != 0)
+ if (txbuf[txpoint] != 0) {
UDR1 = txbuf[txpoint++];
+ LED2_ON();
+ }
if (txpoint > 11 || txbuf[txpoint] == 0) {
txpoint = 0;
UCSR1B &= ~(1 << UDRIE1); // deactivate Transmit
+ LED2_OFF();
}
}
if (hex_to_int(rxbuf[4]) == 1) {
read_setting = 7 - ((shift_register >> (hex_to_int(rxbuf[3]) * 8)) & 7);
}
+ read_setting = ((read_setting >> 2) & 1) | (read_setting & 2) | ((read_setting << 2) & 4);
send_answer_hex(&rxbuf[0], read_setting);
}
my $outp = hex(substr($s,3,1));
my $uC = hex(substr($s,1,2));
my $answ = hex(substr($s,6));
- print $s."\n";
- print "-----------------------------------------------\n";
- print "Board: ".$uC."\t";
- print "Output: ".$outp."\t";
- print "Channel: ".$ch."\n";
- print "-----------------------------------------------\n";
+
if ($SEL_rw == 1 && $answ == 0x00d1) {
print "Done.\n";
return;
}
+
+ print "-----------------------------------------------\n";
+ print "Board: ".$uC."\t";
+ print "Output: ".$outp."\t";
+ print "Channel: ".$ch."\t";
+ print "Reply: ".$s."\n";
+ print "-----------------------------------------------\n";
+
if ($command == 0) { # Switch
print "Output active.\n" if $answ == 1;
print "Output off.\n" if $answ == 0;