HI Gaurav,
I would probably use a byte-array field, but no idea if the DF1 driver supports
that:
Theoretically this would look like this:
PlcReadRequest request = plcConnection.readRequestBuilder()
.addItem("N7:1", "5:USINT[12]")
.build();
Hope that helps.
Chris
-----Ursprüngliche Nachricht-----
Von: Gaurav P <[email protected]>
Gesendet: Sonntag, 14. März 2021 03:21
An: [email protected]
Betreff: Re: DF1 protocol ...cant find documentation
Hi Chris,
Currently, for testing, I am creating a web service API that will use PLC4X to
construct a command and expects a command as hex string which can be used by
native client to send command ?
Code
PlcReadRequest request = plcConnection.readRequestBuilder()
.addItem("N7:1", "5:INTEGER")
.build();
How do I get a command which is constructed and send as hex like 10 02 08
09 06 00 02 04 03 10 03 E0 from the request builder ?
Thanks and Regards ,
Gaurav
On Tue, Mar 9, 2021 at 5:57 PM Christofer Dutz <[email protected]>
wrote:
> Hi Gaurav,
>
> Generally, what you could do, it to create a custom transport
> implementation.
>
> You could create one using the C lib and the Java Native Interface.
>
> All drivers are intentionally built in a way that the actual
> communication medium can be changed.
>
> Chris
>
>
> -----Ursprüngliche Nachricht-----
> Von: Gaurav P <[email protected]>
> Gesendet: Dienstag, 9. März 2021 11:32
> An: [email protected]
> Betreff: Re: DF1 protocol ...cant find documentation
>
> Hi All ,
>
> I used python to send raw commands to plc it worked...as I have custom
> rs232 shield and manufacturer has provided libraries in c and python
> ....its there anyway I can get df1 raw packets from plc4x ..and
> call flask API I made in python ....post testing will write a jni
> wrapper rs232 shield
>
> On Fri, Feb 26, 2021 at 6:30 PM Stephen Snow <[email protected]> wrote:
>
> > Hello,
> > I am sorry I haven't gotten to ask my customer for the SLC500
> > hardware so I couldn't test your code. I'll be at their location
> > Monday of next week and will get it then if possible. Connecting
> > directly to the frontport serial of a PLC5/25 would likely require
> > the use of a null modem cable (crossover). On a DB9 connector this
> > basically means connect 5 to 5 2 to 3 and 3 to 2 as viewed from cable's
> > perspective.
> > Since it's RS232C you are dealing with RxD and TxD and common only.
> >
> > That port should be able to ramp up transmission rate to something
> > more reasonable than 2400 Baud, unless you don't mind waiting. I'd
> > at least go for 19.2k baud, but I was pretty sure it could handle up
> > to 115.2kbaud which I believe a Rpi should be able to handle too. In
> > any case, with serial transmission correct you should see continuous
> > activiy on the indicator lights of the PLC serial port and inside
> > the PLC system status words have indication of successful connection
> > (ie physical is good, protocol is correct) from the PLC POV. I don't
> > have my PLC info in front of me at this time but it is freely
> > available from Rockwell Automations website, I think they only
> > require you create an account to be able to download their
> > information usually, especially legacy controller info.
> >
> > Good luck,
> >
> > Stephen
> > On Fri, 2021-02-26 at 17:05 +0530, Gaurav P wrote:
> > > Thanks All ....I finally got a chance to test ...created test
> > > program but I am getting this error , I have connected DF1 serial
> > > cable to RPI waveshare serial hat which has two serial error
> > > ....PLC
> > > 5 is running at baud rate of 2400 and its connected rpi on
> > > /dev/ttySC1 ....am I getting below error of some hardware issue
> > > ...how do specify baud rate and serial channel when I am creating
> > > connection ?
> > >
> > > error Error creating channel.
> > >
> > >
> > > On Tue, Feb 23, 2021 at 1:30 PM Julian Feinauer <
> > > [email protected]> wrote:
> > >
> > > > Hey,
> > > >
> > > > as far as I see your code looks good Gaurav, lets try it and
> > > > then report :
> > > > )
> > > >
> > > > Best
> > > > Julian
> > > >
> > > > Von: Gaurav P <[email protected]>
> > > > Datum: Samstag, 20. Februar 2021 um 19:14
> > > > An: [email protected] <[email protected]>
> > > > Betreff: Re: DF1 protocol ...cant find documentation Thanks
> > > > Chris ... its working ...i added both entries in maven on Monday
> > > > when I have access to the hardware (AB PLC/5 30) I will test and
> > > > report back
> > > >
> > > > But for the test case, I am was thinking
> > > >
> > > > 1. Write a value to register like N71
> > > > 2. Read from register and confirm value N71
> > > >
> > > > Kindly review the code below for testing
> > > > try (PlcConnection plcConnection = new
> > > > PlcDriverManager().getConnection("df1:serial:///ttySC1")) {
> > > >
> > > > * //I want write to register N71 , is below code ok ?*
> > > > PlcReadRequest request =
> > > > plcConnection.readRequestBuilder()
> > > > .addItem("N71", "5:INTEGER")
> > > > .build();
> > > >
> > > > PlcReadResponse response =
> > > > request.execute().get(100, TimeUnit.SECONDS);
> > > >
> > > > // Check if this connection support reading of data.
> > > > if (!plcConnection.getMetadata().canRead()) {
> > > > System.out.println("This connection doesn't
> > > > support reading.");
> > > > return "This connection doesn't support reading.";
> > > > }else {
> > > > // TODO: get the actual read bytes from the response
> > > > System.out.println(response);
> > > > System.out.println("Response code was " +
> > > > response.getResponseCode("erster"));
> > > >
> > > > System.out.println("Response I got was" +
> > > > response.getAllIntegers("N71"));
> > > > * //I want Read to register N71 , is below code ok
> > > > ?*
> > > > return
> > > > response.getAllIntegers("N71").iterator().next()+"";
> > > > }
> > > >
> > > >
> > > >
> > > >
> > > > On Sat, Feb 20, 2021 at 10:52 PM Gaurav P <[email protected]> wrote:
> > > >
> > > > > Hi Chirs ,
> > > > > Thanks I had suspected the same thing
> > > > >
> > > > > I was able to make it work via adding an apache repository
> > > > > (after I changed the maven snippet you had given from
> > > > > pluginRepositories to repositories ) and DF1 guide <
> > > >
> > https://docs.google.com/document/d/1FWmwJfXVD03MLtHVsJ0UizoA6D5KzU9J
> > G4
> > VRD-lInGI/edit#
> > > > <
> > > >
> > https://docs.google.com/document/d/1FWmwJfXVD03MLtHVsJ0UizoA6D5KzU9J
> > G4
> > VRD-lInGI/edit
> > > > > >
> > > > > (wip)
> > > > >
> > > > > <repositories>
> > > > > <repository>
> > > > > <id>apache-snapshots</id>
> > > > >
> > > > > <url>https://repository.apache.org/content/repositories/snapsh
> > > > > ot
> > > > > s
> > > > </url>
> > > > > <releases>
> > > > > <enabled>false</enabled>
> > > > > </releases>
> > > > > <snapshots>
> > > > > <enabled>true</enabled>
> > > > > </snapshots>
> > > > > </repository>
> > > > > </repositories>
> > > > >
> > > > >
> > > > > On Sat, Feb 20, 2021 at 10:07 PM Christofer Dutz <
> > > > > [email protected]> wrote:
> > > > >
> > > > > > Hi,
> > > > > >
> > > > > > the solution was quite simple:
> > > > > >
> > > > > > First off all, we don't release stuff in the Sandbox. So
> > > > > > there's no
> > > > 0.8.0
> > > > > > version.
> > > > > > Secondly our SNAPSHOTS aren't available from Maven-Central.
> > > > > > You need to add the Apache SNAPSHOT repo to your project.
> > > > > >
> > > > > > In order to do this, please add this to your pom.
> > > > > >
> > > > > > <!-- Make Snapshots of Apache projects available -->
> > > > > > <repositories>
> > > > > > <repository>
> > > > > > <id>apache-snapshots</id>
> > > > > >
> > > > > > <url>https://repository.apache.org/content/repositories/snap
> > > > > > sh
> > > > > > ots
> > > > > > </url>
> > > > > > <releases>
> > > > > > <enabled>false</enabled>
> > > > > > </releases>
> > > > > > <snapshots>
> > > > > > <enabled>true</enabled>
> > > > > > </snapshots>
> > > > > > </repository>
> > > > > > </repositories>
> > > > > >
> > > > > > <!-- Make Snapshots of Apache plugins available -->
> > > > > > <pluginRepositories>
> > > > > > <pluginRepository>
> > > > > > <id>apache-snapshots</id>
> > > > > >
> > > > > > <url>https://repository.apache.org/content/repositories/snap
> > > > > > sh
> > > > > > ots
> > > > > > </url>
> > > > > > <releases>
> > > > > > <enabled>false</enabled>
> > > > > > </releases>
> > > > > > <snapshots>
> > > > > > <enabled>true</enabled>
> > > > > > </snapshots>
> > > > > > </pluginRepository>
> > > > > > </pluginRepositories>
> > > > > >
> > > > > > That should help.
> > > > > >
> > > > > > Chris
> > > > > >
> > > > > >
> > > > > > -----Ursprüngliche Nachricht-----
> > > > > > Von: Christofer Dutz <[email protected]>
> > > > > > Gesendet: Samstag, 20. Februar 2021 10:13
> > > > > > An: [email protected]
> > > > > > Betreff: Re: DF1 protocol ...cant find documentation
> > > > > >
> > > > > > I'll have a look why this is not available.
> > > > > >
> > > > > > Holen Sie sich Outlook für Android<https://aka.ms/ghei36>
> > > > > >
> > > > > > ________________________________
> > > > > > From: Gaurav P <[email protected]>
> > > > > > Sent: Saturday, February 20, 2021 6:19:38 AM
> > > > > > To: [email protected] <[email protected]>
> > > > > > Subject: Re: DF1 protocol ...cant find documentation
> > > > > >
> > > > > > Hi Chris ,
> > > > > >
> > > > > > I also tried with 0.8 , but no luck<dependency>
> > > > > >
> > > > > > <groupId>org.apache.plc4x.sandbox</groupId>
> > > > > > <artifactId>test-java-df1-driver</artifactId>
> > > > > > <version>0.8.0</version>
> > > > > > </dependency>
> > > > > >
> > > > > >
> > > > > > On Sat, Feb 20, 2021 at 7:15 AM Gaurav P <[email protected]> wrote:
> > > > > >
> > > > > > > Hi Chris ,
> > > > > > >
> > > > > > > I am not able to maven dependency for df1 driver Cannot
> > > > > > > resolve
> > > > > > > org.apache.plc4x.sandbox:test-java-df1-driver:0.9.0-SNAPSH
> > > > > > > OT
> > > > > > >
> > > > > > > is it not hosted in maven central?
> > > > > > >
> > > > > > > On Fri, Feb 19, 2021 at 6:58 PM Christofer Dutz
> > > > > > > <[email protected]>
> > > > > > > wrote:
> > > > > > >
> > > > > > > > Hi Gaurav,
> > > > > > > >
> > > > > > > > you haven't added a dependency to the driver, but to the
> > > > > > > > protocol specificaton instead.
> > > > > > > > This is something we use internally to generate the
> > > > > > > > driver code in various languages. You need to add a
> > > > > > > > dependency to
> > > > > > > >
> > > > > > > > <dependency>
> > > > > > > > <groupId>org.apache.plc4x.sandbox</groupId>
> > > > > > > > <artifactId>test-java-df1-driver</artifactId>
> > > > > > > > <version>0.9.0-SNAPSHOT</version> </dependency>
> > > > > > > >
> > > > > > > > Chris
> > > > > > > >
> > > > > > > > -----Ursprüngliche Nachricht-----
> > > > > > > > Von: Gaurav P <[email protected]>
> > > > > > > > Gesendet: Freitag, 19. Februar 2021 14:20
> > > > > > > > An: [email protected]
> > > > > > > > Betreff: Re: DF1 protocol ...cant find documentation
> > > > > > > >
> > > > > > > > Thanks Chris , Steven
> > > > > > > >
> > > > > > > > I tried the code below but I am getting following error
> > > > > > > > *error Unable to find driver for protocol 'df1'*
> > > > > > > >
> > > > > > > > I checked in maven DF1 is added ...what can be the issue ?
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > try (PlcConnection plcConnection = new
> > > > > > > > PlcDriverManager().getConnection("df1:serial:///ttySC1")) {
> > > > > > > > PlcReadRequest request =
> > > > > > > > plcConnection.readRequestBuilder()
> > > > > > > > .addItem("ind4", "5:INTEGER")
> > > > > > > > .build();
> > > > > > > >
> > > > > > > >
> > > > > > > > <dependency>
> > > > > > > > <groupId>org.apache.plc4x</groupId>
> > > > > > > > <artifactId>plc4x-protocols-df1</artifactId>
> > > > > > > > <version>0.8.0</version> </dependency>
> > > > > > > >
> > > > > > > >
> > > > > > > > On Fri, Feb 19, 2021 at 6:20 PM Christofer Dutz <
> > > > > > > > [email protected]>
> > > > > > > > wrote:
> > > > > > > >
> > > > > > > > > Hi Gaurav,
> > > > > > > > >
> > > > > > > > > that's generally just something used during
> > > > > > > > > development ... It wasn't intended to be used as a
> > > > > > > > > standalone application.
> > > > > > > > > If you want to use it to experiment, you have to
> > > > > > > > > replace the connection string (currently
> > > > > > > > > "df1:serial:///COM4" with something for your case and
> > > > > > > > > then add/adjust the items added to the Read
> > > > > > Request.
> > > > > > > > >
> > > > > > > > > Chris
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > -----Ursprüngliche Nachricht-----
> > > > > > > > > Von: Gaurav P <[email protected]>
> > > > > > > > > Gesendet: Freitag, 19. Februar 2021 13:16
> > > > > > > > > An: [email protected]
> > > > > > > > > Betreff: Re: DF1 protocol ...cant find documentation
> > > > > > > > >
> > > > > > > > > Hi Team /Lucas ...
> > > > > > > > > Thanks for comments ...
> > > > > > > > >
> > > > > > > > > Should I use this program to test to PLC 500
> > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > https://github.com/apache/plc4x/blob/develop/sandbox/test-java-d
> > > > f1-
> > > > > > > > > dri
> > > > > > > > > ver/src/test/java/org/apache/plc4x/protocol/df1/EndToE
> > > > > > > > > ndT
> > > > > > > > > est.java
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > Also how do I specify address ?
> > > > > > > > >
> > > > > > > > > PlcReadRequest request =
> > > > > > > > > plcConnection.readRequestBuilder()
> > > > > > > > >
> > > > > > > > > .addItem("hurz", "5:INTEGER") ->>>>*is
> > > > > > > > > this address of register ???*
> > > > > > > > >
> > > > > > > > > .build();
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > On Fri, Feb 19, 2021 at 5:12 PM Gaurav P
> > > > > > > > > <[email protected]>
> > > > > > > > > wrote:
> > > > > > > > >
> > > > > > > > > > Hi Team,
> > > > > > > > > >
> > > > > > > > > > I followed the link which was shared by Lukas and
> > > > > > > > > > Chris and managed to dish out the guide with sample
> > > > > > > > > > code , which I would be testing AB PLC 500
> > > > > > > > > >
> > > > > > > > > > *
> > > > https://docs.google.com/document/d/1FWmwJfXVD03MLtHVsJ0UizoA6D5K
> > > > > > > > > > zU9
> > > > > > > > > > JG
> > > > > > > > > > 4VRD-lInGI/edit?usp=sharing <
> > > > https://docs.google.com/document/d/1FWmwJfXVD03MLtHVsJ0UizoA6D5K
> > > > > > > > > > zU9 JG 4VRD-lInGI/edit?usp=sharing> * I have some
> > > > > > > > > > questions in the above document (marked read), it
> > > > > > > > > > would be great if can get comments, a post that will
> > > > > > > > > > compile and run in RPI connect to PLC
> > > > > > > > > >
> > > > > > > > > > Thanks
> > > > > > > > > >
> > > > > > > > > > On Fri, Feb 19, 2021 at 3:25 PM Stephen Snow
> > > > > > > > > > <[email protected]>
> > > > > > > > wrote:
> > > > > > > > > >
> > > > > > > > > > > I can get this tested on both serial and ethernet/ip.
> > > > > > > > > > > I also
> > > > > > > > > > > have ther
> > > > > > > > > > > DF1 protocol manual.
> > > > > > > > > > >
> > > > > > > > > > > Stephen
> > > > > > > > > > > On Fri, 2021-02-19 at 15:22 +0530, Gaurav P wrote:
> > > > > > > > > > > > Thanks Chris ... I have access to an ancient AB
> > > > > > > > > > > > PLC
> > > > > > > > > > > > 5/260 and
> > > > > > > > > > > > will start testing and report back to you
> > > > > > > > > > > > .....transport link would be serial ...hope it
> > > > > > > > > > > > wont be any issue After I go through the docs ,
> > > > > > > > > > > > hope its not too complex , I maybe able to
> > > > > > > > > > > > maintain and test driver
> > > > > > > > > > > >
> > > > > > > > > > > > On Fri, Feb 19, 2021 at 1:07 PM Christofer Dutz
> > > > > > > > > > > > <[email protected]>
> > > > > > > > > > > > wrote:
> > > > > > > > > > > >
> > > > > > > > > > > > > Hi Gaurav,
> > > > > > > > > > > > >
> > > > > > > > > > > > > also from my side, welcome :-)
> > > > > > > > > > > > >
> > > > > > > > > > > > > I think the DF1 was one of the first tob e
> > > > > > > > > > > > > created with the new code-generation
> > > > > > > > > > > > > framework.
> > > > > > > > > > > > > However due to lack of hardware to test on,
> > > > > > > > > > > > > it's still located in the "Sandbox" and got a
> > > > > > > > > > > > > "test" prefix on it.
> > > > > > > > > > > > >
> > > > > > > > > > > > > <dependency>
> > > > > > > > > > > > >
> > > > > > > > > > > > > <groupId>org.apache.plc4x.sandbox</groupId>
> > > > > > > > > > > > > <artifactId>test-java-df1-
> > > > > > > > > > > > > driver</artifactId>
> > > > > > > > > > > > > <version>0.9.0-SNAPSHOT</version>
> > > > > > > > > > > > > </dependency>
> > > > > > > > > > > > >
> > > > > > > > > > > > > Also I think it supports all features that
> > > > > > > > > > > > > were needed by the folks that implemented it,
> > > > > > > > > > > > > but probably not much more
> > > > > > than that.
> > > > > > > > > > > > >
> > > > > > > > > > > > > So please test it. If you need it to do more
> > > > > > > > > > > > > and you've got a device you can test it with,
> > > > > > > > > > > > > we'd be happy to help you
> > > > with
> > > > > > that.
> > > > > > > > > > > > >
> > > > > > > > > > > > > Chris
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > > -----Ursprüngliche Nachricht-----
> > > > > > > > > > > > > Von: Lukas Ott <[email protected]>
> > > > > > > > > > > > > Gesendet: Freitag, 19. Februar 2021 07:33
> > > > > > > > > > > > > An: [email protected]
> > > > > > > > > > > > > Betreff: Re: DF1 protocol ...cant find
> > > > > > > > > > > > > documentation
> > > > > > > > > > > > >
> > > > > > > > > > > > > Hi Gaurav,
> > > > > > > > > > > > >
> > > > > > > > > > > > > Welcome to the list :-),
> > > > > > > > > > > > >
> > > > > > > > > > > > > Yes it really is supported. Here you ll find
> > > > > > > > > > > > > some more
> > > > > > details:
> > > > > > > > > > > > >
> > > > https://plc4x.apache.org/developers/code-gen/protocol/df1.ht
> > > > > > > > > > > > > ml
> > > > > > > > > > > > >
> > > > > > > > > > > > > The best way to get started you can find here:
> > > > > > > > > > > > >
> > https://plc4x.apache.org/users/getting-started/plc4j.html
> > > > > > > > > > > > > to understand more read here:
> > > > > > > > > > > > >
> > > > https://plc4x.apache.org/users/getting-started/general-conce
> > > > > > > > > > > > > pts
> > > > > > > > > > > > > .h
> > > > > > > > > > > > > tml
> > > > > > > > > > > > >
> > > > > > > > > > > > > For release 0.6 you ll find the java code here:
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > >
> > > > https://github.com/apache/plc4x/blob/rel/0.6/protocols/df1/src/m
> > > > > > > > > > > ain /j
> > > > > > > > > > > ava/org/apache/plc4x/protocol/df1/Df1Protocol.java
> > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > > > Example code you ll find here:
> > > > > > > > > > > > >
> > https://github.com/apache/plc4x/tree/develop/plc4j/examples
> > > > > > > > > > > > >
> > > > > > > > > > > > > Currently not sure if we ported DF1 to release
> > > > > > > > > > > > > 0.8
> > > > > > > > > > > > >
> > > > > > > > > > > > > Cheers,
> > > > > > > > > > > > > otluk
> > > > > > > > > > > > >
> > > > > > > > > > > > > Am Fr., 19. Feb. 2021 um 03:41 Uhr schrieb
> > > > > > > > > > > > > Gaurav P <
> > > > > > > > [email protected]>:
> > > > > > > > > > > > >
> > > > > > > > > > > > > > Hi Team ,
> > > > > > > > > > > > > > I am new to PLC4x , trying to integrate with
> > > > > > > > > > > > > > DF1 but cant find any documentation ....
> > > > > > > > > > > > > >
> https://plc4x.apache.org/users/protocols/df1.html
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > is it really supported? if yes where can I
> > > > > > > > > > > > > > get documentation and an example code
> > > > > > > > > > > > > > --
> > > > > > > > > > > > > > B*e * the *Ch*ange
> > > > > > > > > > > > > >
> > > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > --
> > > > > > > > > > B*e * the *Ch*ange
> > > > > > > > > >
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > --
> > > > > > > > > B*e * the *Ch*ange
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > --
> > > > > > > > B*e * the *Ch*ange
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > > B*e * the *Ch*ange
> > > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > B*e * the *Ch*ange
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > > B*e * the *Ch*ange
> > > > >
> > > >
> > > >
> > > > --
> > > > B*e * the *Ch*ange
> > > >
> > >
> > >
> >
> >
> >
>
> --
> B*e * the *Ch*ange
>
--
B*e * the *Ch*ange