While programming an ATtiny or ATmega, avrdude prints the device signature, in this example it is an ATtiny.
avrdude: Device signature = 0x1e910a
Can I read this signature on a running device using C++ code (avr-gcc)? For ATmega1280 there is a chapter 29.6.10 writing about it, but I'm a bit puzzled by how I can code it in C++.
I want to be able to make the device send its device ID back to the controlling PC, so the PC can make decisions on it.
Best Answer
You can use these macros that get defined automatically when you include
<avr/io.h>
:For ATmega1280, they're defined as:
in
iom1280.h
(which is automatically included through<avr/io.h>
when you compile code for the m1280)For example, this will send the three bytes via UART:
If you truly want to read the fuses, you'd need to use boot_signature_byte_get macro from
<avr/boot.h>