Citect and CRC16 calculation

captain_is

Member
Join Date
Mar 2009
Location
Romania
Posts
57
Hello guyzz,

I have a problem that sounds something like this:

I need to read from Citect a energy meter (Type Algodue UPT210) over RS-485 and Modbus protocol. The connection is made and it's ok because i can see the measurements within a windows application.I need to request those measurements over Modbus and display it in a Citect project and for that i need to make a CRC calculation algorithm in CiCode.

Is anyone who encountered this kind of problem ? ..

I look forward to hear news from you.

Thanks in advance!!
 
no..i need to make a request for the meter to give me the informations i need.

for example :
request current measurements:

slave addr : 01
function code : 03
starting addr hi : 00
starting addr lo : 1C
number of word hi : 00
number of word lo : 10
error check : 85
C0

that value 85 C0 i need to calculate based on the rest of the message
message hex : 0103001C0010
CRC result : 85C0

and this is my problem..i don't know how to make an algorithm to do this calculation.

thanks for reply
 
Thats looks like a Modbus frame and as tragically1969 said. You should use the drivers in citect to communicate with the device.

there is really no reason you would write the modbus driver in cicode. the only thing I can think of is that you want to circumvent the tag count in citect.

Marsi
 
no..i need to make a request for the meter to give me the informations i need.

No you dont, the driver does that, just configure an IO device to use the Modbus protocol, create your tags on the correct address and it will read them, if you need to control how often and how much data the driver reads you can set all this in the citect.ini file.
 
this meter has registers like this in his memory
$0000 - 4 words - $1000 2 words System Voltage
$001C - 4 words - $1006 2 words System Current

I know how to configure this as an I/O device, configuring the board type COMXX, and port on this board. But how i will make the variable tags in Citect ? wich addresses will read those registers ?
like 400001 citect address reads %MW0 from a plc.

I need to say that i'm at the begining with all this stuff...and please don't be agressive:D

Tanks a lot for your interest!
 
this meter has registers like this in his memory
$0000 - 4 words - $1000 2 words System Voltage
$001C - 4 words - $1006 2 words System Current

I know how to configure this as an I/O device, configuring the board type COMXX, and port on this board. But how i will make the variable tags in Citect ? wich addresses will read those registers ?
like 400001 citect address reads %MW0 from a plc.

I need to say that i'm at the begining with all this stuff...and please don't be agressive:D

Tanks a lot for your interest!

I wasn't being agressive, you got an answer from me and then tried to tell me that it was wrong ?

Anyway, without the device manual in front of me i couldnt say, but at a guess if its over 2 registers it could be floating point (REAL) or a double integer (LONG) in Citect terms.

You need to check in the manual what type of registers they are.

The modbus addressing is the same, register 1000 in the device would be 401000 in modbus

Note: there may be an offset in there though depending on the driver you use so register 1000 might need to be 401001
 
No, i was just kiddin`...it was agressive between ""...i consider all your answers and don't judge on them...because i'm very grateful for your answers...i just needed to say that i'm a begineer and maybe i say sometimes things that are really foolish..but i'm confident that this will disapear once i will get more experience..

now i want to ask you..if it is so..1000 = 401000 because it sounds logical but now i don't have time to test it...then register 101C will be?

also i need to read from that device on a PLC..and this plc (TWDLCAA16DRF) does not support floating point and double integer.

Thanks again for your understanding.
 
No, i was just kiddin`...it was agressive between ""...i consider all your answers and don't judge on them...because i'm very grateful for your answers...i just needed to say that i'm a begineer and maybe i say sometimes things that are really foolish..but i'm confident that this will disapear once i will get more experience..

now i want to ask you..if it is so..1000 = 401000 because it sounds logical but now i don't have time to test it...then register 101C will be?

also i need to read from that device on a PLC..and this plc (TWDLCAA16DRF) does not support floating point and double integer.

Thanks again for your understanding.

i would imagine that 101C is a hex address, you need to convert it to decimal, that would be 4134

I cant help that much with your PLC without knowing what format the analigue device stores its values in, you should be able to do some sort of conversions in the PLC
 
i tried as you said..i created variable tags with addresses like
for $1000 in energy meter - 404097 in citect
for $101C - 404125
and my devices do not communicate...its says in kernel :
generic 000008 driver 00000257 error_in_cmd-3 16
i stucked here..

any other advices?
 

Similar Topics

Hello, I have a running project on Citect v5.42 and simatic net v6.4 I have created a new spare PC and loaded all software like Citect, station...
Replies
0
Views
65
Hello everyone, In a factory where we installed Citect 7.20 the computer began to show the first signs of end of life. They never considered...
Replies
0
Views
72
I have a running backup of Citect and plc and I want to make a spare PC station so I have installed the win XP and somatic net v6.0 and import the...
Replies
3
Views
118
I am trying to display a variable within a cicode function onto a graphics page. This function queries a SQL database. I can get the value onto a...
Replies
3
Views
273
Looking for some help with the connection issue between Citect 2018 and Top Server v6 for Opto22. I’m setting all this up to communicate with some...
Replies
0
Views
115
Back
Top Bottom