Modicon M340

RBergmann

Member
Join Date
Jun 2002
Location
California
Posts
258
Programming an M340, using Unity Pro V4.1 software, I have several basic questions that I cannot seem to get answered by Schneider technical help (always defer my question and I have to wait until an "expert" can get back to me). I find their "help files" voluminous, but worthless for the most part. Perhaps someone here can help me along.

1. I'd like to use an INT as a TON preset and cannot seem to find a place for this.
2. I don't seem to be able to find a place in the TON function block to establish the timer base (i.e. .01s, .1s, 1.0s, etc.)
3. Is there a function to "latch" and "unlatch" outputs?
4. I can't wait until I get to the point where I have to scale an analog input.

... rab
 
Some help:

1. Look at the int_to_time function. Use this to convert from an int to time - the input will be time in ms. This will limit your input time range to about 32sec - might want to think about using the dint_to_time function for a larger range, depending on what you are doing. This should give you like 32 days or something.
2. The preset value defines your base. I think 1ms is the minimum. If you want seconds, multiply your preset in (1) by 1000. Or, use a constant like T#1s or T#500ms, etc.
3. You can set/reset coils. That should do it. I use Unity5 and these are right on my default ladder toolbar.
4. Well, you can always call support again ;) Or look it up in the helpfile...
 
Some help:

1. Look at the int_to_time function. Use this to convert from an int to time - the input will be time in ms. This will limit your input time range to about 32sec - might want to think about using the dint_to_time function for a larger range, depending on what you are doing. This should give you like 32 days or something.
2. The preset value defines your base. I think 1ms is the minimum. If you want seconds, multiply your preset in (1) by 1000. Or, use a constant like T#1s or T#500ms, etc.
3. You can set/reset coils. That should do it. I use Unity5 and these are right on my default ladder toolbar.
4. Well, you can always call support again ;) Or look it up in the helpfile...
Thanks, Robert ...

This methodology seem convoluted to me (and the "expert" called back and basically told me what you just explained). I work with three other PLC/HMI lines on a regular basis and this is totally different for me. Normally, I can define a Timer (tagname, address or both) and use the same address (i.e. Tagname) for all my requirements and not worry about data types. But here, I must define a minimum of three tagnames for one TON function: (1) for INT - HMI user variable, (1) for TIME (which I must convert from the INT above using the INT_TO_TIME function block)- TON PV and (1) for EBOOL - TON Output. This seems to be a lot of work. Am I approaching this incorrectly?

I program with a lot of timers configured with setpoint entered by the user. Doesn't matter though, I have two projects where I have to use Modicons and it's another weapon in my arsenal.

My Unity Pro V5 came in the mail a couple of days ago, but I haven't had time to install it (the Vijeo install was a problem (couldn't register via I-net and I tried to install it over a weekend), so I figure that I don't have time right now).

Thanks again,

... rab
 
You dont need 3 tagnames
Your INT tag is the input to the int_to_time function, the output from this goes directly into the TON function
If you want a timer to work as you want then simply build a DFB

The TON timebase uses iec standard format t#, and can be expressed in milliseconds t#5ms, seconds t#5s, minutes t#5m, hours t#5h. I was using the 5 as an example, it also accepts real input eg 0.5 minutes can be expressed as t#0.5m
 
sorry missed your other two questions
latch and unlatch use the SET and RESET functions
scaling use the SCALE function - I normally wrap this inside my own DFB and have the the following inputs RawValue, RawMax, RawMin, EUmax, EUmin with the scaling inputs setting the parameter values for the scaling function
 
Thanks, Geoff ...

I don't know what it is exactly or how to build a DFB (I glanced at the help file), but cutting down the number of tag names helps. I still think that I'll need two: an INT (from the HMI) and a BOOL (timer output). Right?

As far as the SET and RESET, I apologize for jumping the gun on this question. Of course I know this method. I'm chagrined.

Thanks for the Scaling technique. What I will need to know for (1) analog input that I will be scaling is the Data Range (I think that this is what you referred to as RawMin and RawMax) for the M340 BMX AMI0410

... rab
 
Last edited:
To really cut down on tagnames us FB (function block programming) rather than ladder. I think it makes a far more readable program. The output from one function block just goes straight to the input of the next. There is no need for intermediate tags. I use FB programming most of the time

As for the scaling of the analog input check the help file, I think it is 0 - 10000. Or you can click on the card and in the configuration tab I think you can set the type of input and range?

Read up on building a DFB it will make your project much simpler, and it's really not that hard
 
To really cut down on tagnames us FB (function block programming) rather than ladder. I think it makes a far more readable program. The output from one function block just goes straight to the input of the next. There is no need for intermediate tags. I use FB programming most of the time

As for the scaling of the analog input check the help file, I think it is 0 - 10000. Or you can click on the card and in the configuration tab I think you can set the type of input and range?

Read up on building a DFB it will make your project much simpler, and it's really not that hard
Thanks for all your help, Geoff ...

I'm under the gun on this project, so I'm trying to keep my learning curve as gentle as possible. Yes, I do use ladder as I am most familiar with it.

Are you aware of any sites where I can see real examples of code using Unity with an M340? I've searched relentlessly for this type of help. Like most programmers, I can learn best by seeing what must be done to execute a function or operation. The help files in Unity do not use real world examples but generic references (ambiguous if you're not already familiar) or give more information than would be needed for usual programming. Most PLC manuals are like this and that's why sites like this are so important.

I've been programming for about 30 years, so I can intuit a lot out of an example. However this method is a bit different from what my experience provides me (the Function Block integrated into ladder concept). Typically there is a Function (timer, counter, math, logic) that will provide everything needed. Subtly different, but different.
 
I am trying to get ready to compile the PLC code I've been working on and have tried to "Analyze" the project before building.

I continue to get an error (actually a bunch of errors) with the same message: "The instance is located on an address that isn't configured"

I have searched all the help files and tried Googling for an answer but I still don't have any idea what this means. Aside from entering the address in the Data Editor with Name, Type and Address I have no idea what else is required.

Anyone have a suggestion? Tech support won't be awake for another few hours.
 
"The instance is located on an address that isn't configured" error means, that you try use variable addresses which isn't configured on PLC memory.

Go to PLC configuration and double click PLC module on Rack view. Then change memory size for %M and %MW addresses bigger on configuration window. (I think default size is 512 for %M and 1024 for %MW.)

After you have changed these setting, close configuration window and rebuilt project.

check also Automatic start to run and initialize %MW on cold restart settings

config.jpg
 
Last edited:
New question:

I now have to compare 'Day of Week', 'Hour' and 'Minute' to execute a routine. All days of the week must be considered and for each day, the user has to configure the hour and minute.

I have found the Schedule function block (I'm writing this in ladder). Looks straight forward to me and will perform my comparison against the RTC ... except that my user input will be found in separate INTs. The system has this located in a single word (still not sure if it's an INT, TIME or DATE type.

I figure that for me to be able to use the Schedule FB, then I must convert the hours and minutes to BCD and then combine these to use as the HBEG configuration.

I've looked at all the function blocks (that make sense to me: INT_AS_*, INT_TO*, etc.) and none quite give me what I need. As I understand it, 11:59pm would be found as:

Any help is appreciated.
 
sorry missed your other two questions
latch and unlatch use the SET and RESET functions
scaling use the SCALE function - I normally wrap this inside my own DFB and have the the following inputs RawValue, RawMax, RawMin, EUmax, EUmin with the scaling inputs setting the parameter values for the scaling function
Geoff ...

I'm now to the point of scaling the analog signals into engineering units. I've looked at the SCALING FFB and from what you tell me, I should be able to develop a DFB to set the parameters. I understand your explanation for what you've done in your own projects, but I cannot see how you got there. What do you mean when you state that you "wrap this inside (your) own DFB? Do you have an example that you could post?

The SCALING FFB doesn't have the number of parameters that I would need to execute scaling. These would be Data Min, Data Max, Eng Min and Eng Max. I'm not sure what this function might be used for as it sits.

Sorry, if I seem a bit dense. I can develop a mathematical formula if necessary, but it'd be nice to use an existing function if it exists.

... rab
 
Sorry its a long weekend over here so no access to Unity for a few days, so I'll try and talk you through it (might not be 100% as I'm doing it from memory)
Create a new DFB (go to variable table and select the dfb tab) on the first empty line enter a name for your dfb. Click the + symbol to expand out. In the Inputs section create inputs
-Input type real
-RawMin type Real
-RawMax type Real
-EUMin type Real
-EUMax type Real
In the outputs section create an output
-Output type Real
Then there is a section called Sections (I think)
create a new section called main and double click on it
You should then be able to select your type of program, I would pick FB but its ok to use LAD
Now a program window should open
Insert a scaling function block
note that one of the inputs to this function block is called Para, click on this input and enter 'para' this will prompt you to create a new variable of the required type click ok. This variable is a special type that contains all the parameters for the scaling block (look at the help for the scaling function for a full description of all the components)
Now just move the input values for the function into the appropriate para components (eg Move RawMin to para.(something I can't remember) and then connect the Input variable to the scaling input and the Output to the scaling Output
Save and analyse the function and now your function is ready to use in your program
 
Thanks, Geoff ...

I'll get to this in the morning. It's 12:38 am Saturday morning and I'll be working on this all weekend. Monday's the dog and pony show for this project and I'd like to have as much to show as I can.

... rab
 

Similar Topics

Hey all, I am having an issue concerning the Modicon System Responsible for the operation of our Generator System. (Particularly Dresser-Rand...
Replies
5
Views
2,583
Hello, I'm having a hard time understanding how to get a Modicon M340 to pull a Modbus address from an ABB Totalflow via Ethernet. I set up a port...
Replies
5
Views
1,169
Hello. New to Unity and had a couple quick questions. Can a Modicon M340 output to a small multiline LCD screen and not a full HMI?
Replies
4
Views
969
Hi, I'm configuring the M340 controller with ATV320 inverters via Canopen. Everything was fine until today, when after starting the electrical...
Replies
1
Views
1,347
I've got an M340 hitting an Ethernet to Serial converter one read at a time. Each read is enabled through a one-shot r_trig. I've got some extra...
Replies
2
Views
1,611
Back
Top Bottom