1 / 13

MSP430 programming for serial interfacing with sensors

MSP430 programming for serial interfacing with sensors. se. SPI. Master–Slave mode Synchronous protocol All transmissions are referenced to a common clock Clock generated by the master (MCU) Four main signals Master Out Slave In (MOSI): data from master to slave

Download Presentation

MSP430 programming for serial interfacing with sensors

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. MSP430 programming for serial interfacing with sensors se

  2. SPI • Master–Slave mode • Synchronous protocol • All transmissions are referenced to a common clock • Clock generated by the master (MCU) • Four main signals • Master Out Slave In (MOSI): data from master to slave • Master In Slave Out (MISO): data from slave to master • Serial Clock (SCLK or SCK): clock • Chip Select (CS): select particular peripheral when multiple peripherals are connected to master

  3. SHT11 • Relative humidity and temperature sensors • Digital output • Manufacturer defined interface • two wires bi-direction Use a GPIO pin as clock (SCK), it is always output direction Use another GPIO as DATA, dynamic setting it to input(read) or output(write) direction

  4. Taroko Connections

  5. Start Transmission and Send Command • How to start • What are the commands available

  6. An Example: SHT11 Pull-up Data pin in output direction Set data pin to input direction, then SHT11 controls the DATA line • Timing diagram

  7. Software Implementation

  8. Software Implementation

  9. Software Implementation

  10. Convert to Physical Values • 12-bit humidity, 14-bit temperature • Temperature • Humidity

  11. Device Driver • Download here • http://nslab.ee.ntu.edu.tw/courses/wsn-labs-spring-09/labs/sht11Driver.rar • Important functions in SHT1x_sensirion.c • void sht1xInit(); • void sht1xReset(); • char sht1xMeasure(unsigned char *p_value, unsigned char *p_checksum, unsigned char mode); • void sht1xCalculate(float *p_humidity ,float *p_temperature);

  12. Functions • char sht1xMeasure(unsigned char *p_value, unsigned char *p_checksum, unsigned char mode); • mode: { TEMP, HUMI } • Store measured value to *p_value • Store 8-CRC checksum to *p_checksum • void sht1xCalculate(float *p_humidity ,float *p_temperature); • Convert measured value to physical value • Put the measured value in *p_humidity, *p_temperature • Result will also place in *p_humidity, *p_temperature (overwrite)

  13. Example

More Related