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: 2020/7/13 09:38,
|©2020 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.sxlist.com/techref/microchip/language/c/index.htm"> PIC Micro Controller C Routine Library</A>
|Did you find what you needed?|
Welcome to sxlist.com!
& kind contributors
just like you!
Please don't rip/copy
Copies of the site on CD
are available at minimal cost.
Welcome to www.sxlist.com!