Example Code

Reading a LM92 temperature sensor using a PIC16F877 and LabView

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

    Driver

  • NI VISA

Code and Documents

Attachment

 

Overview
    This example program shows how to implement a serial loopback test for the 485 protocol. You are able to use it in 4-wire mode or 2-wire auto mode only.

 

Description

    Communication is done through the Serial port with VISA commands. This example is used to read data back from the LM92.


Requirements
    Software
        LabVIEW 2012 (or compatible)
        NI-VISA
    Hardware
        LM92 Temperature Sensor
        PIC16F877 Microcontroller

 

Instructions

1. Configure the serial port
2. Set the ASRL End Out property to specify that a termination character will be used to terminate write operations
3. Set the input buffer size
4. Set the XON/XOFF characters if XON/XOFF flow control is used
5. Read the bytes in the buffer and convert it to a temperature reading by dividing by 100
6. Display data on a graph

7. Close VISA session

 

Additional Information or References

 

fp.JPG

 

lm92.png

 

**This document has been updated to meet the current required format for the NI Code Exchange.**

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.