I'm fairly new to programming with CoDeSys, but i've managed to program a couple of 750-series controllers with tasks like SNMP->Modbus converters.
At the moment i'm working on a remote management to a cooling device, and i need information on water flow. For this i'm using the 750-638 up/down counter, but i'm a bit confused with the wiring, because i'm not getting any data out of it.
My PLC setup:
I have 4 NTC-sensors and 2 Flowmeters connected.
These are the NTC-sensors.
(They give the temperature in celsius*10 and i had to write a converter which divides the input and writes it as a REAL value with a decimal, is there btw an easier way to do this than to have a function for the task?)
Then the UP/DOWN counter & Flowmeters; I've tested all kinds of adresses (%IW4-%IW10) with all kinds of variable types, and it always stays at 0. I've also tested fetching with %IX4.0-%IX10.11 with BOOL, and everything always stays at FALSE.
The datasheet for the 750-638 also didn't help me out. At the moment my HW configuration on the 638 is as follows:
24V pin = (24V) +
0V pin = (24V) -
DI+ pin = Signal from Hall sensor
The Hall sensor itself is tested and gives an output pulse of 24V every rotation (at the moment about 26Hz = 26 RPS)
Any help will be greatly appreciated (and the questions definitely don't end here Next thing to tackle is writing the code so it calculates how many pulses per x seconds and then turning it to l/min.)
PS. There is very little information in the manuals of the correct adressing and usage of correct variable type (WORD/BYTE/REAL/DINT etc.), that's why i really struggle with all this. But well, learning this is actually quite fun.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
On your 638 you see a small LED on the leftside.
the led must be in a circuit so if you make a wire from the D1- input (15) to ground the circuit is complete.
this way you can also use pnp and npn contacts.
yes you may use up to 30 volts on the input.
(current sensitive circuit inside)
LED B (DI1 should flash.)
if no luck give message
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2012-05-09
Originally created by: Supra^
shooter hat geschrieben:
On your 638 you see a small LED on the leftside.
the led must be in a circuit so if you make a wire from the D1- input (15) to ground the circuit is complete.
this way you can also use pnp and npn contacts.
yes you may use up to 30 volts on the input.
(current sensitive circuit inside)
LED B (DI1 should flash.)
if no luck give message
Hello!
I tried out this just now, and it seems that the LED doesn't flash.
EDIT: when DI- grounded, the rotation pulse went to 0Hz
EDIT2: Problem solved! I've forgotten to put pull-up resistors on the signal, so it never fluctuated between 0-24V, instead something like maybe 0-2V. I couldn't prove this because i didn't have an oscilloscope, only a normal multimeter... Can't believe how i managed to miss it, as i always have used pull-up resistors in my previous projects
Then to the next problem: How do i tell codesys to count for the amount of pulses for a certain time (let's say 2 seconds) and store it as a variable?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Okey found your problem
on the 881 connect the 24 volt on 2
connect the minus on 3
make a bridge from 6 to 1
make a bridge from 7 to 5
both to give power to the controller
put the 638 as first unit watch the small fins that make contact to the 24 Volt of the controller.
put the 464 as second or behind every unit having these power contacts.
put a 600 as last unit to make communication in the set.
on the 638 make a connection between 4 and 3
put the signal on 1
put the plus of the sensor on 2 and the minus on 7
2 and 6 are +24 V
and 3 and 7 are minus.
there must be 24 volt power supply to the 638 unit to work.
As you can see the 464 has no power contacts and can not give power to a rightside neighbour,
in normal way it is impossible to make this as you can not slide it in normal way.
so now for the inputword.
open PLC configuration and add on the K bus your inputunits in the seqeunce as they are on your PLC.
now the system will give you back the Bits and bytes where everything is.
my computer puts it in bytes, but you can use words.
now doubleclick on AT %IXB2 and give a name (cntlow)
do same with %IXB3 (cnthigh)
these are GLOBAL VARS and can be used anywhere
see global vars under resources.
power up the plc and check if led is blinking.
make program with these two bytes.
just for display
then convert BYTE_TO_word cnthigh
mul with 256 and add cntlow.
ask for %IW1 this should be same
for other channel it is %IW3 (%IB6 and 7)
normal the analog comes first but as this block is in words it does give the 464 the words 4 and 5
for other module outputs it starts at %QW4 or %QX4.0
hoping it helps you.
if not you can email me at e shooter@home.nl e
or skype paul.deelen
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2012-05-09
Originally created by: Supra^
shooter hat geschrieben:
so now for the inputword.
open PLC configuration and add on the K bus your inputunits in the seqeunce as they are on your PLC.
now the system will give you back the Bits and bytes where everything is.
my computer puts it in bytes, but you can use words.
now doubleclick on AT %IXB2 and give a name (cntlow)
do same with %IXB3 (cnthigh)
these are GLOBAL VARS and can be used anywhere
see global vars under resources.
power up the plc and check if led is blinking.
make program with these two bytes.
just for display
then convert BYTE_TO_word cnthigh
mul with 256 and add cntlow.
ask for %IW1 this should be same
for other channel it is %IW3 (%IB6 and 7)
normal the analog comes first but as this block is in words it does give the 464 the words 4 and 5
for other module outputs it starts at %QW4 or %QX4.0
hoping it helps you.
if not you can email me at e shooter@home.nl e
or skype paul.deelen
The hardware-configuration is OK, and the LEDs are blinking, and data received. As for the program, i made the test with BYTEs and WORD, it works. Now i'm trying to do the counter, and have absolutely no idea where to begin. I read the CoDeSys & OSCAT manuals regarding timers and counters, but didn't learn/find anything.
I found out that there's a counter reset (%QX0.5: BOOL) and a counter pause (%QX0.4), so i thought they could be used and something as following:
1. Reset counter
2. Run timer for 2 seconds
3. Pause counter
4. Store result in variable
->return to step 1.
I'm definitely not asking you guys to write the whole code for me, just to give me a start so i can understand a little of how this works. Should i use FBD or ST (IL is out of the question as i don't understand it at all). How do i get the time correct, should things be unpaused and unreseted also (because the output variables are BOOL)?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2012-10-25
Originally created by: Supra^
shooter hat geschrieben:
so i wrote you a starter, in FBD
a big library can be found at http://www.oscat.de download the lib and the txt version, a good way to learn ST
and the manual in english.
Sorry for the delay. I got the program working, and have done a couple of these in the means of checking actual flows and cooling/heating capacitys in kW.
Now, the next thing that i'm working on, is to have some kind of logging for the device, shortly like this:
Measurement of cooling power in kW every minute for 60 minutes, calculates it to kWh, and stores it somewhere. Then i need to store the data somewhere for a month at a time, and then send the list (possibly with e-mail) with medium kWh for the whole month, and maybe sorted per day or hour also.
Is this doable with arrays, or some other type of listing/logging? I have zero knowledge of creating arrays
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Originally created by: Supra^
Hello!
I'm fairly new to programming with CoDeSys, but i've managed to program a couple of 750-series controllers with tasks like SNMP->Modbus converters.
At the moment i'm working on a remote management to a cooling device, and i need information on water flow. For this i'm using the 750-638 up/down counter, but i'm a bit confused with the wiring, because i'm not getting any data out of it.
My PLC setup:
I have 4 NTC-sensors and 2 Flowmeters connected.
These are the NTC-sensors.
(They give the temperature in celsius*10 and i had to write a converter which divides the input and writes it as a REAL value with a decimal, is there btw an easier way to do this than to have a function for the task?)
Then the UP/DOWN counter & Flowmeters; I've tested all kinds of adresses (%IW4-%IW10) with all kinds of variable types, and it always stays at 0. I've also tested fetching with %IX4.0-%IX10.11 with BOOL, and everything always stays at FALSE.
The datasheet for the 750-638 also didn't help me out. At the moment my HW configuration on the 638 is as follows:
24V pin = (24V) +
0V pin = (24V) -
DI+ pin = Signal from Hall sensor
The Hall sensor itself is tested and gives an output pulse of 24V every rotation (at the moment about 26Hz = 26 RPS)
Any help will be greatly appreciated (and the questions definitely don't end here Next thing to tackle is writing the code so it calculates how many pulses per x seconds and then turning it to l/min.)
PS. There is very little information in the manuals of the correct adressing and usage of correct variable type (WORD/BYTE/REAL/DINT etc.), that's why i really struggle with all this. But well, learning this is actually quite fun.
On your 638 you see a small LED on the leftside.
the led must be in a circuit so if you make a wire from the D1- input (15) to ground the circuit is complete.
this way you can also use pnp and npn contacts.
yes you may use up to 30 volts on the input.
(current sensitive circuit inside)
LED B (DI1 should flash.)
if no luck give message
Originally created by: Supra^
Hello!
I tried out this just now, and it seems that the LED doesn't flash.
EDIT: when DI- grounded, the rotation pulse went to 0Hz
EDIT2: Problem solved! I've forgotten to put pull-up resistors on the signal, so it never fluctuated between 0-24V, instead something like maybe 0-2V. I couldn't prove this because i didn't have an oscilloscope, only a normal multimeter... Can't believe how i managed to miss it, as i always have used pull-up resistors in my previous projects
Then to the next problem: How do i tell codesys to count for the amount of pulses for a certain time (let's say 2 seconds) and store it as a variable?
Okey found your problem
on the 881 connect the 24 volt on 2
connect the minus on 3
make a bridge from 6 to 1
make a bridge from 7 to 5
both to give power to the controller
put the 638 as first unit watch the small fins that make contact to the 24 Volt of the controller.
put the 464 as second or behind every unit having these power contacts.
put a 600 as last unit to make communication in the set.
on the 638 make a connection between 4 and 3
put the signal on 1
put the plus of the sensor on 2 and the minus on 7
2 and 6 are +24 V
and 3 and 7 are minus.
there must be 24 volt power supply to the 638 unit to work.
As you can see the 464 has no power contacts and can not give power to a rightside neighbour,
in normal way it is impossible to make this as you can not slide it in normal way.
so now for the inputword.
open PLC configuration and add on the K bus your inputunits in the seqeunce as they are on your PLC.
now the system will give you back the Bits and bytes where everything is.
my computer puts it in bytes, but you can use words.
now doubleclick on AT %IXB2 and give a name (cntlow)
do same with %IXB3 (cnthigh)
these are GLOBAL VARS and can be used anywhere
see global vars under resources.
power up the plc and check if led is blinking.
make program with these two bytes.
just for display
then convert BYTE_TO_word cnthigh
mul with 256 and add cntlow.
ask for %IW1 this should be same
for other channel it is %IW3 (%IB6 and 7)
normal the analog comes first but as this block is in words it does give the 464 the words 4 and 5
for other module outputs it starts at %QW4 or %QX4.0
hoping it helps you.
if not you can email me at e shooter@home.nl e
or skype paul.deelen
Originally created by: Supra^
hoping it helps you.
if not you can email me at e shooter@home.nl e
or skype paul.deelen
The hardware-configuration is OK, and the LEDs are blinking, and data received. As for the program, i made the test with BYTEs and WORD, it works. Now i'm trying to do the counter, and have absolutely no idea where to begin. I read the CoDeSys & OSCAT manuals regarding timers and counters, but didn't learn/find anything.
I found out that there's a counter reset (%QX0.5: BOOL) and a counter pause (%QX0.4), so i thought they could be used and something as following:
1. Reset counter
2. Run timer for 2 seconds
3. Pause counter
4. Store result in variable
->return to step 1.
I'm definitely not asking you guys to write the whole code for me, just to give me a start so i can understand a little of how this works. Should i use FBD or ST (IL is out of the question as i don't understand it at all). How do i get the time correct, should things be unpaused and unreseted also (because the output variables are BOOL)?
so i wrote you a starter, in FBD
a big library can be found at w www.oscat.de w download the lib and the txt version, a good way to learn ST
and the manual in english.
counter20120509.pro [31.38 KiB]
Originally created by: Supra^
Sorry for the delay. I got the program working, and have done a couple of these in the means of checking actual flows and cooling/heating capacitys in kW.
Now, the next thing that i'm working on, is to have some kind of logging for the device, shortly like this:
Measurement of cooling power in kW every minute for 60 minutes, calculates it to kWh, and stores it somewhere. Then i need to store the data somewhere for a month at a time, and then send the list (possibly with e-mail) with medium kWh for the whole month, and maybe sorted per day or hour also.
Is this doable with arrays, or some other type of listing/logging? I have zero knowledge of creating arrays
Hi