Basic I/O Functions

output_X(n) Output 8-bit code at Port X

output_high(PIN_Xn) Set output bit high

output_low(PIN_Xn) Set output bit low

input(PIN_Xn) Get bit input

n=input_X() Get byte input

Variable Types

IdentifierTypeMinMaxRange
int11 bit011=20
unsigned int88 bits0255256=28
signed int88 bits−127+127255=28−1
unsigned int1616 bits065,53565,536=216
signed int1616 bits−32,767+32,76765,535=216−1
unsigned int3232 bits04,294,967,2954,294,967,296=232
signed int3232 bits−2,147,483,647+2,147,483,6474,294,967,295=232 2 1
float32 bits∼10–39∼10+38∼1077

Relational Operators

OperationSymbolExample
Equal to==if(a == 0) b=b+5;
Not equal to!=if(a != 1) b=b+4;
Greater than>if(a > 2) b=b+3;
Less than<if(a < 3) b=b+2;
Greater than or equal to>=if(a >= 4) b=b+1;
Less than or equal ...

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.