As we add resources, their pin allowance will appear in
the grid. Configure EUSART pins.
In the Device Resources window (Section 3), scroll
down the list and expand “EUSART,” then select
“EUSART.” The EUSART form will appear in Section 4
and “EUSART” will appear in Project Resources
(Section 2). In the Pin Manager: Grid[MCC] window
(Figure 4) on the row for EUSART TX, select the lock
icon for pin 10 (Port B7); in the row for EUSART RX,
select the icon for pin 12 (Port B5). Configure the USART parameters.
On the EUSART screen (Figure 5), check Enable
USART, Enable Transmit, Enable
USART Interrupts, Enable
Continuous Receive, and Redirect
STDIO to USART. Set the Baud
Rate to “115200,” Transmission Bits
to “ 8,” Reception Bits to “ 8,” and
Clock Polarity to “Non-Inverted.”
Check Redirect STDIO to USART;
set Software Terminal Buffer Size to
“ 64,” and set Software Receive
Buffer Size to “ 64” as well. Configure ADC pins.
In the Device Resources
window (Section 3), expand ADC
and then select “ADC.” The ADC
form will appear in Section 4 and
“ADC” will appear in Project Resources (Section 2). In the
Pin Manager: Grid [MCC] window (Section 5) on the ANx
row, select Port C “0” (pin 16) as shown in Figure 4. Configure ADC parameters.
In the ADC form (Figure 6),
check Enable ADC, and set Clock
to “FOSC/1.6.” Add custom names to pins.
In the Project Resources
window (Section 2), select “Pin
Module.” The Pin Module form will
appear in Section 4. In the Custom
Name column, label RA0 as
“input1,” RA2 as “outputA,” RA4 as
“WAKESW,” RA5 as “outputB,” RC0
36 December 2017
FIGURE 5. EUSART setup.
FIGURE 6. ADC setup.
FIGURE 7. Pin module custom names.
FIGURE 8. Project listing.