Sign in to follow this  
Followers 0
dream_chaser007

Undefined Indentifier - Error Problem

6 posts in this topic

Hello Friends, I am using Omron CJ1M model. It's quite old model and i am using first time Omron. Ok, first the methodology, to programme all in Ladder which also i am not much familiar. So, i had done my programe in STL and then this STL Programme i convert it in Function block. This function block i had called in Main programme in ladder. My programme is for drive. Now, i got problem with assignment of bool in STL and it is showing me error which is Undefined identifier although i assign by input and output corresponding. Ok ,one examle of it. I mentioned here. ******** (** SCON Byte_1**) DrivenEnabled := I_D1.0; (**SCON Byte Assignment**) Ready := I_D1.1; Warning := I_D1.2; Fault := I_D1.3; Supplyvoltage := I_D1.4; ControlFCT_HMI := I_D1.5; StateOperationMode0_1 := I_D1.6; (* Selection of mode*) StateOperationMode0_2 := I_D1.7; (*Selection of mode*) *********** here, variable I_D1 is DINT and all other variable like DrivenEnabled,Fault,Warning etc are bool. I dont understand , if i assign I_D1 as DINT and all other variables are bool then, why it is showing error as Undefined identifier? I got error with all bits of I_D1.0 to I_D1.7 and even with all variables. :( Bcoz for allenbradely or siemens plc's etc are working correctly. Pls help me. Thanks in advance

Share this post


Link to post
Share on other sites
You cannot address to bit level of integers in CX-P, yet anyway. There are other ways to achieve what your wanting to do. Omron is not allen bradley, like allen bradley is not siemens, like siemens is not AD, like AD is not mitsubishi, like mitsubishi is not fanuc, like fanuc is not toshiba, I could go on, but are running out of PLC manufacturers!!

Share this post


Link to post
Share on other sites
Hello dream_chaser007, Just to clarify what Scott is saying, you are trying to use a 'Structure' type variable, which (as again Scott points out) is not YET supported within CX-Programmer. To access the individual bits in this manner, you should make I_D1 an array (32 bits), then address the individual bits as eg. I_D1[2] (for bit 2). If I_D1 MUST be a DINT, then I would suggest using (if possible) an AT address for I_D1 (DINT) and use the same address for your BOOL array (obviously with a different name). Alternatively, there are the TST instructions, which can extrapolate the bit value within a given word. Hope this helps

Share this post


Link to post
Share on other sites
Hello Mr. anonymous, You are right. May be my explanation was not clear in last question but u got right what i want to ask. Sorry for that. Ok, i followed according to you said. But still the same problem. With array , its not allowed me to assign. Say for example , ID1[32] DINT and now, i want to assing ID1[1], while assigning this, it is showing me error that , the name should be changed. It is taking address and Array but the outside name is not taking. I should give another name. If i will give another name, then still problem is there. I also try with bit format with AT setting, it's taking the address which i want to show , but the same name like ID1.2 is not taking outside while in this case also ID1 is DINT. Again i stuck with same problem. Error : The name ID1[1] is not legal name, please choose another. can you give me more light on that ?? Thanks in advance. best regards, dream_chasser

Share this post


Link to post
Share on other sites
Hello dream_chaser007, First of all, do you know that you seem to have a cousin in India who has the same name as you, and who appears to be having exactly the same problem as you, except they have posted on PLCs.NET? Your work-around - Create a variable... Name = MyDint Data Type = DINT AT Address = W300 (or any valid available address) - bear in mind that being a DINT, this will occupy words W300 and W301. Create a second variable... Name = MyBoolArrayOfDint Data Type = BOOL Array Size = 32 AT Address = W300 (or the same address as was used for "MyDint". Now, MyBoolArrayOfDint[0] - [31] will equate with bits 0 - 31 of MyDint. Therefore, if MyDint has a value (say) of 1, then MyBoolArrayOfDint[1] will = TRUE. Remember, you cannot used 'Structure' type programming in CX-P yet, so anything that ends in ".n" will be rejected (unless you are using SFC, in which case there is a degree of Structure allowed, but that is something different altogether. Hope this helps.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0