ausbildu Posted January 30, 2007 Share Posted January 30, 2007 hi! its my first time working with the ue9 and faq factory. cant find any help in pdfs or the internet. i like to start logging data after i pushed a button. the data comes from a pressure transducer (connected to ain1). streaming is okay, i can see the right data. the button is connected with the FIO0, signal is okay (1 and 0). but after i started the sequence an pushed the button nothing happens. sequence: if (switch[0]==1) //i push the button beginlogging (log) //logging set endif i hope somebody is able to support me. Link to comment Share on other sites More sharing options...
AzeoTech Posted January 30, 2007 Share Posted January 30, 2007 Do you have that if in a loop? Otherwise it will execute only once and unless you have the button pressed at that time, nothing will happen. Actually, when you want to do something based on channel value, you probably should use a channel event. Click on the FIO0 channel in the workspace under CHANNELS: and then select the event tab on the right. You can put code here that executes whenever FIO0 is read (except stream, in which case it is in blocks). There you should be able to put your exact code. Also, I just noticed: you can't call your logging set "log" because log is a reserved word for the function log() which performs the logarithm of a value. You should pick a different name. Link to comment Share on other sites More sharing options...
ausbildu Posted January 31, 2007 Author Share Posted January 31, 2007 thank you very much ... i needed the last 1 and a half days with no success. now i am here since 25minutes and it works. but i noticed that in the daqfactory express user's guide they named the loggingset "log" (page 21 and 22). if its realy a problem because of the logarithm function someone should correct the PDF-file. Link to comment Share on other sites More sharing options...
AzeoTech Posted January 31, 2007 Share Posted January 31, 2007 Actually, I was wrong. You can name the logging set log even though it is a reserve word. You would not want to create a variable or channel named "log" however. So, the docs are actually correct. Link to comment Share on other sites More sharing options...
ausbildu Posted January 31, 2007 Author Share Posted January 31, 2007 next problem! now i can start the logging with my mentioned if-operation. but if the pressure transducer reachs a level of about 1.5volt the logging should be stopped although the button is still pushed down. the transducer is connected with the ain1. values are okay. i tried to write another "if" but when the button is pushed i cant stop the loggingset. perhaps somebody has an example how to handle this problem Link to comment Share on other sites More sharing options...
AzeoTech Posted February 22, 2007 Share Posted February 22, 2007 Just change the if section: if ((switch[0] == 1) && (volt[0] < 1.5) beginlogging(log) endif if (volt[0] >= 1.5) endlogging(log) endif This means if the switch is pressed and voltage is < 1.5 it will start the logging set. If the switch is released, the logging set will stay running. If you don't want that, change the endif / if(volt[0]..) lines to an else: if ((switch[0] == 1) && (volt[0] < 1.5) beginlogging(log) else endlogging(log) endif If the switch is pressed and the volts goes >= 1.5 the logging is stopped no matter what. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.