Re: [Beremiz-devel] Beremiz-devel Digest, Vol 88, Issue 2

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: [Beremiz-devel] Beremiz-devel Digest, Vol 88, Issue 2

Beremiz-Devel mailing list

Yes, This is the same as in C.

But the variable in Beremiz with referenced from Canfestival (etc.) - is link on the variable, not the variable itself!

I have:

1) read retain variable of OD

2) write to OD

3) run Beremiz

4) lose value variable!



20.03.2018 17:11, [hidden email] пишет:
Send Beremiz-devel mailing list submissions to
	[hidden email]

To subscribe or unsubscribe via the World Wide Web, visit
	https://lists.sourceforge.net/lists/listinfo/beremiz-devel
or, via email, send a message with subject or body 'help' to
	[hidden email]

You can reach the person managing the list at
	[hidden email]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Beremiz-devel digest..."


Today's Topics:

   1. Generating the code for initialization variables
      ([hidden email])
   2. Re: Generating the code for initialization variables
      ([hidden email])


----------------------------------------------------------------------

Message: 1
Date: Tue, 20 Mar 2018 11:49:48 +0500
From: [hidden email]
To: [hidden email]
Subject: [Beremiz-devel] Generating the code for initialization
	variables
Message-ID:
	[hidden email]
Content-Type: text/plain; charset="utf-8"; Format="flowed"

Hi, All!

Generating the code for initialization variables

I have a problem:
There is a global variable that is referenced to a variable from the 
Canfestival. For example %IV0.0.8192.1. Field init value - empty.
But in the code I see the following:

IEC.code :
/CONFIGURATION config //
//? VAR_GLOBAL //
//??? CONF : UINT := 1; //
/

/DO4 AT %QW0.0.25344.4 : UINT; //
//??? DO5 AT %QW0.0.25344.5 : UINT := 0; //
//? END_VAR //
/

In config.c file:

 ? void config_init__(void) {
 ? BOOL retain;
 ? retain = 0;
 ? __INIT_GLOBAL(UINT,CONF,__INITIAL_VALUE(1),retain)


 ? __INIT_GLOBAL_LOCATED(CONFIG,DO4,__QW0_0_25344_4,retain)
 ? __INIT_GLOBAL(UINT,DO4,__INITIAL_VALUE(0),retain)? - WHY init 0?

 ? __INIT_GLOBAL_LOCATED(CONFIG,DO5,__QW0_0_25344_5,retain)
 ? __INIT_GLOBAL(UINT,DO5,__INITIAL_VALUE(0),retain


Why (correctly?) with an empty field "Init value" initialize a variable?

Thank!

Best regards,

Aleksandr Safronov!

-------------- next part --------------
An HTML attachment was scrubbed...

------------------------------

Message: 2
Date: Tue, 20 Mar 2018 10:18:08 +0300
From: [hidden email]
To: [hidden email]
Subject: Re: [Beremiz-devel] Generating the code for initialization
	variables
Message-ID:
	[hidden email]
Content-Type: text/plain; charset="utf-8"

On 18-03-20 11:49, [hidden email] wrote:
Hi, All!

Generating the code for initialization variables

I have a problem:
There is a global variable that is referenced to a variable from the
Canfestival. For example %IV0.0.8192.1. Field init value - empty.
But in the code I see the following:

IEC.code :
/CONFIGURATION config //
//? VAR_GLOBAL //
//??? CONF : UINT := 1; //
/

/DO4 AT %QW0.0.25344.4 : UINT; //
//??? DO5 AT %QW0.0.25344.5 : UINT := 0; //
//? END_VAR //
/

In config.c file:

? void config_init__(void) {
? BOOL retain;
? retain = 0;
? __INIT_GLOBAL(UINT,CONF,__INITIAL_VALUE(1),retain)


? __INIT_GLOBAL_LOCATED(CONFIG,DO4,__QW0_0_25344_4,retain)
? __INIT_GLOBAL(UINT,DO4,__INITIAL_VALUE(0),retain)? - WHY init 0?

? __INIT_GLOBAL_LOCATED(CONFIG,DO5,__QW0_0_25344_5,retain)
? __INIT_GLOBAL(UINT,DO5,__INITIAL_VALUE(0),retain


Why (correctly?) with an empty field "Init value" initialize a variable?

Thank!

Best regards,

Aleksandr Safronov!
Hi Aleksandr,

if "init value" is empty, then according to the standard IEC 61131-3 variable
should be initialized to default value for variables of this type.
What other would you expect for global variables?
This is the same as in C. ;-)




------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Beremiz-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beremiz-devel
Reply | Threaded
Open this post in threaded view
|

Re: [Beremiz-devel] Beremiz-devel Digest, Vol 88, Issue 2

Beremiz-Devel mailing list
Hi Alexandr,

On 18-03-21 14:28, [hidden email] wrote:
> Yes, This is the same as in C.
>
> But the variable in Beremiz with referenced from Canfestival (etc.) - is
> link on the variable, not the variable itself!
>

> I have:
>
> 1) read retain variable of OD

> 2) write to OD
>
> 3) run Beremiz
>
> 4) lose value variable!


I've not used CanOpen Beremiz extension yet.
So I can't say whether it's bug in CanOpen extension or not.
As I understand your problem. Value of variable in OD is cleared by
Beremiz on start.
So your IEC variable is *output* variable and always overwrites
previous value in OD.
You are probably need *input/output* variable.
Have you tried memory IEC address (*%M*)?
I don't know whether CanOpen extension does handle different types of
addresses differently.

If you don't need to change OD variable externaly then maybe retain
flag in Beremiz will help you.



> 20.03.2018 17:11, [hidden email] пишет:
> > Send Beremiz-devel mailing list submissions to
> > [hidden email]
> >
> > To subscribe or unsubscribe via the World Wide Web, visit
> > https://lists.sourceforge.net/lists/listinfo/beremiz-devel
> > or, via email, send a message with subject or body 'help' to
> > [hidden email]
> >
> > You can reach the person managing the list at
> > [hidden email]
> >
> > When replying, please edit your Subject line so it is more specific
> > than "Re: Contents of Beremiz-devel digest..."
> >
> >
> > Today's Topics:
> >
> >     1. Generating the code for initialization variables
> >        ([hidden email])
> >     2. Re: Generating the code for initialization variables
> >        ([hidden email])
> >
I'd recommend you to change of subscription type from Digest to
normal. Beremiz-devel is low volume ML, so it shouldn't be a problem.
Digest is good for reading, but bad for writing to ML, because
it breaks threads and puts a lot of unrelated text into outgoing mail.


> > ----------------------------------------------------------------------
> >
> > Message: 1
> > Date: Tue, 20 Mar 2018 11:49:48 +0500
> > From:[hidden email]
> > To:<[hidden email]>
> > Subject: [Beremiz-devel] Generating the code for initialization
> > variables
> > Message-ID:
> > <[hidden email]>
> > Content-Type: text/plain; charset="utf-8"; Format="flowed"
> >
> > Hi, All!
> >
> > Generating the code for initialization variables
> >
> > I have a problem:
> > There is a global variable that is referenced to a variable from the
> > Canfestival. For example %IV0.0.8192.1. Field init value - empty.
> > But in the code I see the following:
> >
> > IEC.code :
> > /CONFIGURATION config //
> > //? VAR_GLOBAL //
> > //??? CONF : UINT := 1; //
> > /
> >
> > /DO4 AT %QW0.0.25344.4 : UINT; //
> > //??? DO5 AT %QW0.0.25344.5 : UINT := 0; //
> > //? END_VAR //
> > /
> >
> > In config.c file:
> >
> >   ? void config_init__(void) {
> >   ? BOOL retain;
> >   ? retain = 0;
> >   ? __INIT_GLOBAL(UINT,CONF,__INITIAL_VALUE(1),retain)
> >
> >
> >   ? __INIT_GLOBAL_LOCATED(CONFIG,DO4,__QW0_0_25344_4,retain)
> >   ? __INIT_GLOBAL(UINT,DO4,__INITIAL_VALUE(0),retain)? - WHY init 0?
> >
> >   ? __INIT_GLOBAL_LOCATED(CONFIG,DO5,__QW0_0_25344_5,retain)
> >   ? __INIT_GLOBAL(UINT,DO5,__INITIAL_VALUE(0),retain
> >
> >
> > Why (correctly?) with an empty field "Init value" initialize a variable?
> >
> > Thank!
> >
> > Best regards,
> >
> > Aleksandr Safronov!
> >
> > -------------- next part --------------
> > An HTML attachment was scrubbed...
> >
> > ------------------------------
> >
> > Message: 2
> > Date: Tue, 20 Mar 2018 10:18:08 +0300
> > From:[hidden email]
> > To:[hidden email]
> > Subject: Re: [Beremiz-devel] Generating the code for initialization
> > variables
> > Message-ID:
> > <[hidden email]>
> > Content-Type: text/plain; charset="utf-8"
> >
> > On 18-03-20 11:49,[hidden email]  wrote:
> > > Hi, All!
> > >
> > > Generating the code for initialization variables
> > >
> > > I have a problem:
> > > There is a global variable that is referenced to a variable from the
> > > Canfestival. For example %IV0.0.8192.1. Field init value - empty.
> > > But in the code I see the following:
> > >
> > > IEC.code :
> > > /CONFIGURATION config //
> > > //? VAR_GLOBAL //
> > > //??? CONF : UINT := 1; //
> > > /
> > >
> > > /DO4 AT %QW0.0.25344.4 : UINT; //
> > > //??? DO5 AT %QW0.0.25344.5 : UINT := 0; //
> > > //? END_VAR //
> > > /
> > >
> > > In config.c file:
> > >
> > > ? void config_init__(void) {
> > > ? BOOL retain;
> > > ? retain = 0;
> > > ? __INIT_GLOBAL(UINT,CONF,__INITIAL_VALUE(1),retain)
> > >
> > >
> > > ? __INIT_GLOBAL_LOCATED(CONFIG,DO4,__QW0_0_25344_4,retain)
> > > ? __INIT_GLOBAL(UINT,DO4,__INITIAL_VALUE(0),retain)? - WHY init 0?
> > >
> > > ? __INIT_GLOBAL_LOCATED(CONFIG,DO5,__QW0_0_25344_5,retain)
> > > ? __INIT_GLOBAL(UINT,DO5,__INITIAL_VALUE(0),retain
> > >
> > >
> > > Why (correctly?) with an empty field "Init value" initialize a variable?
> > >
> > > Thank!
> > >
> > > Best regards,
> > >
> > > Aleksandr Safronov!
> > Hi Aleksandr,
> >
> > if "init value" is empty, then according to the standard IEC 61131-3 variable
> > should be initialized to default value for variables of this type.
> > What other would you expect for global variables?
> > This is the same as in C. ;-)
> >
> >
>

> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot

> _______________________________________________
> Beremiz-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/beremiz-devel


--
Best regards,
Andrey Skvortsov

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Beremiz-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beremiz-devel

signature.asc (849 bytes) Download Attachment