17.02.2015 Views

CCS C Compiler Manual PCB / PCM / PCH

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

PreProcessor<br />

not used.<br />

Purpose:<br />

This directive tells the compiler the baud rate and pins used for serial I/O. This directive<br />

takes effect until another RS232 directive is encountered. The #USE DELAY directive<br />

must appear before this directive can be used. This directive enables use of built-in<br />

functions such as GETC, PUTC, and PRINTF. The functions created with this directive<br />

are exported when using multiple compilation units. To access the correct function use<br />

the stream identifier.<br />

When using parts with built-in SCI and the SCI pins are specified, the SCI will be used.<br />

If a baud rate cannot be achieved within 3% of the desired value using the current clock<br />

rate, an error will be generated. The definition of the RS232_ERRORS is as follows:<br />

No UART:<br />

Bit 7 is 9th bit for 9 bit data mode (get and put).<br />

Bit 6 set to one indicates a put failed in float high mode.<br />

With a UART:<br />

Used only by get:<br />

Copy of RCSTA register except:<br />

Bit 0 is used to indicate a parity error.<br />

Warning:<br />

The PIC UART will shut down on overflow (3 characters received by the hardware with<br />

a GETC() call). The "ERRORS" option prevents the shutdown by detecting the condition<br />

and resetting the UART.<br />

Examples:<br />

Example<br />

Files:<br />

Also See:<br />

#use rs232(baud=9600, xmit=PIN_A2,rcv=PIN_A3)<br />

ex_cust.c<br />

getc(), putc(), printf(), setup_uart( ), RS2332 I/O overview<br />

#use rtos<br />

(The RTOS is only included with the PCW and PCWH packages.)<br />

The <strong>CCS</strong> Real Time Operating System (RTOS) allows a PIC<br />

micro controller to run regularly scheduled tasks without the need<br />

for interrupts. This is accomplished by a function (RTOS_RUN())<br />

that acts as a dispatcher. When a task is scheduled to run, the<br />

dispatch function gives control of the processor to that task.<br />

When the task is done executing or does not need the processor<br />

anymore, control of the processor is returned to the dispatch<br />

function which then will give control of the processor to the next<br />

143

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!