|
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 * 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 ## Set up the Equipment ## LCD Displays ## Adding the LCD component ## Writing Messages ## Other LCD Functions ## A More Useful Counter * 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 A More Useful Counter<^< Other LCD Functions | Course Index | Binary Numbers >^>(:nl:) # Expand your program by dragging a Loop icon below the 'PrintString' Component Macro. # Change the text in the 'PrintString' Component Macro to "Hundredths:" (with quotation marks). # Drag a Calculation icon into the Loop. Set up a variable called "Count" as an 'Int' type. Double-click on the Calculation icon. In the 'Calculations:' text box type "Count = Count + 1". This will add 1 to the value of variable count every time the icon is executed. # Next drag another Component Macro into the Loop. Double-click the Component Macro and find 'Cursor' under the 'LCD' macros and enter '0,1' in the parameters. This will position the cursor on the first character of the second line. # Next drag another Component Macro onto the workspace and do the same but select 'PrintNumber' instead and enter "Count" as the parameters. # Next drag a Delay icon into the program and set the delay to 10ms or a hundredth of a second. # Go over the program and click on each icon entering comments on what each icon does. This seems like a lot of effort, but if you can discipline yourself to entering comments you will save time in the long run as your programs will be easier to read. # Run the program. You have now made a counter that will count (approximately) the time elapsed in hundredths of seconds. ![]() (: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 07, 2013, at 01:36 PM