• NEED HELP? PLEASE CALL      (+86)-1306-6936-900
  • MAIL US      674950352@qq.com

PICC compiler with the development of the PIC series microcontroller

At present, the most widely used in the market should belong to the 8 bit microcontroller, 8 bit microcontroller Microchip PIC series of Technoloogy Corporation and is welcomed by the users in the domestic market, has gradually become the new trend of SCM application; unfortunately, the introduction of its C language development tools, books and articles are less, but not many people, the majority of programmers in the development process are slowly groping, may take some detours. I recently in PIC C has met many questions of language, here to do and recently used PIC C language, some experience and the underlying software programmers and the hope that this paper will help the development of PIC Series MCU with PICC people.

At present, in the country with more than the Hi-Tech Hi-Tech PICC compiler, and is currently on the market some of the domestic PIC emulator also began to support the Hi-Tech PICC compilation format; therefore, this paper is mainly based on the characteristics of Hi-Tech PICC, introduce the PIC C language base.

1 PICC C Hi-Tech language development tool language features:

  • C PICC language according to the C ANSI to define, and carried out the expansion of the C language. PICC and C ANSI have a fundamental difference is that PICC does not support the recursive function of the function. This is because the PIC microcontroller stack size is determined by the hardware, limited resources, so do not support recursive calls. Its data also comply with the standard C data structure, PICC data structure is in the form of data type. A type of PICC compiler supports data types (bit), unsigned char (unsigned, char) (signed char) signed char unsigned integer (unsigned, int), (signed int), the symbol shaping unsigned long integer (unsigned long), long integer (signed, long) floating point (float) and a pointer type etc.. It should be noted that the PICC support of the multi byte data is adopted in the first, high byte in the following principle. That is, a multi byte number, such as the int type, in which the order is stored in the memory cell as the low order byte. The high byte is stored in the high address memory cell, the programmer must pay attention to this characteristic when using the union to define the variable.
  • C PIC language variables are divided into local variables and global variables, all variables must be defined before use. The global variable is a variable that can be used by any module, which can be used by any module, and can be maintained during the whole program execution. Local variables within the function. Local variables have two kinds: automatic variables and static variables. The default type is an automatic variable unless it is explicitly declared as a static variable. Moreover, all of the automatic variables are assigned to the register page 0, so the bank qualifier cannot be used for automatic variables, and can be used for static local variables. When the program exits, the automatic variable space is released, and the automatic variable is lost. A static variable is a local variable in a statement, only its internal function effectively; but it takes a fixed storage unit, the storage unit will not be other functions, so the other function can access or modify the static variable by the value of the pointer. Start static variables initialized only once in the program, if only in a function within a variable, and hope its value remains unchanged during the 2 function calls, procedures for the realization of modularization, it can be declared as static variables. For example, in the following statement, some are legitimate and some are illegal:
    1. Max void (void)
    2. Unsigned char VAR1; / / legal statement
    3. Unsigned char bank1 var2; / / illegal statement
    4. Static unsigned char bank1 ver3; / / legal statement
    5. Unsigned char var4=0x02; / / legal statement, each call is initialized
    6. Static unsigned char bank1 var5=0x02; / / legal statement, but only an initialization
  • PICC compiler for local variables and transfer parameters using RAM coverage technology. Compile time, the connector will automatically put some of the functions that can not be called at the same time, the automatic variable area together, in order to achieve the efficient use of memory, so its internal RAM use efficiency is very high.

Transfer of parameters in the 2 function call

PICC function parameters of the transmission is based on the length of the transmission parameters, with the W, the automatic variable region of the transfer function or the parameters of the transfer function of the regional transmission, transfer code is more efficient. The arguments passed to the function can be passed by a question mark "?" A "_" label, underline and function name plus an offset acquisition.

We provide chip decryption and IC analysis services, for more information please
contact us