;
// Clear the flag
UCSR0A = (1 << TXC0);
}
int
main(void)
{
// PORTB5 to output
DDRB = (1 << 5);
// LED OFF
PORTB = 0;
led_on = 0;
// Enable Pin-change interrupt
PCICR = (1 << PCIE0);
PCMSK0 = (1 << PCINT7);
// USART0
// Baud trivial in synchronous mode
UBRR0 = 0x0FFF;
// Enable XCK for master clock outout
DDRD |= (1 << 4);
// Enable USART transmitter
UCSR0B |= (1 << TXEN0);
// Synchronous mode
UCSR0C |= (1 << UCSZ01) | (1 << UCSZ00) | (1 << UMSEL00);
// Interrupts on
sei();
while(1)
// Sleep
set_sleep_mode(SLEEP_MODE_IDLE);
sleep_mode();
// Woken up
if(send_message) {
// Send a message
const
if
else
while
// Send the ticker value
usart_send(ticker + '0');
usart_send('\n');
// Sent
send_message = 0;
}
}
}
To do:
•
•
•
3.1.13.1 Enable USART Interface
To do:
•
•
©
2020 Microchip Technology Inc.
{
char* pmessage;
(led_on)
pmessage = message_on;
pmessage = message_off;
(*pmessage)
usart_send(*pmessage++);
Build the project/solution (F7)
Program the application into the target device using Start Without Debugging (Ctrl+Alt+F5)
Switch to Data Visualizer to see the results
Check the USART checkbox
Open the USART Configuration dialog by pushing the gear button next to the USART checkbox
User Guide
Power Debugger
Detailed Use Cases
DS40002201A-page 27
Need help?
Do you have a question about the Power Debugger and is the answer not in the manual?