Instructions

170Compiler
© 2013 Conrad Electronic
Total Length: 4 bytes
Function main()
count 2 2
n 2 0
Total Length: 4 bytes
From this list can be seen that no global variables are being used. There are further the two functions
"Pulse()" and "main()". Each one of these functions consumes a memory space of 4 Bytes on local
variables.
4.2 CompactC
One possibility to program the C-Control Pro Mega 32 or Mega 128 is offered by
the programming language CompactC. The Compiler translates the language
CompactC into a Bytecode which is then processed by the Interpreter of the C-
Control Pro. The language volume of CompactC does essentially correspond with
ANSI-C. It is however reduced to some extent since the firmware had to be imple-
mented in a resource saving way. The following language constructs are missing:
structs / unions
typedef
enum
constants (const instruction)
pointer Arithmetic
Detailed program examples can be found in directory C-Control Pro Demos which was installed
along with the design interface. There example solutions can be found for almost every field of pur-
pose.
The following chapter contains a systematic introduction into syntax and semantics of CompactC.
4.2.1 Program
A program consists of a number of instructions (such as "a=5;") which are distributed among vari-
ous Functions. The starting function, which must be present in every program, is the function "main
()". The following is a minimalistic program able to print a number into the output window:
void main(void)
{
Msg_WriteInt(42); // the answer to anything
}
Projects
A program can be separated into several files which are combined in a project (see Project Manage-
ment). In addition to these project files Libraries can be added to the project which are able to offer
functions used by the program.