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.

For example:<br />

bytevar = (x>y)*4;<br />

is the same as:<br />

if( x>y )<br />

bytevar=4;<br />

else<br />

bytevar=0;<br />

SHORT INTs (bit variables) are treated the same as relational expressions. They evaluate to 0<br />

or 1.<br />

When expressions are converted to relational expressions or SHORT INTs, the result will be<br />

FALSE (or 0) when the expression is 0, otherwise the result is TRUE (or 1).<br />

For example:<br />

bytevar = 54;<br />

bitvar = bytevar; //bitvar will be 1 (bytevar ! = O)<br />

if(bytevar)<br />

//will be TRUE<br />

bytevar = 0;<br />

bitvar = bytevar; //bitvar will be 0<br />

How does the PIC® connect to a PC?<br />

A level converter should be used to convert the TTL (0-5V_ levels that the PIC® operates with<br />

to the RS-232 voltages (+/- 3-12V) used by the PIC®. The following is a popular configuration<br />

using the MAX232 chip as a level converter.<br />

360

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

Saved successfully!

Ooh no, something went wrong!