505 SFPGM Question

garrettj

Member
Join Date
Jul 2007
Location
Perth
Posts
7
Was looking through some old PLC code I was given 10 years ago to find out how to change the action of a loop in Tisoft.

The SFPGM code uses some syntax that I cant find in the reference manual - can anyone help

The code is

IMATH LCFH1 := LCFH1 ^ K94 (where K94 is a binary word with bit 8 on 0000 0000 0000 1000 0000)

that makes the loop go direct acting (turns that bit OFF)

the other piece says

IMATH LCFH1 := LCFH1 | K94

which turns that bit ON

I know it works - I tested it - but I just want to make certain of the syntax and of possible find the manual that it comes from.

Thanks

Jason
 
LCFH is the Loop C Flags High Word, so you are manipulating the 8 bit of loop 1's high word. The 8th bit sets the loop to reverse or direct acting.
loop_cf.png


The "^ "indicates a WORD XOR, this shorthand entry is only supported in processors with power math. In the older platforms it would have been entered as WXOR.

The "|" indicates a WORD OR, also shorthand, in the older platforms you would have to use WOR.

timath.png

tiword.png



So in the first statement, since the bit is on, and the eighth bit of K94 is also on, the XOR returns a zero, and the bit goes to zero.
In the second statement, since K94's eighth bit is true, the loop bit is set to one.
 
Last edited:
Thanks Ken

I found that table OK in the 505 reference manual bu t the bit where it showed the caret and pipe wasnyt in there

All clear now

Cheers

Jason
 
Jason

The table is in the Programming Reference manual, Table 7-5 "IMATH Operators", page 7-42.

I think the first piece of code may cause the mode to toggle, eg:
if mode bit is 1: 1 XOR 1 = 0
(changes from Reverse to Direct acting)
if mode bit is 0: 0 XOR 1 = 1
(changes from Direct to Reverse acting)

The second piece of code should put the loop in Reverse Acting mode.
If you want to put the loop in Direct Acting mode you could try: IMATH LCFH1 := LCFH1 &(NOT K94)
- "&" is the Bit-by-bit AND of two integers
 
Cheers for that Phil

I had worked out what was going on using the XOR function - but nowhere could I find reference to the fact that ^ and | were used in SFPGM code.

Table 7.5 in my TI505 reference doesnt have those characters. It does have WOR and WXOR but not those 2 characters as shortcuts.

I used TICON to convert the program and wondered if somehow the syntax had become corrupted.

But its all clear now.

Thanks

Jason
 

Similar Topics

I've never looked at a Siemens TI505 series plc program until now. On a rung is a function call block for a SFPGM. I found in the Programming...
Replies
3
Views
3,045
When using a 1 second cyclic SFPGM is it necessary to use the following ladder logic? C500 C500...
Replies
1
Views
1,534
Hello all. I have a few SLCs in my plant and of late we've seen a weird issue: The system will be running normally and then randomly the outputs...
Replies
2
Views
93
Hi. I have 2 files where I would like to see the ladder logic differences (similar to the Rockwell compare function). I am using TISoft Siemens...
Replies
1
Views
1,263
Hello. I'm using bootp to set an ip address for a 1747L551 processor. The bootp program immediately sees the mac id and I am able to enter an...
Replies
5
Views
1,178
Back
Top Bottom