Available For Immediate Shipment
C What Happens,
Using PIC® Microcontrollers
and the CCS C Compiler
by David Benson



  • Home

  • Order Info 

     
  • Go Direct to Secure Order Form for Books Only 

  • Contact Us







  • Home

  • Order Info 

     
  • Go Direct to Secure Order Form for Books Only 

  • Contact Us



























  • Home

  • Order Info 

     
  • Go Direct to Secure Order Form for Books Only 

  • Contact Us









































































  • Home

  • Order Info 

     
  • Go Direct to Secure Order Form for Books Only 

  • Contact Us









































































  • Home

  • Order Info 

     
  • Go Direct to Secure Order Form for Books Only 

  • Contact Us


  • Square 1 Electronics' new book, "C What Happens Using PIC® Microcontrollers and the CCS C Compiler,"  contains a series of explanations and examples for those who want to learn to program PICŪ microcontrollers using the C programming language. It is assumed that the reader has no knowledge of PIC microcontrollers or programming, but does have a rudimentary understanding of electronics. The reader will learn to create programs by making selections from a large variety of built-in functions provided in the CCS C compiler, writing his/her own functions as needed, and writing executable statements. The reader will 'C what happens' by programming a PICŪ microcontroller with the newly created code and exercising it using a simple circuit described in the book. The subject matter is laid out in a logical progression from simple to not-so-simple and is illustrated with lots of examples. The complete table of contents follows:

    Please note: This book is not available in bookstores.

    This book was written by David Benson (8-1/2 x 11", 183 pages, $34.95). David is also the author of "Easy Microcontrol'n" (formerly "Easy PIC'n"), "Microcontrol'n Apps" (formerly "PIC'n Up the Pace"), and "Time'n and Count'n" (formerly, "PIC'n Techniques"), which are books instructing people on how to use Microchip's PIC® microcontrollers by programming them using assembly language.


    C What Happens

    Using PIC® Microcontrollers
    and the CCS C Compiler
    by David Benson

    Table of Contents

    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




    [HOME]   [ORDER INFO] 

     [GO DIRECT TO SECURE ORDER FORM FOR BOOKS ONLY]  



     [CONTACT US] 


     [ TOP OF PAGE ]




    (C) All Rights Reserved 2008 Square 1 Electronics
    This site last updated March 18, 2008