Help - Search - Members - Calendar
Full Version: How do I either reset ST locations or fill with zeros ?
Forums.MrPLC.com > PLCs and Supporting Devices > Allen Bradley
mckeand13
I have information from a barcode scanned into my ST file location. It is first dumped into ST12:0 and then extracted to different locations up to ST12:15.


Upon reset (input from a switch), I would like to either erase the info from those locations or fill them all with zeros.



I am doing this with N locations in the same program by using FLL #N7:20 with a length of 10. That fills N7:20-N7:29 with zeros.



When I tried this with the ST file I got an error. I was using:

FLL

Source 0

Dest #ST12:0

Length 10



I got errors of:

Operand sizes do not match

Invalid Constand value-valid range = 1-3

Exceeded limit of 128 total words



Anybody have any ideas on what I need to change to get this to work, or any other ways of eliminating the data present or filling with zeros in the ST locations?

Thanks.

Alaric
A sting will be effectively cleared when its lenght is 0.

MOV 0 ST10:0.LEN.

The FLL instruction and the CLR instruciton will return errors.
mckeand13
Thanks for the info.

Are there any easy ways to do that to multiple locations in one command?

I have to clear ST12:0 - ST12:15.

Alaric
QUOTE(mckeand13 @ Feb 26 2007, 01:31 PM) [snapback]50459[/snapback]

Are there any easy ways to do that to multiple locations in one command?


Unfortunately, no.

QUOTE

I have to clear ST12:0 - ST12:15.


If it were me, I would create the following in a subroutine, and then conditonally call the subroutine (with a one shot) when you need to clear all 16 strings.

This uses a FOR N7:50 = 0 to 15 loop and indirect addressing.

CLR N7:50
LBL 1 MOV 0 ST10:[N7:50].LEN
ADD 1 N7:50 N7:50
LEQ N7:50 15 JMP 1
brucechase
[attachmentid=4260]
QUOTE(Alaric @ Feb 26 2007, 12:19 PM) [snapback]50457[/snapback]
A sting will be effectively cleared when its lenght is 0.

MOV 0 ST10:0.LEN.

The FLL instruction and the CLR instruciton will return errors.


The FLL works for me. Never had a problem, but still have to do one string at a time.

mckeand13
QUOTE(Alaric @ Feb 26 2007, 03:42 PM) [snapback]50465[/snapback]

If it were me, I would create the following in a subroutine, and then conditonally call the subroutine (with a one shot) when you need to clear all 16 strings.

This uses a FOR N7:50 = 0 to 15 loop and indirect addressing.

CLR N7:50
LBL 1 MOV 0 ST10:[N7:50].LEN
ADD 1 N7:50 N7:50
LEQ N7:50 15 JMP 1


This looked like a great way of accomplishing what I'm trying to do.

I put the code in a subroutine but when I verified the file I got an error. It was "Element level indirection is not supported". If I take the [N7:50] out of the code and just leave that line as LBL 1 MOV 0 ST12.0.LEN it's happy.

I'm using a ML1100. Is that sort of command not available for that processor?

Thanks.
Alaric
QUOTE(mckeand13 @ Mar 1 2007, 10:34 AM) [snapback]50716[/snapback]


I'm using a ML1100. Is that sort of command not available for that processor?


Unfortunately, the only ML that supports indirect addressing is the ML1500. Looks like you have no choice but to do them one at a time. Its not all that bad, its only 16 rungs. Create a subroutine and put 16 rungs in it to move 0 to the Len of each of the strings. You can copy/paste and then quickly edit the rungs for each element.
Alaric
QUOTE(brucechase @ Feb 27 2007, 11:58 AM) [snapback]50557[/snapback]


... but still have to do one string at a time.



Which is what I think the OP was trying to avoid doing. FLL doesn't work across multiple string elements.

Unfortunately, with the ML1100 he is using, it looks like he will still have to do them one at a time. But there is no need to expend processor time filling each character in the string with zeros. Just setting the .LEN to zero is sufficient.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.