Jump to content

Recommended Posts

Hello,

I have a V430-J-T2 and I need to read really fast a measurement of a load cell from a digital module (model TLB from Laumas).

This module has many protocols, as Modbus-RTU, Canopen, modbus-tcp, profibus-DP, Profinet-IO, and others.

In my CLP, I already using the ethernet in application (with aditional module), so I am thinking in use the profibus or modbus-RTU to comunicate with this Load-cell module.

But my application requires that I read this value at least 200 times per second. It is almoust 1 read per scan.

It's possible to vincule an MI or ML by one of this protocols, so that I can monitor this value in the interruption of 2.5mS? 

Or it has other way to do this monitoring efficiently?

Thanks.

Fábio

 

Link to post
Share on other sites

TLB have internal CONTINUOUS FAST WEIGHT TRANSMISSION PROTOCOL

300Hz weight data with minimum baud rate 38400 baud over RS485 provided.

I think - you can apply Protocol FB and read weight in 1 read per scan  rate.

As you use Ethernet for visilogc connection - you have free PORT1 on V430. It is simple and fast solution.

 

Another net solution has  faster transmition  (CANopen for example), but comm command not possible to place inside interrupt routine.

Than real rate not faster than 1 per scan.

I test CAN open servo drive position readout - 1read per scan works - faster maybe possible but i cannot test CANopen readout with interrupt.

  • Like 1
Link to post
Share on other sites

Thank you Kratmel.

I never used this protocols, like Fieldbus, so my doubt is how many milliseconds this block "Read" of Fieldbus take to capture a new value of the bus? 

Because I read that the modbus protocol take at least 100ms to complete a read. 

Even that this "FB read block" operate in second plan, its lead time to read a new value couldn't pass of 5ms. You think that it's possible?

Thanks

Fábio

 

Link to post
Share on other sites

I test FB Protocol in different solution - looks like it is possible to read 1 time per scan. No add enable bit exept port ready needed.

If scale TX speed set  faster than 38400 - com port buffer work more faster than PLC scan.

You can test it via PC - send numbers 1,2,3......   with rate  300 per second  and try to read it via PLC and store to incremented per scan memory MI.

 

CANopen in 500kB speed operate with 1 read per scan.  But run CANopen network is not easy way.

 

  • Like 1
Link to post
Share on other sites

Hum.. Ok, now I think that I understand..

When you said FB, I mistook it with fieldbus, but in really are you suggesting me to use modbus, right?!

Ok, so I configured Modbus over port1 with "COM INIT", and "MODBUS CONFIG", on Main Routine.

After that, I put the "Read float registers" of the "FB's/modbus" on my Interrupt 2.5mS Routine. But I reduce the frequency at a half with a flag, so it will read every 5mS.

 image.png.67609606d360a1927084a89a639d5866.png

 

Could you please give me more information about how can I simulate a Slave with my PC?

Thanks again..

Fábio

 

Link to post
Share on other sites
7 minutes ago, Fabio said:

but in really are you suggesting me to use modbus, right?!

No.  Modbus is a handshaking protocol and it will take too long - you're doing good if you can get 10 reads/sec with Modbus.

kratmel says this device has CONTINUOUS FAST WEIGHT TRANSMISSION mode.  I didn't look in the manual, but this tells me you can put it into a mode where it just sits there and broadcasts data as fast as it can, regardless of whether someone is listening or not.  I've worked with scales that do this.

The block kratmel is talking about is located under the FB's menu and is called "Protocol".  It lets you roll your own communication - do not be afraid of it.  In your case you'll set it up to listen to the serial port for whatever is coming in and set a bit when it receives something.

For starters take your module and connect it to your computer serial port with a terminal program.  Configure it with the CONTINUOUS FAST mode and see if you see a whole bunch of weights on the terminal program.  Then you can determine how to make it work with the PLC.

Joe T.

 

 

  • Like 2
Link to post
Share on other sites

Hello Joe and Kratmel.

Really thanks again.

Ok, now I understand how to this. I will implement this communication on the day after tomorrow, because I am travelling, and than I comment here.

Kratmel, You said that it is possible to simulate by sending messages from PC.  Could you point me to some software to do this? I will need this, because I have the PLC but I don't have yet the TLB module.

Thanks

Fábio

Link to post
Share on other sites

I do not test this freeware but after start on my PC  it offer send file with string to com port.

https://www.aggsoft.com/com-port-emulator/download.htm

 

One quastion about your application: is it possible to use analog input of PLC to read signal from sandard TLB analog output (0-10V or 4-20mA)?

Vision offer 1time per scan analog signal mesurement and maybe you do not need above 10bit resolution.

I see standard configuration:

https://www.ebay.com/itm/TLB-load-cell-transmitter-amplifier-LAUMAS-RS485-4-20mA-0-10V-relay-outputs-/193479327670

Then - you do not need to use any serial communication and your application can be fast.

 

  • Like 1
Link to post
Share on other sites
  • 5 weeks later...

Hello Kratmel and Joe..
Sorry by the long delay in return.

Firstly really thank you for the solution, I think that it will works very well.
Secondly I wish to you a very good new year!! with many 
achievements.

I implemented the code as you suggest, and according the manuals and toturials, but as a result I always get the error "-1". What can I be doing wrong?
See how the code is in imagens bellow.

To simulate the message, I am using the terminal suggest by Joe, with a simple message "999999#013#010", being #013 the CR and #010 the LF.

 

Answering you kratmel, in this moment I already using the native analog input of PLC, but it is not a ideal situation by the low resolution. So all of this that I am trying (using the TLB) is exactly increment the resolution without need to change the PLC (because this fits perfectly the other requisits of the project).

On 12/9/2020 at 7:43 PM, kratmel said:

One quastion about your application: is it possible to use analog input of PLC to read signal from sandard TLB analog output (0-10V or 4-20mA)?

Vision offer 1time per scan analog signal mesurement and maybe you do not need above 10bit resolution.

 

 

Protocol config.png

Protocol Scan.png

Protocol Scan Parameters.png

Protocol Scan variable.png

comunication TLB.png

Link to post
Share on other sites

First off, if you're receiving 6 digits you'll need to link to an ML, not an MI.  Try changing MI 285 to ML 0 in your variable definition block and see if that works.

I've had trouble with the scan block doing the numeric receiving and translation in one operation.  For testing, try changing your input variable to a straight longer-than-needed Stream type and see if you can grab the control characters as well.  They may not be sending all six characters as weight.

Here I've set up the block to receive a stream of any kind that hits the COM port up to 10 characters.  The incoming data will be in MI 20..24, with two bytes per MI:

image.png.305665dc40bc3ab6da89e82927331ead.png

image.png.61f65159d9ef9a49f42f2a22cafcac4f.png

 

To see what you get, use the "Memory" tab all the way at the bottom of Visilogic and configure it to display your message:

image.png.3fa84bcfbecf71aedd2f655735cd2cc5.png

 

You have to configure this tab and entry offline, but when you go online it will show you what's happening.  If you want to see the raw hex values (and therefore your control characters) change the size to 16 BIT and the format to HEX.

So what I typically do is always use Stream types in the SCAN blocks and then use the String and ASCII->NUM blocks in ladder to get the information I need.  It's not as slick as using Numeric variables, but it's a lot more predictable and I can see where things go wrong.  And the Scan block always works.

If you try this and post your code with your observations we can be helpful.

Joe T.

 

  • Like 1
Link to post
Share on other sites

Hi Joe,

Thanks for the tips and help.
However, I still have no communication. Just getting error -1.
I tried exchanging the MI for an ML and it didn't solve.
Then I tried using exactly the configuration you presented (stream with vector and with termination after 10mS) and other similar settings, such as 1 byte for a link, and none has worked yet.

It may be that the problem lies elsewhere.

The memory tab shows no value, even after online. It's normal?

Could I be sending something wrong through the serial emulator? I am just using the "send" field and putting a number directly. (see the image)

Perhaps it would not be necessary for me to be using the message structure as shown in the attached image? For example, could the absence of STX and ETX be causing this failure?

Or is it that the presence of the configured ethernet must not be disturbing COM 1? I am using ethernet to program and monitor the PLC.
Will serial port 1 on the PLC always be linked to COM 1?

 

Thanks for the Help..

Fábio

Protocolo.png

Terminal.png

Link to post
Share on other sites

Hi;

The Data from the Scale is being sent as an ASCII String  ( Not an actual Number  - ML or MI)

In Info Mode  in the PLC, look at the Serial Port  Monitor  and see what the data being received there looks like.

Receive  as  a   Stream     of     Vector Length 3  ( convert 2 Bytes to Linked Element(MI) )  with the CR,LF as the End of Text(EOF)( Length 2)

Make sure the 4th MI is set to   0x00   NULL      >>     12  34 56  0x00      (Note:  You can look at the MI's On Line  in HEX Format - easy read for ASCII Data)

THEN  convert the ACSII String   to an ML  in the ladder. >>   Strings     ASCII to Num

( Have an ASCII Table handy ! )

DanT   

 

 

  • Like 1
Link to post
Share on other sites

If you're getting a -1 in MI 282 then something is happening.  The block just doesn't know what to do with the incoming stream.

If you're using Ethernet then COM 1 will be dedicated to your SCAN block.

DanT describes using Info Mode to look at the serial buffer.  Do this.

Upload your program so we can see exactly what you're doing.

Joe T.

  • Like 1
Link to post
Share on other sites

Hi Joe and DanT,

Sorry again for the delay. Not every day I can be near the machine to do the tests.

In INFO mode I can see that exactly what I'm sending is coming. (Attached photo). In that case I sent 999999+CR+LF.

However, even configuring as DanT recommended or some similar ways, I still receive "-1" in status.

I am attaching the program.

Again I appreciate the help.
Fábio

Captura de tela 2021-01-21 111935.png

TDCV500N-V430-0.1.14 - apenas protocolo.vlp

Link to post
Share on other sites
  • 2 weeks later...
On 1/15/2021 at 5:02 PM, Joe Tauser said:

If you're getting a -1 in MI 282 then something is happening.  The block just doesn't know what to do with the incoming stream.

If you're using Ethernet then COM 1 will be dedicated to your SCAN block.

DanT describes using Info Mode to look at the serial buffer.  Do this.

Upload your program so we can see exactly what you're doing.

Joe T.

Hello Joe and colleagues..

Did you get a litle time to test the code? 

Thanks

Fábio

Link to post
Share on other sites

I can't explain why, but I tried several combinations and the variable type "Numeric->Decimal ASCII No Fixed Length" seems to work best for your application.  Look inside the SCAN block in net 5 - your data lands nicely already converted in ML 45 no matter how many digits. 

I did specify an ETX of CR + LF.

The first Stream[0] should have worked but it doesn't.  If line [1] doesn't catch the incoming then line [2] does.  With the Protocol block it's often a matter of trying several different things until something works.  You really have to make use of the Memory tab to help you here.

If you want a better answer on why line [0] doesn't work I'd recommend sending your program to Support.

I only had a V350 to test with.  You'll need to extract what I did into your program.  Be sure to set MI 299 to power up to 1 - you'll understand when you look at the variable on line [1].

Joe T.

 

TDCV500N-V350.vlp

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...