You can use serial monitor to read/write registers on atmega328. No debugger required.
I switched to stm32 nucleo boards awhile ago, but continue to enjoy arduino IDE and do low level debugging over serial, registers, set / reset bits, change clock etc.
/*
TO DO
*/
String in_String = "";
boolean end_input = false;
uint16_t adres_reg = 0;
uint8_t debug_osm = 0;
void setup()
{
Serial.begin(115200);
in_String.reserve(200);
Serial.print(F("\n\tSketch: Reg_base_UNO"));
Serial.print(F("\n\tSetup done."));
}
void loop()
{
int32_t tempr = 0;
char * pEnd;
// d, a, r, w - (a)ddress variable length.
/*
q, *w, e, *r, t, y, u, i, o, p,
*a, s, *d, f, g, h, j, k, l,
z, x, c, v, b, n, m,
*/
if(debug_osm) {
}
serialEvent();
if( end_input) {
char cmd = in_String[0];
in_String[0] = '+';
if( cmd == 'd' ) {
debug_osm = 1 - debug_osm;
if(debug_osm) Serial.print(F("\nDebug aktiv."));
else Serial.print(F("\nDebug de-aktiv."));
}
if( cmd == 'a' ) {
adres_reg = strtol( in_String.c_str(), &pEnd, 16);
Serial.print(F("\n\tReg: "));
Serial.print(adres_reg, HEX);
Serial.print(F("\tvalue: "));
tempr = (*(uint8_t*)adres_reg);
Serial.print(tempr, BIN);
}
if( cmd == 'r' ) {
Serial.print(F("\n\tReg: "));
Serial.print(adres_reg, HEX);
Serial.print(F("\tvalue: "));
tempr = (*(uint8_t*)adres_reg);
Serial.print(tempr, BIN);
}
if( cmd == 'w' ) {
Serial.print(F("\n\tReg: "));
Serial.print(adres_reg, HEX);
Serial.print(F("\tvalue: "));
tempr = (*(uint8_t*)adres_reg);
Serial.print(tempr, BIN);
tempr = strtol( in_String.c_str(), &pEnd, 2);
(*(uint8_t*)adres_reg) = tempr;
Serial.print(F("\tnew value: "));
tempr = (*(uint8_t*)adres_reg);
Serial.print( tempr, BIN);
}
in_String = "";
end_input= false;
}
}
void serialEvent() {
while (Serial.available()) {
char inChar = (char)Serial.read();
in_String += inChar;
if (inChar == '\n') {
end_input= true;
}
}
}
// Address Book:
/*
page 536:
0x0B (0x2B) PORTD PORTD7 PORTD6 PORTD5 PORTD4 PORTD3 PORTD2 PORTD1 PORTD0 95
0x0A (0x2A) DDRD DDD7 DDD6 DDD5 DDD4 DDD3 DDD2 DDD1 DDD0 95
0x09 (0x29) PIND PIND7 PIND6 PIND5 PIND4 PIND3 PIND2 PIND1 PIND0 95
0x08 (0x28) PORTC – PORTC6 PORTC5 PORTC4 PORTC3 PORTC2 PORTC1 PORTC0 94
0x07 (0x27) DDRC – DDC6 DDC5 DDC4 DDC3 DDC2 DDC1 DDC0 94
0x06 (0x26) PINC – PINC6 PINC5 PINC4 PINC3 PINC2 PINC1 PINC0 94
0x05 (0x25) PORTB PORTB7 PORTB6 PORTB5 PORTB4 PORTB3 PORTB2 PORTB1 PORTB0 94
0x04 (0x24) DDRB DDB7 DDB6 DDB5 DDB4 DDB3 DDB2 DDB1 DDB0 94
0x03 (0x23) PINB PINB7 PINB6 PINB5 PINB4 PINB3 PINB2 PINB1 PINB0 94
// PORTS********************
#define PINB _SFR_IO8(0x03)
#define DDRB _SFR_IO8(0x04)
#define PORTB _SFR_IO8(0x05)
#define PINC _SFR_IO8(0x06)
#define DDRC _SFR_IO8(0x07)
#define PORTC _SFR_IO8(0x08)
#define PIND _SFR_IO8(0x09)
#define DDRD _SFR_IO8(0x0A)
#define PORTD _SFR_IO8(0x0B)
// COMPARATOR***************
#define ACSR _SFR_IO8(0x30)
#define ACIS0 0
#define ACIS1 1
#define ACIC 2
#define ACIE 3
#define ACI 4
#define ACO 5
#define ACBG 6
#define ACD 7
// ADC**********************
#define ADC _SFR_MEM16(0x78)
#define ADCW _SFR_MEM16(0x78)
#define ADCL _SFR_MEM8(0x78)
#define ADCH _SFR_MEM8(0x79)
#define ADCSRA _SFR_MEM8(0x7A)
#define ADPS0 0
#define ADPS1 1
#define ADPS2 2
#define ADIE 3
#define ADIF 4
#define ADATE 5
#define ADSC 6
#define ADEN 7
#define ADCSRB _SFR_MEM8(0x7B)
#define ADTS0 0
#define ADTS1 1
#define ADTS2 2
#define ACME 6
#define ADMUX _SFR_MEM8(0x7C)
#define MUX0 0
#define MUX1 1
#define MUX2 2
#define MUX3 3
#define ADLAR 5
#define REFS0 6
#define REFS1 7
#define DIDR0 _SFR_MEM8(0x7E)
#define DIDR1 _SFR_MEM8(0x7F)
// TIMERS*******************
#define TIFR0 _SFR_IO8(0x15)
#define TOV0 0
#define OCF0A 1
#define OCF0B 2
#define TIFR1 _SFR_IO8(0x16)
#define TOV1 0
#define OCF1A 1
#define OCF1B 2
#define ICF1 5
#define TIFR2 _SFR_IO8(0x17)
#define TOV2 0
#define OCF2A 1
#define OCF2B 2
#define GTCCR _SFR_IO8(0x23)
#define PSRSYNC 0
#define PSRASY 1
#define TSM 7
#define TCCR0A _SFR_IO8(0x24)
#define WGM00 0
#define WGM01 1
#define COM0B0 4
#define COM0B1 5
#define COM0A0 6
#define COM0A1 7
#define TCCR0B _SFR_IO8(0x25)
#define CS00 0
#define CS01 1
#define CS02 2
#define WGM02 3
#define FOC0B 6
#define FOC0A 7
#define TCNT0 _SFR_IO8(0x26)
#define OCR0A _SFR_IO8(0x27)
#define OCR0B _SFR_IO8(0x28)
#define TIMSK0 _SFR_MEM8(0x6E)
#define TOIE0 0
#define OCIE0A 1
#define OCIE0B 2
#define TIMSK1 _SFR_MEM8(0x6F)
#define TOIE1 0
#define OCIE1A 1
#define OCIE1B 2
#define ICIE1 5
#define TIMSK2 _SFR_MEM8(0x70)
#define TOIE2 0
#define OCIE2A 1
#define OCIE2B 2
#define TCCR1A _SFR_MEM8(0x80)
#define WGM10 0
#define WGM11 1
#define COM1B0 4
#define COM1B1 5
#define COM1A0 6
#define COM1A1 7
#define TCCR1B _SFR_MEM8(0x81)
#define CS10 0
#define CS11 1
#define CS12 2
#define WGM12 3
#define WGM13 4
#define ICES1 6
#define ICNC1 7
#define TCCR1C _SFR_MEM8(0x82)
#define FOC1B 6
#define FOC1A 7
#define TCNT1 _SFR_MEM16(0x84)
#define TCNT1L _SFR_MEM8(0x84)
#define TCNT1H _SFR_MEM8(0x85)
#define ICR1 _SFR_MEM16(0x86)
#define ICR1L _SFR_MEM8(0x86)
#define ICR1H _SFR_MEM8(0x87)
#define OCR1A _SFR_MEM16(0x88)
#define OCR1AL _SFR_MEM8(0x88)
#define OCR1AH _SFR_MEM8(0x89)
#define OCR1B _SFR_MEM16(0x8A)
#define OCR1BL _SFR_MEM8(0x8A)
#define OCR1BH _SFR_MEM8(0x8B)
#define TCCR2A _SFR_MEM8(0xB0)
#define WGM20 0
#define WGM21 1
#define COM2B0 4
#define COM2B1 5
#define COM2A0 6
#define COM2A1 7
#define TCCR2B _SFR_MEM8(0xB1)
#define CS20 0
#define CS21 1
#define CS22 2
#define WGM22 3
#define FOC2B 6
#define FOC2A 7
#define TCNT2 _SFR_MEM8(0xB2)
#define OCR2A _SFR_MEM8(0xB3)
#define OCR2B _SFR_MEM8(0xB4)
#define ASSR _SFR_MEM8(0xB6)
#define TCR2BUB 0
#define TCR2AUB 1
#define OCR2BUB 2
#define OCR2AUB 3
#define TCN2UB 4
#define AS2 5
#define EXCLK 6
#define TIMER2_COMPA_vect_num 7
#define TIMER2_COMPA_vect _VECTOR(7)
#define TIMER2_COMPB_vect_num 8
#define TIMER2_COMPB_vect _VECTOR(8)
#define TIMER2_OVF_vect_num 9
#define TIMER2_OVF_vect _VECTOR(9)
#define TIMER1_CAPT_vect_num 10
#define TIMER1_CAPT_vect _VECTOR(10)
#define TIMER1_COMPA_vect_num 11
#define TIMER1_COMPA_vect _VECTOR(11)
#define TIMER1_COMPB_vect_num 12
#define TIMER1_COMPB_vect _VECTOR(12)
#define TIMER1_OVF_vect_num 13
#define TIMER1_OVF_vect _VECTOR(13)
#define TIMER0_COMPA_vect_num 14
#define TIMER0_COMPA_vect _VECTOR(14)
#define TIMER0_COMPB_vect_num 15
#define TIMER0_COMPB_vect _VECTOR(15)
#define TIMER0_OVF_vect_num 16
#define TIMER0_OVF_vect _VECTOR(16)
#define ADC_vect_num 21
#define ADC_vect _VECTOR(21)
#define ANALOG_COMP_vect_num 23
#define ANALOG_COMP_vect _VECTOR(23)
*/
//**//