Question qbout temps

userxyz

Member
Join Date
May 2002
Location
any
Posts
2,768
Hey

Hi,

I programmed some things in an FC. But I used 3 bits that had to be remembered, so I made a struct of 8 bits in the temp area. It is called MemoryByte.

So I wrote this in the first network:

LAR1 P##MemoryByte
L #MEMORY
T LW [AR1,P#0.0]

and this in the last:

LAR1 P##MemoryByte
L LW [AR1,P#0.0]
T #MEMORY

MEMORY is an IN_OUT, on the outside of the block I connected MB75. See images.

The bits are not remembered, How come ?




outtt.JPG


inttt.JPG
 
TEMPs are only valid during the current cycle. If you need to remember data then you either have to use Marker Bits (Bytes) or else create your program in an FB and store your data in STATs which as the name implies are static - i.e. available in future cycles, because they are held in the Instance DB.
 
Hey

I know that I can use FB with an instance DB, but I don't want it for simple tasks where I only need 3 bits to be remembered.

So the idea is making one byte of memory on the outside of the FC. Therefor MB75, these bits are red in the FC in network 1 and are written to MB75 in the last network.

read write principal,

should work .., but it doesn't
 
If its only 3 bits why don't you assign them as IN_OUT's?

EDIT:

The other common error is of course if you made MEMORY an IN parameter, this would not work!
 
Last edited:
just noticed you are transferring a byte to LW, the bits you are trying to remember are in the low byte!!

LW0 = LB0 and LB1, your memory will be in LB1, the assigned bits are in LB0
 
Hey

indeed,

I made it to LB and it was gooooood,

I was monitorring on it, then have seen that MB75 remained zero. And wrote this:

begin of FC

L MEMORY
T LB2


end of FC

L LB2
T MEMORY

And nodest the LW..

second time I made this error
 

Similar Topics

Hello again..trying something on an existing poorly written program and just wanted to double check something system is an A-B MicroLogix 1200 In...
Replies
5
Views
176
Good morning! Let me start by saying, I am still learning about this type of HMI programming. I recently watched a video about recipes and how it...
Replies
0
Views
75
I have some logic that I have written within a 5380 series controller that tracks the time an event is started, while the event is running an RTO...
Replies
2
Views
96
I have an HMI 2711R - T4T Series B, and I want to know which PLCs, besides Micro 820, can communicate with it.
Replies
2
Views
100
HI i would like to know how to get a variable that will store the amount of times a program has been executed. The issue is I have 3 DBs for 1 FB...
Replies
2
Views
83
Back
Top Bottom