Outputting during subroutine - Automation Direct

jspx

Member
Join Date
Dec 2006
Location
California
Posts
6
Hi All,
I wonder if someone can help me out here - I have a main output subroutine, which I will be calling whenever I have to write to the output ports. The outputs drive an externa; logic board - the lower 4 bits are the data and the upper 4 bits are the address of the external latch that needs the data and there is also a strobe line. So what I do is write out the data to the 8 bits and toggle the strobe low then high, then exit the subroutine. The problem occurs when I have a list of values to output - the first one gets loaded into the accumulator and then the subroutine is called. The output lines change, although not immediately - I guess the output happens at the end of the current scan. Anyway, then the next value gets loaded and the subroutine is called again and so on. What's happening is the timing seems to be screwed up - the outputs don't seem to change in an orderly fashion at all - in fact it just all seems to happen at once or something like that.
I called tech support for the plc and they told me to use the Output Immediate instruction but my cpu doesn't support it.

I've tried inserting a timer in the subroutine, just after the write to output but it doesn't help much.
Has anyone else had a similar problem and fixed it?
I'm using an Automation Direct DL205 system with a DL240 cpu.
Many thanks for any advice you can offer.
Jeremy
 
Last edited:
Greetings Jeremy,

and welcome to the forum ... before we can give you any really detailed help, you need to tell us what make and model PLC you're using ... many of them are quite different in operation ...
 
Hi again,
Well I guess I've figured out for myself what's happening - in the subroutine I mentioned that I write out the data to the ouput port and then toggle a strobe line - well, given that outputs only happen at the end of a scan, when i'm toggling the line I'm using as a strobe it's not happening because no outputs get written during the subroutine itself, What I'm now going to do is make the strobe toggling happen externally to the plc using a 555 timer. From now on I'll just write the data in the subroutine and wait a few millisecinds for the external stribe to do its thing and then return to the main rouine.
I'll post again once I've done it and let you know how it went.
Jeremy
 
I am not sure why you think the 240 does not support immediate I/O but it does. Look under contacts or coils in Directsoft and you will find the (I) instructions, that is the immediate instructions that update regardless of the CPU scan. Immediate outputs update the image register, immediate inputs do not. Hope this helps.
 
A question to ask yourself - at what rate do I need to send out thins information to be effective in real time. Now 'real time' doesn't always mean "as soon as possible". It can mean "when the scan gets around to it".

Would it be ok to change the address/data lines on one scan, set the strobe on the next, turn off the strobe on the next, then continue on? That would give the 'scan time' as the delay between data/address true and strobe, and between strobe ON to strobe OFF. If you really feel you have stricter time constraints please post them and we may be able to help you.
 
Hi again,
The manual indicates that Immediate output is not available on the dl240. I'll give it a try now - many thanks!!
 
Hi Bernie,
I could try that - toggle the strobe on successive scans - I'm new to this but I should be able to handle that. I'll ry a few things today and post my results - and many thanks for your help!
Happy New Year, all!
 
OK - I've established that immediate output is NOT available in the dl-240 ! Seti and rsti are the only instructions that will change the state of output lines immediately. What does NOT work on the dl240 is the instruction I really need - OUTI ! I have to set/clear several bits simultaneously in the outputs. I guess I could shift the required output bits through the acc, and then use seti or rsti but that seems clunky and slow and wouldn't occur simultaneously.
So I'm back to either doing the outputting, strobe up and strobe down on successive scans or doing the strobing externally.
More soon...........
 
Here's a possible example of the Data/Stobe On/Strobe Off sequence

PLC 240

// Rung 1
// Address 0
#BEGIN COMMENT
"Assuming the prepared output information is in V2000 then send it to outputs Y0-Y7. "
"Reset the control bits used in the next stages. Then JMP to the next stage."
#END
SG S0

// Rung 2
// Address 2
LD V2000
OUTF Y0 K8
RST C0 C7
JMP S1

// Rung 3
// Address 8
#BEGIN COMMENT
"This structure ensures that, on the first pass, only C0 is set. On the second time through "
"the output strobe is set. If one scan isn't enough setup time then use a timer to delay "
"further."
#END
SG S1

// Rung 4
// Address 10
STR C0
SET Y20
JMP S2

// Rung 5
// Address 13
STR SP1
SET C0

// Rung 6
// Address 15
#BEGIN COMMENT
"Like the previous stage this ensures that the strobe stays on for one pass. If that isn't "
"enough then use a timer."
#END
SG S2

// Rung 7
// Address 17
STR C1
RST Y20
JMP S23

// Rung 8
// Address 20
STR SP1
SET C1

// Rung 9
// Address 22
#BEGIN COMMENT
"The sending (Data Setup, Strobe On, Strobe Off) has been completed"
#END
SG S3

// Rung 10
// Address 24
END

// Rung 11
// Address 25
NOP


#BEGIN ELEMENT_DOC
"Y20","Strobe Line","",""
"C0","Set Strobe","",""
"C1","Reset Strobe","",""
"S0","Prepare Output","",""
"S1","Delay Set Strobe","",""
"S2","Delay Rst Strobe","",""
"S3","Done Send","",""
"V2000","Prepared Info","",""
"VY0","Output Word","",""

#END
 
For the cost of time spent, you could probably upgrade to a 250 CPU that does support immediate instructions and come out way ahead.
 
Opps my mistake on the OUTI but the OROUTI, SETI and RSTI will do what you want.
 
Many thanks, Bernie!
The only questio left is whether I can put these stages into a subroutine. Being new to these plcs I've been a bit mytified as to how the scanning works when a subroutine is run. Does the subroutine get handled in a single scan or in successive scans?
Many thanks again. JM
 
You can't put stages into a subroutine. A subroutine would only do one step.

Assuming that you are using Stage programming (and I really encourage this) make the stage numbers some group away from your regular program. Trigger (by SETting) the first one and let them do the timing.

But stages aren't absolutely necessary, it's just a convenient way to put sequential actions together. You are just enforcing the timing of Data Output - time - Strobe On - time - Strobe Off sequence.
 

Similar Topics

Some background: We have two assembly machines in house that make a part that gets crimped by deforming the top of a cylinder. We use a LVDT...
Replies
20
Views
3,943
Hi All, I have a lifting/hoist application that I am using a powerflex 755 1hp drive. I am using a 1/3hp SEW gear motor that is rated at 0.57A...
Replies
3
Views
4,985
Greetings Gentlemen, I must admit I haven't worked much with analog output modules outside of controlling a VFD (and that was not in Omron) so...
Replies
5
Views
2,542
Hope someone has experience with this. We've recently upgraded a system at a remote site. This is a AB SLC 5/05 processor with two 10-slot...
Replies
20
Views
7,910
[RSLogix 500] [Micrologix 1000] Here is an odd problem I've come across. An output that turns a hydraulic solenoid on (which in turn makes a...
Replies
6
Views
2,160
Back
Top Bottom