CONSTANT TROUBLES
vining
Posts: 4,368
I'm re-working my HomeWorks module and I'm having a bit of an issue that's driving me batty.
I'me setting up for a max of 3 processors and I input values into the constants which then I use for a constant total for that processor. I then intend to use the constant for the individual processors to tally up the total for the entire system but I always get this error for the last line of the below code:
error:
HWI1_MAX_OUTPUTS in the watch bar indicates it exists and holds the correct value but the last line where I try to get the overall total doesn't work. Why? I've tried everything possible with the parethesis and this is no differant than what I'm doing above for the individual processor totals which work.
What am I missing?
I'me setting up for a max of 3 processors and I input values into the constants which then I use for a constant total for that processor. I then intend to use the constant for the individual processors to tally up the total for the entire system but I always get this error for the last line of the below code:
error:
ERROR: C:\file\: C10539: Identifier [HWI1_MAX_OUTPUTS] undefined
DEFINE_CONSTANT//NUMBERS OF MIs, H48 AND RF LNIKS <------------------------------------- CHANGE VALUES IN HERE!!!! FOR JOB ----------> HWI_PROCESSOR_1 = 1 ; //PROCESSOR 1 OR NUMBER OF PRCESSORS IN SYSTEM (MAX 3) HWI_PROCESSOR_2 = 2 ; //PROCESSOR 2 OR NUMBER OF PRCESSORS IN SYSTEM (MAX 3) HWI_PROCESSOR_3 = 3 ; //PROCESSOR 3 OR NUMBER OF PRCESSORS IN SYSTEM (MAX 3) HWI_FIND_TOTAL = 4 ; //USE TO RETURN TOTALS FOR A PARTICULAR PROCESSOR OF MI's, H48's OR RF. HWI_NUM_MI_DEVICES = 32 ; //MAX NUMBER OF OUTPUTS PER MI (PANEL) 8 MODULES X 4 OUTPUTS. HWI_NUM_H48_DEVICES = 48 ; //NUMBER OF DEVICES PER H48 BOARD, SHADES OR MAESTRO DIMMERS. HWI_NUM_RF_DEVICES = 64 ; //NUMBER ODF DEVICES PER RF LINKS, 1 RF LINK PER PROCESSOR. HWI_TOTAL_NUM_PROCs = 1 ; //TOTAL NUMBER OF PROCESSORS IN THE SYSTEM. //PROCESSOR 1 GROUP HWI1_NUM_MIs = 3 ; //0 OR NUMBER OF MI's (PANELS) ON PROCESSOR 1. (MAX 16) HWI1_NUM_H48s = 1 ; //0 OR NUMBER OF H48 BOARDS OR Q96 DEVICES ON PROCESSOR 1. (MAX 4) HWI1_NUM_RF_LINKS = 0 ; //0 OR 1 IF USING RF. ONLY 1 PER PROCESSOR. IF USING MULTIPLE RF PROCESSORS, ADD ANOTHER PROCESSOR GROUP. (MAX 1) HWI1_MAX_OUTPUTS = ((HWI1_NUM_MIs * HWI_NUM_MI_DEVICES) + (HWI1_NUM_H48s * HWI_NUM_H48_DEVICES) + (HWI1_NUM_RF_LINKS * HWI_NUM_RF_DEVICES)) ; //PROCESSOR 2 GROUP HWI2_NUM_MIs = 0 ; //0 OR NUMBER OF MI's (PANELS) ON PROCESSOR 2. (MAX 16) HWI2_NUM_H48s = 0 ; //0 OR NUMBER OF H48 BOARDS OR Q96 DEVICES ON PROCESSOR 2. (MAX 4) HWI2_NUM_RF_LINKS ` = 0 ; //0 OR 1 IF USING RF. ONLY 1 PER PROCESSOR. IF USING MULTIPLE RF PROCESSORS, ADD ANOTHER PROCESSOR GROUP. (MAX 1) HWI2_MAX_OUTPUTS = ((HWI2_NUM_MIs * HWI_NUM_MI_DEVICES) + (HWI2_NUM_H48s * HWI_NUM_H48_DEVICES) + (HWI2_NUM_RF_LINKS * HWI_NUM_RF_DEVICES)) ; //PROCESSOR 3 GROUP HWI3_NUM_MIs = 0 ; //0 OR NUMBER OF MI's (PANELS) ON PROCESSOR 3. (MAX 16) HWI3_NUM_H48s = 0 ; //0 OR NUMBER OF H48 BOARDS OR Q96 DEVICES ON PROCESSOR 3. (MAX 4) HWI3_NUM_RF_LINKS = 0 ; //0 OR 1 IF USING RF. ONLY 1 PER PROCESSOR. IF USING MULTIPLE RF PROCESSORS. (MAX 1) HWI3_MAX_OUTPUTS = ((HWI3_NUM_MIs * HWI_NUM_MI_DEVICES) + (HWI3_NUM_H48s * HWI_NUM_H48_DEVICES) + (HWI3_NUM_RF_LINKS * HWI_NUM_RF_DEVICES)) ; //TOTAL SYSTEM ALL PROCESSORS HWI_TOTAL_OUTPUTS = (HWI1_MAX_OUTPUTS + HWI2_MAX_OUTPUTS + HWI3_MAX_OUTPUTS) ;
HWI1_MAX_OUTPUTS in the watch bar indicates it exists and holds the correct value but the last line where I try to get the overall total doesn't work. Why? I've tried everything possible with the parethesis and this is no differant than what I'm doing above for the individual processor totals which work.
What am I missing?
0
Comments
--John
if I chnage this line: and compile I can watch the constant HWI1_MAX_OUTPUTS has beed correctly initialized to 144. So it works
John Gonzales wrote: That shouldn't and doesn't help. Although I have screwed myself many time with semi-colons. Usually after a while(xxx) ; or if(xxx); or define_function fnSomeFunctio() ; these will ruin you day and they're almost invisable when you're looking for the problem. Usually the result of a copy & paste.
I could easily just put the numbers in manually but I'd like to make this so I have to do as little as possible on every new job. After all isn't that the point, suffer today so tomorrow is easier.
I don't get a error compiling what you posted.
What firmware and processor are you using? I'm using an NI-4000 running v3.50.430.
You get an error (with no line number) when you only compile the constants?
I get line numbers. I just deleted that portion of the error line with the file path but the error consistantly points to that line and moves when it moves and I moved it several times.
My compiler is build 2.5.2.20 but me thinks I have to delete NS3 and do a reload. Maybe I'm not even current, although that wouldn't be the cause.
Can you post the code that doesn?t compile?
If I leave this line in: and leave this constant in the 2 constant array delcared further down the line and the 1 structure that uses this constant I get the error. If I use a different constant in these array and structure it works and leave the above line in it compiles fine.
I just adding the constant to the 1st constant array that uses it, it compiled ok. Same with the second constant array but adding it back to the structure causes the error again.
which is this line: HWI_TOTAL_MI_OUTPUTS is defined here 3 lines prior (code has changed from original)
The structure and arrays that use it, although the 2nd array will be deleted at some point: If I make this change it works:
The constant arrays are still using HWI_TOTAL_OUTPUTS and it compiles fine. I swear at certian times the constant arrays wouldn't work either.
Very flaky!
Almost like the error is thrown on an initial pass of the compiler where it hasn't yet been truely initialized but in the end when it matters it is. So it works fine if I don't use it?
Maybe I'll play with semi colons cuz I ain't got much else to try at this point. I did the one prior in response to John's post, maybe I need to do more.
It sounds like that?s more likely your real problem. You're not getting the math error?
Definitely something wierd going on.