Probably dumb mistake C1086 error again


kedi

Recommended Posts

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

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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).

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.