Flight plan: Every flight should have a purpose – PIC24 16-bit microcontroller PIC24FJ128GA010 – MPLAB® IDE – MPLAB C30. The flight – Our first line of code is going to be: #include This is not yet a proper C statement, but more of a pseudoinstruction for the preprocessor telling the compiler to read the content of a device-specific file before proceeding any further. The content of the device-specifi c “.h” file chosen is nothing more than a long list of the names (and sizes) of all the internal special-function registers (SFRs) of the chosen PIC24 model | Hệ thống nhúng Thạc sĩ Lê Mạnh Hải Embedded Systems Môû ñaàu I Mục đích môn học: Cung cấp kiến thức về lập trình nhúng trên Microchip PIC24 Rèn luyện kỹ năng đọc sách chuyên ngành bằng tiếng Anh II. Thời gian: 30 tiết lý thuyết (3 ĐVHT) + 30 tiết thực hành III Giáo trình và tài liệu tham khảo Programming 16-Bit PIC Microcontrollers in C: Learning to Fly the PIC24. Lucio Di Jasio. Elsevier. 2007 Designing Embedded Systems with PIC Microcontrollers. Principles and Wilmshurst. Elsevier. 2007 IV. Đánh giá: Thi kết thúc môn:70%. Có một bài báo cáo kỹ thuật. V. Giáo viên: Thạc sĩ Lê Mạnh Hải. Tel: 0985399000. Không gọi điện thoại để hỏi hay xin điểm, email: hailemanh@ Lesson 1 : THE FIRST FLIGHT Flight plan: Every flight should have a purpose PIC24 16-bit microcontroller PIC24FJ128GA010 MPLAB® IDE MPLAB C30 The flight Our first line of code is going to be: #include This is not yet a proper C statement, but more of a pseudo-instruction for | Hệ thống nhúng Thạc sĩ Lê Mạnh Hải Embedded Systems Môû ñaàu I Mục đích môn học: Cung cấp kiến thức về lập trình nhúng trên Microchip PIC24 Rèn luyện kỹ năng đọc sách chuyên ngành bằng tiếng Anh II. Thời gian: 30 tiết lý thuyết (3 ĐVHT) + 30 tiết thực hành III Giáo trình và tài liệu tham khảo Programming 16-Bit PIC Microcontrollers in C: Learning to Fly the PIC24. Lucio Di Jasio. Elsevier. 2007 Designing Embedded Systems with PIC Microcontrollers. Principles and Wilmshurst. Elsevier. 2007 IV. Đánh giá: Thi kết thúc môn:70%. Có một bài báo cáo kỹ thuật. V. Giáo viên: Thạc sĩ Lê Mạnh Hải. Tel: 0985399000. Không gọi điện thoại để hỏi hay xin điểm, email: hailemanh@ Lesson 1 : THE FIRST FLIGHT Flight plan: Every flight should have a purpose PIC24 16-bit microcontroller PIC24FJ128GA010 MPLAB® IDE MPLAB C30 The flight Our first line of code is going to be: #include This is not yet a proper C statement, but more of a pseudo-instruction for the preprocessor telling the compiler to read the content of a device-specific file before proceeding any further. The content of the device-specifi c “.h” file chosen is nothing more than a long list of the names (and sizes) of all the internal special-function registers (SFRs) of the chosen PIC24 model. C programming Going back to our “” source fi le, let’s add a couple more lines that will introduce you to the main() function: main() { } We said our mission was to turn on one or more I/O pins: say PORTA, pins RA0–7. In assembly, we would have used a pair of mov instructions to transfer a literal value to the output port. In C it is much easier—we can write an “assignment statement” as in the following example: #include main() { PORTA = 0xff; } Is it correct? Compiling and linking This operation is called a Project Build. The sequence of events is fairly long and complex, but it is composed mainly of two steps: Compiling: The C compiler is invoked and