PCWHD IDE COMPILER Custom Computer Services Inc (CCS), PCWHD IDE COMPILER Datasheet - Page 347

PCWHD PIC10,16,18,24, DSPIC

PCWHD IDE COMPILER

Manufacturer Part Number
PCWHD IDE COMPILER
Description
PCWHD PIC10,16,18,24, DSPIC
Manufacturer
Custom Computer Services Inc (CCS)
Type
Compilerr
Datasheet

Specifications of PCWHD IDE COMPILER

For Use With/related Products
Microchip PIC10, PIC12, PIC16, PIC18, PIC24, dsPIC MCUs
Lead Free Status / RoHS Status
Not applicable / Not applicable
Other names
429-1009
How do I make a pointer to a function?
The compiler does not permit pointers to functions so that the compiler can know at compile time
the complete call tree. This is used to allocate memory for full RAM re-use. Functions that could not
be in execution at the same time will use the same RAM locations. In addition since there is no
data stack in the PIC®, function parameters are passed in a special way that requires knowledge at
compile time of what function is being called. Calling a function via a pointer will prevent knowing
both of these things at compile time. Users sometimes will want function pointers to create a state
machine. The following is an example of how to do this without pointers:
enum tasks {taskA, taskB, taskC};
run_task(tasks task_to_run) {
}
How do I write variables to EEPROM that are not a word?
The following is an example of how to read and write a floating point number from/to EEPROM.
The same concept may be used for structures, arrays or any other types.
WRITE_FLOAT-EEPROM(int16 n, float data) {
float READ_FLOAT_EEPROM(int16 n) {
}
switch(task_to_run) {
case taskA : taskA_main();
case taskB : taskB_main();
case taskC : taskC_main();
}
• n is an offset into the EEPROM
write_eeprom(n, data, sizeof(float));
}
float data;
(int32)data = read_eeprom(n, sizeof(float));
return(data);
break;
break;
break;
333

Related parts for PCWHD IDE COMPILER