08-24-2009 02:20 PM
Darnell:
As I said 3 times in my earlier post, you set the Actual Temperature using SetCtrlVal(), after you use ComRd to read the chiller temperature. If you're having problems after following some advice you get here, please go back and carefully re-read the advice. SetCtrlVal, not GetCtrlVal. After calling ComRd(), not before.
In your timer callback, I don't think you want to open the COM port every time the timer ticks. You should open it once at the start of your program and just leave it open until you're ready to exit your program.
You don't need to read the TIMER value. All you need to do is to react whenever it ticks.
Try this in your timer callback.
1. Use ComRd() to read the chiller temperature.
2. Use sscanf() to convert the string you read using ComRd to a numeric.
3. Use SetCtrlVal() to write the value to the screen.
Use an ANSI C reference book or the CVI function panel help to get details on using sscanf().
Note that your Actual Temperature control is type int. When you read the temperature from the chiller, does the string it returns look like an int or like a floating point? If it looks like a floating point, do you want to display that precision or do you just want to display it to the nearest degree?
08-24-2009 08:44 PM
Guess what , it wasnt my code, it was the bugs in the actually instrunment that i found, so i had to set up alot up test conditions to catch all the bugs in the device.
but now i got it working. but the device was changing case sentivity . so i had to set up a do while loop which is a infinity loop to where it will keep looping until instrument responds.
its weird. it was doing that in hyper terminal, I had to do alot of manually parsing. that was new. but i learn alot. I had to really dig deep. thanks AL s. For just assisting me. good job
so for example one of the commands is SP? so would happen is i will ComWrt And ComRd SP? but it would return an error, But if i do the command on the fifth time it will respond correctly. so i had to set up a loop condition to run until Success. so it may work on the first or the tenth time .. but it will keep going until the instrunment responds back correctly. we call the vendor to find out why it was doing that. they said they never encountered that problem ever.