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
Identifier | Type | Min | Max | Range |
---|---|---|---|---|
int1 | 1 bit | 0 | 1 | 1=20 |
unsigned int8 | 8 bits | 0 | 255 | 256=28 |
signed int8 | 8 bits | −127 | +127 | 255=28−1 |
unsigned int16 | 16 bits | 0 | 65,535 | 65,536=216 |
signed int16 | 16 bits | −32,767 | +32,767 | 65,535=216−1 |
unsigned int32 | 32 bits | 0 | 4,294,967,295 | 4,294,967,296=232 |
signed int32 | 32 bits | −2,147,483,647 | +2,147,483,647 | 4,294,967,295=232 2 1 |
float | 32 bits | ∼10–39 | ∼10+38 | ∼1077 |
Relational Operators
Operation | Symbol | Example |
---|---|---|
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.