Summary of the points to note when using CCS8.0 to program MSP430G2553
[Copy link]
[Error 1]: The global variable "extern unsigned int CHANGE_MODE;" has been defined in "UART_Global.h", but an error still occurs during compilation, with the error message: error #10234-D: unresolved symbols remain.
[Solution]: After searching and comparing relevant routines on the Internet, it was found that after defining in the ".h" file, it is still necessary to declare it again in the corresponding ".c" file. For example, in this error, "unsigned intCHANGE_MODE=0;" needs to be defined in "UART_Global.c". After the definition, the compilation is successful.
[Error 2]: After debugging or running, it is found that the program always stops in the ISR_TRAP.ASM file.
[Solution]: The reason for this type of problem is generally that an interrupt is declared and enabled, but the interrupt handling function of the function is not written. Writing it can solve the problem.
[Error 3]: When using "I2C.c" and "UART_Init.c" to compile at the same time, it shows: error #10056: symbol "__TI_int06" redefined: first definedin "./src/I2C.obj"; redefined in "./src/UART_init.obj". I searched for a long time but could not find the "__TI_int06" mentioned in the error message.
[Solution]: According to the error message, "__TI_int06" was redefined, but I did not define this variable when I wrote the program. I found a post in an inconspicuous corner of the Internet saying that "__TI_int04" refers to an interrupt vector. Combined with the "TI" in "__TI_int06", it can be inferred that this may be a related definition in the header file that comes with CCS. After searching, it was found that this does represent an interrupt vector! And the interrupt vector is defined and used twice in different files! Just put the function in the interrupt of one file in the interrupt processing function of another file. However, when modifying, you need to pay attention to moving the related variables into another file, otherwise an error will be reported. In this project, the content related to "#pragma vector = USCIAB0TX_VECTOR" in "UART_Init.c" was moved to "#pragma vector = USCIAB0TX_VECTOR" in "I2C.c", and the interrupt flag was used to determine whether the source of the interrupt was I2C or UART, and make corresponding processing. For the specific program, see "I2C.c" in this project.
Here are the steps for searching in the CCS program: First, paste the content to be searched into the program, select the content, right-click, select "searchtext", and then select "project" to search.
1. When the program functions cannot be implemented normally and need to be debugged, it is best to decompose the program into multiple modules that implement small functions, use breakpoint debugging or single-step debugging, observe the values of registers and global variables after each debugging, judge whether the functions of small modules are normal one by one, and finally debug the overall program.
2. When it comes to timing coordination, the choice of division coefficient will affect the timing relationship of each signal to a certain extent. The appropriate division coefficient should be selected according to the signal timing displayed by the oscilloscope to ensure normal function.
3. When it comes to the functions of multiple modules, you must pay special attention to whether pins, registers, and interrupt vectors are used at the same time. If so, you must use software programming to separate them to ensure normal functions.
4. When writing a program, especially when writing a larger project, you must pay attention to the allocation of storage space and the simplicity of the code, otherwise there may be insufficient storage space.
5. In terms of hardware connection, we need to pay special attention to whether the connection method of each jumper slot needs to be changed. For example, in this project, it is necessary to remove the jumper slot of P1.6 and change the connection method of the RXD and TXD jumper slots to achieve normal function.
6. When adding a library function to an existing project, you need to click src, then click project on the menu bar and select properties at the bottom; select include options in the pop-up interface and find a small plus sign; click the small plus sign and click workplace in the pop-up interface and then find the src just now and finally click ok; this will make the copied library function file valid.
7. When a function cannot be implemented normally, you can download it repeatedly several times, because the development board is prone to problems when running the program; when a function suddenly cannot be implemented normally, it is very likely that you can just download the program again.
8. The compilation method in CCS is very different from the commonly used C language compilation method. This causes some statements that we think are correct to report errors under the compilation of CCS. At this time, we first search for relevant information on the Internet. If there is no relevant prompt, we have to keep trying until the compilation is successful and normal functions can be achieved.
|