1. Trang chủ
  2. » Công Nghệ Thông Tin

Hệ thống nhúng - Chương 6 pdf

24 354 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Cấu trúc

  • Hệ thống nhúng

  • Lesson 6 :Communication

  • Flight plan

  • Preflight checklist

  • The flight

  • Slide 7

  • Asynchronous serial interfaces

  • Slide 9

  • Parallel interfaces

  • Synchronous communication using the SPI modules

  • Slide 12

  • SPI Programming

  • 25LC256 Memory

  • Slide 15

  • Slide 16

  • A nonvolatile storage library

  • Slide 18

  • Testing the new NVM library

  • Slide 20

  • Exercises

  • What to read at home?

  • Slide 23

  • Next: Glass bliss

Nội dung

1 Hệ thống nhúng Thạc sĩ Lê Mạnh Hải Embedded Systems 2 Lesson 6 :Communication Motivation: • Synchronous serial interfaces • Asynchronous serial interfaces • Parallel interfaces • Synchronous communication using the SPI modules • Testing the Read Status Register command • Writing to the EEPROM • Reading the memory contents • A nonvolatile storage library • Testing the new NVM library 3 Flight plan • In this lesson we will review a couple of communication peripherals available in all the general-purpose devices in the new PIC24 family. • Asynchronous serial communication interfaces UART1 and UART2, • Synchronous serial communication interfaces SPI1 and SPI2, comparing their relative strengths and limitations for use in embedded-control applications. 4 Preflight checklist • MPLAB® IDE, • MPLAB C30 compiler and the • MPLAB SIM simulator, • Explorer16 demonstration board and the • MPLAB ICD2 In Circuit Debugger 5 The flight • The PIC24FJ128GA010 offers seven communication peripherals that are designed to assist in all common embedded-control applications. – 2 × the universal asynchronous receiver and transmitters (UARTs) – 2 × the SPI synchronous serial interfaces – 2 × the I2C™ synchronous serial interfaces 6 Synchronous serial interfaces 7 Sharing an SPI bus among multiple masters is theoretically possible but practically very rare. The main advantages of the SPI interface are truly its simplicity and the speed that can be one order of magnitude higher than that of the fastest I2C bus (even without taking into consideration the details of the protocol- specifi c overhead). 8 Asynchronous serial interfaces The synchronization between transmitter and receiver is obtained by extracting timing information from the data stream itself. Start and stop bits are added to the data and precise formatting (with a fi xed baud rate) allow reliable data transfer. 9 10 Parallel interfaces • The Parallel Master Port (PMP) completes the list of basic communication interfaces of the PIC24. • The PMP has the ability to transfer up to 8 bits of information at a time while providing several address lines – Interface directly to most LCD display modules commercially available (alphanumeric and graphic modules with integrated controller) – Compact Flash memory cards (or CF-I/O devices), – printer ports and an almost infi nite number of other basic 8-bit parallel devices available on the market and featuring the standard control signals: −CS, −RD, −WR. [...]... value 16 }//writeSPI2 13 25LC2 56 Memory 1 2 3 4 5 6 7 // 25LC2 56 Serial EEPROM commands #define SEE_WRSR 1 // write status register #define SEE_WRITE 2 // write command #define SEE_READ 3 // read command #define SEE_WDI 4 // write disable #define SEE_STAT 5 // read status register #define SEE_WEN 6 // write enable 14 1 /* 2 ** SPI2 demo 3 */ 4 #include 5 // I/O defi nitions 6 #define... SPI_MASTER 0x0120 // select 8-bit master mode, CKE=1, CKP=0 10 #define SPI_ENABLE 0x8000 // enable SPI port, clear status 11 // 25LC2 56 Serial EEPROM commands 12 #define SEE_WRSR 1 // write status register 13 #define SEE_WRITE 2 // write command 14 #define SEE_READ 3 // read command 15 #define SEE_WDI 4 // write disable 16 #define SEE_STAT 5 // read status register 17 #define SEE_WEN 6 // write enable 18 //... pin output 6 CSEE = 1; // de-select the Serial EEPROM 7 SPI2CON1 = SPI_MASTER; // select mode 8 SPI2STAT = SPI_ENABLE; // enable the peripheral 9 // 2 Check the Serial EEPROM status 10.CSEE = 0; // select the Serial EEPROM 11.writeSPI2( SEE_STAT); // send a READ STATUS COMMAND 12.i = writeSPI2( 0); // send dummy, read data 13.CSEE = 1; // terminate command . 1 Hệ thống nhúng Thạc sĩ Lê Mạnh Hải Embedded Systems 2 Lesson 6 :Communication Motivation: • Synchronous serial interfaces • Asynchronous. for transfer to complete 15. return SPI2BUF; // read the received value 16. }//writeSPI2 14 25LC2 56 Memory 1. // 25LC2 56 Serial EEPROM commands 2. #define SEE_WRSR 1 // write status register 3 disable 6. #define SEE_STAT 5 // read status register 7. #define SEE_WEN 6 // write enable 15 1. /* 2. ** SPI2 demo 3. */ 4. #include <p24fj128ga010.h> 5. // I/O defi nitions 6. #define

Ngày đăng: 01/08/2014, 21:20

TỪ KHÓA LIÊN QUAN

w