Sign in to follow this  
Followers 0
PLCUser007

Fins commands through the cpu serial

6 posts in this topic

Is it possible to send fins commands through the cpu serial communications? If yes, let say the read area command. How does it looks like?

I have tried every combination I can think of but no response from PLC not even error messages. Im not quite sure if I understand the fins commands and the implementation of it.  Do I have send the commands in a specific queue?

2020-04-06_111447.thumb.png.179eac0742a4

 

I'm able to send c commands through the serial port, and I'm getting response from plc. The only difference between c command and Fins command in PLC setting is that I use Host link instant of Toolbus.

2020-04-06_095136.png.f3c967b37f098af42f

 

 

 

thank you in advance

 

Share this post


Link to post
Share on other sites

I am assuming that you want to read 4 bits starting at H7.00.  Lets also assume that the node you want to read from is FINS Net 1, Node 60.  

This would be your command (Spaces are just there for explanation):

@00 FA 5 80 00 07 01 3C 00 00 00 00 01 0101 32 0007 00 0004 0F *<CR>

@00 - host link header and node 

FA - Host link command for encapsulated FINS message

5 - Response wait time, I just chose 5 = 50 ms

80 - ICF  80 for commands

00 - RSV - not used always 00

07 - GCT - Gateway counter.  Max 7 for newest products

01 - DNA - Destination network address - given as 1 in this example

3C = 60 - DA1 - Destination Node address given as 60 in this example

00 - DA2 00 points at the CPU

00 - SNA - Source network address leave at 00

00 - SA1 -Source node address, leave at 00

00 - SA2 - Source unit number, leave at 00

01 - SID - Number that is typically incremented to keep track of which response is to which command, response will have 01 in this same field.  Arbitrarily chose 01

0101 - FINS memory Area Read command

32 - FINS code for Bit level read in HR area 

0007 Start read in word 7 of that area

00 - Start read with bit 00 of word 7 in that area

0004 - read 4 bits

0F - Host link Checksum

*<CR> - CR = 0D in HEX - Host link terminator

Response (HR7 = 0000 0000 0000 0101 in binary):

@00 FA 00 C0 00 02 00 00 00 01 3C 00 01 0101 0000 01000100 46 *<0D>

@00 - Host link header and node number

FA - Host link response for encapsulated FINS message

00 - always 00

C0 - ICF - C0 for responses.

00 - RSV - not used leave at 00

02 - Gate counter - response set it back to 2

00 - DNA - Destination network number - echo back of source from command.

00 - DA1 - Destination node address  - echo back of source from command.

00- - DA2 - Destination unit address  - echo back of source from command.

01 - SNA - Source network number  - echo back of destination from command.

3C - SA1 - Source node number  - echo back of destination from command.

00 - SA2 - Source node number -  - echo back of destination from command.

01 - SID - Echo back of SID from command

0101 FINS command 

0000 FINS Response Code 0000 means success

01000100 is the data in reverse.  The first 01 is H7.00, the next 00 is H7.01, the next 01 is H7.02 and the last 00 is H7.03

46 - Hostlink checksum

*<CR> - Hostlink terminator CR = 0D HEX.

 

1 person likes this

Share this post


Link to post
Share on other sites

Hello Micheal,

I very much appreciate you taking time to answer my question.  About the encapsulated messages, Do I also have to include the " @00" at the start of the command and the Checksum at the end?

 

//fins command header
fins_cmnd[0] = 0x80; /*ICF*/
fins_cmnd[1] = 0x00; /*RSV*/
fins_cmnd[2] = 0x02; /*GCT*/
fins_cmnd[3] = 0x00; /*DNA*/
fins_cmnd[4] = 0x00; /*DA1*/
fins_cmnd[5] = 0x00; /*DA2*/
fins_cmnd[6] = 0x00; /*SNA*/
fins_cmnd[7] = 0x00; /*SA1*/
fins_cmnd[8] = 0x00; /*SA2*/
fins_cmnd[9] = 0x00; /*SID*/
fins_cmnd[10] = 0x01; /*MRC*/
fins_cmnd[11] = 0x01; /*SRC*/
//fins command body
fins_cmnd[12] = 0x82; /*VARIABLE TYPE: DM*/
fins_cmnd[13] = 0x00; 
fins_cmnd[14] = 0x64; /*READ START ADDRESS: 100*/
fins_cmnd[15] = 0x00;
fins_cmnd[16] = 0x00; /*WORDS READ: 150*/
fins_cmnd[17] = 0x96;




/*send command*/
printf("Send command:\r\n");
RS232_SendBuf(cport_nr, fins_cmnd, MAX_MSG);

 

Share this post


Link to post
Share on other sites

You don't need the @00, FA, 5, Checksum or *<CR> if you are just sending a FINS command over Ethernet for example.  

Start with the ICF and end with the FINS command, my example would then look like this:

80 00 07 01 3C 00 00 00 00 01 0101 32 0007 00 0004

It looks like you have it correct in your code above for your application....

If you want to use serial, yes, you need to include everything in my response above and the port needs to be configured for Hostlink.  If you are using Hostlink though, just use the @00 RD Hostlink command.  You had asked how to send a FINS command using a serial connection though. And for that, you need the FA hostlink command which encapsulates a FINS message inside a hostlink command.

1 person likes this

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