kedi Posted August 9, 2021 Share Posted August 9, 2021 1 global l=4320 // 12 hours of 10 second samples 2 global A1,A2,A3,A4,A5,TA1,TA2,TA3,TA4,TA5 3 while (l>0) 4 delay(10) 5 A1=(read(a1)/10) 6 A2=(read(a2)/10) 7 A3=(read(a3)/10) 8 A4=(read(a4)/10) 9 A5=(read(a5)/10) 10 TA1=(TA1+A1) 11 TA2=(TA2+A2) 11 TA3=(TA3+A3) 12 TA4=(TA4+A4) 13 TA5=(TA5+A5) 14 l-- 15 endwhile Keep getting this error in spite of trying other variations on declaring the variables. If I declare A1 and the other variables as A1=0, etc, up in line 1, the C1086 error indicates the error being in line 1. What am I doing wrong with the variables? a1 to a5 are channel names. C1086 One of the parameters was empty: DischargeWH Line 5 - Uncaught error in sequence DischargeWH Quote Link to comment Share on other sites More sharing options...
kedi Posted August 9, 2021 Author Share Posted August 9, 2021 Never mind. Some kind of other glitch. Channel was not updating for some reason. Saved, closed, reopened and it was working. Not perfectly but got it sorted from there. Odd. The channel table was updating in the channel view. But was not transferring to the a1 variable. Now it is. Might have been hanging onto previous channel settings and getting glitched. Quote Link to comment Share on other sites More sharing options...
AzeoTech Posted August 9, 2021 Share Posted August 9, 2021 The read() function only triggers the reading of a channel. They return nothing, and so: isempty(read(a1)) would return 1. You are then trying to divide nothing by 10 which is why you are getting that C1086 error. There are other syntax errors in your code: 1) Line 2: you can't declare multiple variables in one line. 2) you are declaring global variables with the same name as your channels. Both channel names and global variables exist in the global namespace with global variables taking priority. So if you declare A1 as a global, you will no longer be able to access the A1 channel without using the prefix "Channel." This is also true with privates, which also take priority over channels (and globals). Quote Link to comment Share on other sites More sharing options...
kedi Posted August 9, 2021 Author Share Posted August 9, 2021 Yep. Found out all those things last night. After a while. Surprised that I can't declare multiple variables with a proper separator. Also that Variables are not case sensitive. Quote Link to comment Share on other sites More sharing options...
AzeoTech Posted August 9, 2021 Share Posted August 9, 2021 DAQFactory was designed for non-programmers and so some choices were made to avoid common gotchas. One is doing too many things on a single line. In C you can take this to the extreme: they at least used to have a competition to see who could write the most complex program in one line. Not sure if the competition is still around, but the ability to do too much in a line and create basically unreadable code still is. Another is case sensitivity. Yet another is the use of endif, endwhile, etc. instead of just block characters like {} used in C. Quote Link to comment Share on other sites More sharing options...
kedi Posted August 11, 2021 Author Share Posted August 11, 2021 I am glad to find out that the Alt key allows some more flexible paste options that help decrease a bit of typing. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.