Codesys problem with variables

rkk

Member
Join Date
Aug 2012
Location
Italy
Posts
1
Hi, for some reason when i declare 2 global variable codesys keep associating them and if i change the value of one so does the other. No code is made to change the second variable

ysport: INT :=40;
i:BOOL:=FALSE; <---
PRENDIFILM: BOOL;
prendiflag: BOOL := TRUE;
cu: BOOL :=FALSE; <---


in the exaple cu and i are for some strange reason out of my mind associated, the declaration is on the global variable page. If i try to force the 2 variables change togheter even if i is never used on the program!

Any one can help me?
 
You will have to send your program too as with me this works fine.
Please do not forget when you use a counter this has a VAR called CU, and in many cases internally they use an I for var.
advice is to make the your vars according the manual.
like gxI saying global bool I
now you know by the name where the var is and what type it is.
looked up for you:
FUNCTION_BLOCK CTU
(*
Counter Up.
CV is incremented by 1 if CU has a rising edge.
Q is TRUE, if CV is reached PV.
*)
VAR_INPUT
CU: BOOL; (* Count Up *) <----- here is your answer
RESET: BOOL; (* Reset Counter to 0 *)
PV: WORD; (* Counter Limit *)
END_VAR
VAR_OUTPUT
Q: BOOL; (* Counter reached the Limit *)
CV: WORD; (* Current Counter Value *)
END_VAR
VAR
M: BOOL; (* Variable for CU Edge Detection *)
END_VAR

when you define any of them global all program is **** as all vars will look to each other.
 

Similar Topics

Hello, I am using a Hitachi Micro EHV+ for a small project, and I wanted to have a Web visu, done with Codesys V3.5 SP13 Patch 2. I test the...
Replies
6
Views
286
Hello, I have a requirement to manage the text alignment dynamically. So, for example: 1. English Texts should be displayed from Left in...
Replies
0
Views
90
Hello, I am new to Codesys, and am trying to learn about it for a project we're developing. I've got a couple questions, but first a little...
Replies
1
Views
139
Hi everyone, as this is my first experience with Rockwell Software i would like to know what's the best way to make Enumerations?
Replies
10
Views
499
I am trying to get Codesys to work with a couple of Moxa ioLogik E1200 series DIO devices (E1210 and E1211). I am able to write to the E1211 DOs...
Replies
2
Views
167
Back
Top Bottom