Temperature Sensor Program

 

We are going to see how a Pascal program can be used to interact with a device. The device we are going to use is a temperature sensor. Many of the steps we are taking are similar to what we did when we ran the “Hello World” program. If you have not done that yet, you should.

 

If you do have not the temperature sensor already, you can order the DLP-TEMP-G 3-Channel Data/Temperature Acquisition Board from www.dlpdesign.com/usb/temp.shtml .

 

1)      Go to http://turbocontrol.com/simpleserial.htm

2)      Download  SimpleSerial-fpc-2.6.0.i386-win32-052912.zip

3)      Save SimpleSerial-fpc-2.6.0.i386-win32-052912.zip to location within your file manager

4)      Extract the files from SimpleSerial-fpc-2.6.0.i386-win32-052912.zip

5)      Open a command prompt window in the extracted SimpleSerial file

6)      Type “ppc386 dlptempg” (without the quotation marks) into your command prompt

And hit “Enter”. This compiles the dlptempg program.

7)      Type “dlptempg” in the command prompt. This runs the dlptempg program.

You should see something like this appear on the screen

 

                        Ports available: COM1

 

                        *** Press Ctrl-C to stop ***

 

                        Type port (just the number) you want to use then press Enter:

 

Make note of the ports available.

What you see may not be exactly the same as displayed.

 

8) Hold the “Ctrl” button and press “c” to exit the program.

9) Now plug your temperature sensor into a USB port and wait for a few moments for Windows to recognize your temperature sensor and load the appropriate drivers.

10) Type “dlptempg” to run your program again. This time you should see another port available, for example:

 

                        Ports available: COM1, COM3

 

                        *** Press Ctrl-C to stop ***

 

                        Type port (just the number) you want to use then press Enter:

 

The new port you see is the port which your temperature sensor is plugged into.

 

11) Now type the number of the new port and hit “Enter”. Here we would type “3” but your number might be different.

 

12) If you are seeing the date, time, and temperature being displayed every few seconds, then congratulations! You are successfully running the temperature sensor program!

 

13) Hold “Ctrl” and press “C” to exit the program.