Bensonbk PDF
Bensonbk PDF
INTRODUCTION
PIC16F818
CCS compiler
Device programming methods
Device programmers and ease of running code examples
Device programmer
In-circuit serial programmer
Choosing a device programmer
Microchip PICSTART Plus
Choosing an in-circuit programmer/debugger
CCS ICD-U40 (or -S40)
Microchip PICkit 2
Microchip ICD 2
CCS COMPILER
C SOURCE CODE
Bit
Nibble
Byte
Binary.
Hexadecimal
CONSTANTS
VARIABLES
DATA
Data types
ASCII characters
Reserved words in C
DEVICE FILES
FUNCTIONS
main() function
Functions
Built-in functions - short list
STATEMENTS
Executable statements
Blocks
Conditional statements
Semicolon use rules
PROGRAM DESIGN
Programming concepts
Programming examples
Simple data transfers
Loop - endless
While loop
Do/while loop
Port registers accessed as variables
Port addresses defined using #byte directives
Port addresses defined using user-created
include file
Port addresses defined using get environment
built-in function
Loop with a counter
For loop
Loop until
While loop
Comparisons
Relational operators
If/else
Switch/case
Function calls and time delays
Bit-level I/O using built-in functions
Bit toggle
If statement - read switch position
! logical operator
&& logical operator (two switches)
|| logical operator (two switches)
if/else, else, else
Read input bit, write output bit
Event counting
Bit manipulation using bit manipulation functions
Bit set/clear
Bit testing
Flags
#bit pre-processor directive example
typedef example
Bit manipulation using bitwise operators
Shift bits right or left
Change specific bit to"1"
Change specific bit to"0"
Change specific bit to it's complement
Goto
Function library
Cut and paste
"U"-turn experiment
PC-to-PC "2-lane highway" experiment
PC/PIC microcontroller
PC baud rates
RS-232 interface for a PIC microcontroller
PIC microcontroller-to-PC serial communication
Formatting PIC microcontroller data on a PC screen
STRINGS
ARRAYS
Index to an array
Step through array elements
Extract nth element from array
Add offset to index
Lookup tables
7-segment LED display
STRUCTURES
Mathematical operators
Operator precedence
Data type selection considerations
Formatting variables such as math results for printing
PASSING VARIABLES
Passing arguments
Returning values
Prototyping functions
OPERATORS
Assignment operator
Relational operators
Logical operators
Increment and decrement
Mathematical operators
Bitwise operators
Pointer operators
Structure operators
Operators that don't fit the categories
INTERRUPTS
APPENDIX A - PULSER
APPENDIX B - SOURCES