AllVol
New Member
While trying to get my head around the use of C language pointers, I came up with the following bit of drivel.
Hope it entertains, educates, or something.
Enjoy
Hope it entertains, educates, or something.
Enjoy
PHP:
*******************************
*
* Title: Scratchpad
* Date: 12/4/09
* Author: AllVol
* Processor: 16F690
* Compiler: HiTech
*
* Studies the use of pointers and addresses
*
*********************************/
#include <htc.h>
__CONFIG (INTIO & WDTDIS & MCLRDIS & UNPROTECT);
void waste_time(void)
{
unsigned short int t;
for (t=0; t<=20000; t++){
}
}
void main()
{
ANSEL = 0;
TRISC = 0;
PORTC = 0;
while (1){ // A POINTER TO WEALTH
int fabulous_wealth; //Great riches are locked up somewhere.
int *trusted_courier; //I will send a favored servant to bring them
int my_table; //to my table, for I do not know where to
fabulous_wealth = 0x09; //look for the treasure.
trusted_courier = &fabulous_wealth; //My man is given the address of the
my_table = *trusted_courier; //great fortune and spreads it before me
PORTC = my_table; //that I may bask in my wisdom and wealth.
waste_time(); // forever.....
PORTC ^=my_table; // and......
waste_time(); // ever.
} //The
} // End