Note: This library is entirely built by people just like you who have decided to share what they have written... please consider placing the code that you are proud of on these pages (see the login link below) and, if you use code from this site, it might be good to say thanks to and credit the author.
Most of the C code in this section is for Hi-Tech C and the FREE! MPLAB compatible PICC-Lite which is essentially the same, but supports only the 16x84 devices. It may be possible to use these routines in other C compilers.
Andy Kunz says:
As for working in C, you can probably do 99% of what you need to do in standard C code. Time-critical stuff should be in assembly (to prevent optimization problems), and compiler-specific stuff can be done with include files. (see "defs.h"). I use this all the time to test stuff on a PC, then drop it into the PIC and I can fully expect it will work "first time."
ACE is an interpreter (A C Emulator) which runs on the PIC family of microprocessors. The language is a subset of ANSI C and thus all programs can be compiled and run using any ANSI C compiler, the IO of the microprocessor being simulated by a special include file. The version for the PIC 16F84 provides 8 programmable IO ports plus one input port. Two of the programmable ports can be configured to provide standard RC servo outputs."
Anyone out there wanting to be a (serious) beta tester?
The list of devices (with only one device, I suppose it's not really a list) that PICC-Lite supports is woefully out of date.Microcontroller Limitations --------------- -------------------------------- All Baselines No Limitations 12F629 No Limitations 12F675 No Limitations 16C84 No Limitations 16F627 2 RAM banks supported 16F627A 2 RAM banks supported 16F684 1 RAM banks, 1K program memory supported 16F690 2 RAM banks, 2K program memory supported 16F84A No Limitations 16F877 2 RAM banks, 2K program memory supported 16F877A 2 RAM banks, 2K program memory supported 16F887 2 RAM banks, 2K program memory supported 16F917 2 RAM banks, 2K program memory supported
Regarding the notes on this page:
There is absolutely no reason to resort to the following (which is wrong anyway due to its lacking the 'volatile' qualifier):
#define PIN(x,y,z) static bit x @ ((unsigned)&y*8+z)
HI-TECH already provides definitions for PIC SFRs and SFR bits. It's much more straight forward and less error prone to simply use:
#define LED1 RA0
|file: /Techref/microchip/language/c/index.htm, 11KB, , updated: 2011/7/10 10:49, local time: 2016/7/24 02:10,
|©2016 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?|
<A HREF="http://www.piclist.com/techref/microchip/language/c/index.htm"> PIC Micro Controller C Routine Library</A>
|Did you find what you needed?|
PICList 2016 contributors:
o List host: MIT, Site host massmind.org, Top posters @20160724 RussellMc, Neil, IVP, James Cameron, John Gardner, Denny Esterline, Bob Blick, Richard Pope, alan.b.pearce, embedded systems,
* Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.
Welcome to www.piclist.com!