]> jspc29.x-matter.uni-frankfurt.de Git - avr.git/commitdiff
Pt100: new command to read EEPROM values
authorPhilipp Klaus <klaus@physik.uni-frankfurt.de>
Fri, 2 Jun 2017 11:35:40 +0000 (13:35 +0200)
committerPhilipp Klaus <klaus@physik.uni-frankfurt.de>
Fri, 2 Jun 2017 11:35:40 +0000 (13:35 +0200)
pt100/uart.c

index 8deb8d91182a496d4a664bd16ae60fb8eac5e694..029cb333fff764600db81cfc1d714febf208cc45 100644 (file)
 //ATb800XXXX    -- Temperature given by ADC
 //AIb0FFFFCC    -- Firmware version & connected channels (bitmask) in last byte
 //AVb000XXXX    -- AVCC from ADC channel 3, in mV
+//AGb0AAXXXX    -- EEPROM content (uint16) at address AA*2
 
 //Commands sent by user
-//WEb0AAXXXX     -- write int16 to eeprom at address AA*2
+//WEb0AAXXXX     -- write uint16 to   eeprom at address AA*2
+//WGb0AA0000     -- read  uint16 from eeprom at address AA*2
 //WRb0000000     -- reload eeprom data
 //WCb000XXXX     -- control register, t.b.d.
 
@@ -120,6 +122,11 @@ ISR(USART0_RX_vect) {
           uint8_t addr = hex_to_byte(rxbuf+4);
           eeprom_write(addr,  (((uint16_t)hex_to_byte(rxbuf+6))<<8) | hex_to_byte(rxbuf+8));
           }
+        else if(rxbuf[1] == 'G') {
+          uint8_t addr = hex_to_byte(rxbuf+4);
+          uint16_t data = eeprom_read(addr);
+          send_answer_hex('G', '0', ((uint32_t)addr << 16) | data);
+          }
         else if(rxbuf[1] == 'C') {
           control_reg = (hex_to_byte(rxbuf+6)<<8) | hex_to_byte(rxbuf+8);
           }