3.4. PIC16 C UART Serial Link

• RS232 port functions

• Simulation with virtual terminal

A basic serial link is provided by the UART. We have already seen that any pair of pins can be used for this interface, as the data rate is quite low, allowing the signals to be generated in software. However, a dedicated hardware port is provided, which must be used if an interrupt is needed. The CCS C library functions associated with this port are listed in Table 3.6

Table 3.6. RS232 Serial Port Functions
TitleDescriptionExample
RS232 SET BAUD RATESet hardware RS232 port baud ratesetup_uart(19200);
RS232 SEND BYTEWrite a character to the default portputc(65)
RS232 SEND SELECTEDWrite a character to selected ports=fputc(“A”,01);
RS232 PRINT SERIALWrite a mixed message ...

Get Programming 8-bit PIC Microcontrollers in C now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.