C What Happens
INTRODUCTION
PIC MICROCONTROLLER PRODUCT OVERVIEW
SELECTING A DEVICE FOR EXPERIMENTS
PIC16F818
        Pins and functions
        Package
        Clock oscillator
        Reset
        Ports
        Special Features
        PIC microcontroller architecture
        Code and data protection
        Configuration bits
CIRCUIT FOR PIC16F818 EXPERIMENTS
CHOOSING DEVELOPMENT TOOLS
        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
PROGRAMMING A DEVICE USING THE ICD-U40 (or -S40)
PROGRAMMING A DEVICE USING THE PICkit 2
PROGRAMMING A DEVICE USING THE ICD 2
PROGRAMMING A DEVICE USING THE PICSTART Plus
CCS COMPILER
C SOURCE CODE
        What it looks like
        Typing accuracy
        Comments
        Text And Formatting
BITS, BYTES, ETC.
        Bit
        Nibble
        Byte
        Binary.
        Hexadecimal
CONSTANTS
VARIABLES
DATA
        Data types
        ASCII characters
NAMING CONSTANTS AND VARIABLES
        Reserved words in C
OPERATORS - SHORT LIST
TRUE vs. FALSE
DEVICE FILES
PRE-PROCESSOR DIRECTIVES - SHORT LIST
INs AND OUTS OF DIGITAL I/O
CONFIGURATION REGISTER(S)     FUSES
FUNCTIONS
        main() function
        Functions
        Built-in functions - short list
STATEMENTS
        Executable statements
                Blocks
        Conditional statements
        Semicolon use rules
PROGRAM DESIGN
        Program design - control flow
                if
                if/else
                while loop
                do/while loop
                for loop
                switch/case
                break
                continue
                return
                goto
        Rule
        Modular programming
WRITING PROGRAMS (With Experiments)
        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
TALKING TO A PIC MICROCONTROLLER WITH A PC VIA A WINDOWS
        TERMINAL PROGRAM
          "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
          Structures and ports - bit fields
MATH AND MANIPULATING NUMBERS
          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
        External interrupt sources
        Internal interrupt sources
                Timer 0 interrupt
                Port B interrupt on change - bits 7,6,5,4
                Interrupts generated by other peripherals
        Global interrupt enable flag (GIE)
        Return from interrupt
        Where to put the interrupt service routine in program memory
        Interrupt latency
        Multiple external interrupt sources
        Interrupts in C
                Functions - Built-in
                Pre-processor directives used to identify interrupt service
                        routines
        Example - external interrupt
TIMING AND COUNTING USING TIMER 0
        Digital output waveforms
        Using timer 0
        Prescaler
        Putting timer 0 to work
                Setting up timer 0
                Starting timer 0
                Counter
                How do we know timer 0 is doing something?
                Timer 0 will keep on counting as long as:
                Timer 0 must be reloaded after each overflow for repeating
                        time intervals
                Stopping timer 0
        Timer 0 experiments
                Digital output waveform using timer 0 - internal clock
                Single time interval - internal clock
                Free running mode - internal clock - 0.1 second period
                Single time interval - external clock
                Free running mode - internal clock
                Counting events (pulses)
        Going further
ANALOG TO DIGITAL CONVERSION
INSERTING ASSEMBLY CODE IN C CODE
APPENDIX A - PULSER
APPENDIX B - SOURCES
APPENDIX C - HEXADECIMAL NUMBERS
APPENDIX D - PROGRAM LISTINGS vs. PAGE NUMBERS