Recent Changes - Search:
<^< Inputs and Outputs | Course index | Outputting Data >^>

Introduction to Microcontroller Programming * Course Index * Introduction * About the Author * About this Course * Feedback * Course Navigation * Quick Course Navigation * How to use this Course * Acronyms Used and Course Conventions

About PICmicro Chips * What is a PICmicro? * Microcontrollers * Digital versus Analogue * Inputs and Outputs ##

Getting Data into a PICmicro ## Outputting Data ## Current Limits * Memory * Programming * 16F1937 Architecture

Clocking Your PICmicro Devices * Introduction * The Clock Circuit * Clock Settings * Clock Confusion

E-Blocks * Introduction to E-blocks * Using E-blocks * E-blocks Boards

Flowcode Step By Step * Introduction to Flowcode * Basic Flowcode Functions * Digital Outputs * Digital Inputs * Basic Loops * The LCD Display * Binary Numbers * Decisions * Goto (Connection Point) * 7-Segment Displays * Software Macro * Strings and Memory * A Simple Hi-Fi

PICmicro Projects * Introduction to PICmicro Projects * Construction Methods * Choosing a Power Source * Adding Inputs * Input Conditioning * Adding Outputs * Adding Drivers

Labs * Introduction and Lesson Plan * 1. Output * 2. Delay * 3. Connection Point * 4. Calculations * 5. Loop * 6. Input * 7. Decision * 8. LCD * 9. Keypad * 10. Analogue + EEPROM * 11. Software Macro * 12. External Interrupt * 13. Timer Interrupt

(:Summary:Contains the 'action' links (like Browse, Edit, History, etc.), placed at the top of the page, see site page actions:) (:comment This page can be somewhat complex to figure out the first time you see it. Its contents are documented at PmWiki.SitePageActions if you need help. :) * Print (:comment (:if group Site,SiteAdmin,Cookbook,Profiles,PmWiki*:) (:comment delete if and ifend to enable backlinks:) * %item rel=nofollow class=backlinks accesskey='$[ak_backlinks]'% [[{*$Name}?action=search&q=link={*$FullName} | $[Backlinks] ]] (:ifend:) :) * Login

Getting Data into a PICmicro

<^< Inputs and Outputs | Course Index | Outputting Data >^>(:nl:)

The PICmicro is a digital device, but it can take data in both analogue and digital forms. For optimum flexibility programmers can choose whether certain pins on the PICmicro should be used as analogue inputs, digital inputs or digital outputs. This flexibility can result in a little confusion. For example on the 16F1937 chip shown below pin 2 is marked as 'RA0/AN0'. This means that pin 2 can be used as bit 0 of port A (Register A bit 0) or as ANalogue input 0. The function of each pin is determined by setting the contents of internal registers inside the PICmicro device and If you were programming in assembly or C code then you would have to make sure these registers were set up correctly before using the chip.

The next diagram gives some details about the PIC 16F1937 chip.

This has 5 ports, A-B-C-D-E. Each pin on Port A is labelled RA0 to RA7, pins on Port B are labelled RB0 to RB7 etc. Ports A, B, C and D have eight pins but Port E has only 4. This allows us to connect either up to eight digital sensors to port A of the 16F1937. Notice that pins RA6 and RA7 are also labelled as OSC1 and OSC2. This is because they are often connected to an external oscillator circuit instead of being used for digital i/o.

If you want to use analogue sensors, then you can use all the pins labeled with an 'ANx' (ANalogue) label. All these pins can read analogue input signals between VDD (5V) and VSS (Gnd). These happen to be on ports A, B and E of this PICmicro device.

You should also notice that most of the pins have alternative functions. For example pin 25 is labelled as 'RC6/TX/CK'. This refers to the multiple functions of pin 25 as being Register C bit 6, or the Transmit pin(X) of the internal serial interface, or the ClocK pin of the internal serial interface.

Fortunately Flowcode takes care of all of the internal settings that dictate pin functions for you.

(:nl:)(:table style="clear:both":)

(:Summary: Website page footer:)

Print - (:comment (:if group Site,SiteAdmin,Cookbook,Profiles,PmWiki*:) (:comment delete if and ifend to enable backlinks:) %item rel=nofollow class=backlinks accesskey='$[ak_backlinks]'% [[{*$Name}?action=search&q=link={*$FullName} | $[Backlinks] ]] (:ifend:) :) Search - Login

Page last modified on May 14, 2013, at 08:01 AM