16 Ekim 2017 Pazartesi

Learning C using UART1 Output Window

We can practice C code programming using UART1 output window of MPLAB.  http://microchipdeveloper.com/xc8:console-printing proposes the way to do it. I simplified this using MCC.

MCC: Start a new project for PIC18F24K20. add EUSART peripheral. enable transmit. redirect STDIO to USART.  that's all, 1MHz internal osc selected.

Project Properties-> Simulator -> Enable UART1 IO

these settings will be enough to redirect stdio to UART1 window. press GENERATE to create mcc files and write your first code inside main.c

printf("Hello World!\n");

press the debug button. it will run simulation, open UART1 Output and will print Hello World!

use cmd-L to clear the screen for the next run.









Hiç yorum yok:

Yorum Gönder