tailieunhanh - Hệ thống nhúng - Chương 5

In this lesson we will review the basics of string declaration as an excuse to introduce the memory allocation techniques used by the MPLAB C30 compiler. The RISC architecture of the PIC24 poses some interesting challenges and offers innovative solutions. | Hệ thống nhúng Thạc sĩ Lê Mạnh Hải Embedded Systems Lesson 5 : Taking a look under the hood Motivation: Memory space allocation Program space visibility Investigating memory allocation Looking at the MAP Pointers The heap MPLAB® C30 memory models Flight plan In this lesson we will review the basics of string declaration as an excuse to introduce the memory allocation techniques used by the MPLAB C30 compiler. The RISC architecture of the PIC24 poses some interesting challenges and offers innovative solutions. Preflight checklist This lesson will be performed exclusively with software tools including the MPLAB IDE, MPLAB C30 compiler and the MPLAB SIM simulator. Use the “New Project Set-up” checklist to create a new project called “Strings” and a new source file similarly called “”. The flight char s[5] = { 'H', 'E', 'L', 'L', 'O'}; char s[5] = "HELLO"; char s[] = "HELLO"; char s[6] = { 'H', 'E', 'L', 'L', 'O', '\0' }; The flight char c; // declare c as | Hệ thống nhúng Thạc sĩ Lê Mạnh Hải Embedded Systems Lesson 5 : Taking a look under the hood Motivation: Memory space allocation Program space visibility Investigating memory allocation Looking at the MAP Pointers The heap MPLAB® C30 memory models Flight plan In this lesson we will review the basics of string declaration as an excuse to introduce the memory allocation techniques used by the MPLAB C30 compiler. The RISC architecture of the PIC24 poses some interesting challenges and offers innovative solutions. Preflight checklist This lesson will be performed exclusively with software tools including the MPLAB IDE, MPLAB C30 compiler and the MPLAB SIM simulator. Use the “New Project Set-up” checklist to create a new project called “Strings” and a new source file similarly called “”. The flight char s[5] = { 'H', 'E', 'L', 'L', 'O'}; char s[5] = "HELLO"; char s[] = "HELLO"; char s[6] = { 'H', 'E', 'L', 'L', 'O', '\0' }; The flight char c; // declare c as an 8-bit signed integer c = 'a'; // assign to it the value corresponding to 'a' in the ASCII table c ++; // increment it. it will represent the ASCII character 'b' now Something wrong here char s[15]; // declare s as a string of 15 characters s = "Hello!"; // Error! This does not work! copy the content of a string onto another: strcpy( s, "HELLO"); // s : "HELLO" append (or concatenate) two strings: strcat( s, " WORLD"); // s : "HELLO WORLD" determine the length of a string: i = strlen( s); // i : 11 and many more. Memory space allocation char s[] = "Flying with the PIC24"; const char s[] = "Flying with the PIC24"; strcpy( s, “HELLO”); The string “HELLO” was implicitly defi ned as of const char type, and similarly assigned to the const section in program memory to be accessible via the Program Space Visibility window. Program space visibility The PIC24 architecture is somewhat different from most other 16-bit microcontroller architectures you might be familiar with. It was .

TỪ KHÓA LIÊN QUAN
crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.