Copying 40 bytes using a pointer siemens s7

rpop91

Member
Join Date
Mar 2012
Location
Detroit, Mi
Posts
44
Hey all,

Having a little trouble figuring out a clean way to do this. What I'm trying to do is copy a serial number that is read from an RFID tag into a database.

Process:
part comes into station
read RFID tag into DB1
copy 40 bytes of DB1 into another DB2
Shift 40 bytes and copy same data again when a new part enters

I am having difficulty with the pointer for DB2. The data from DB is coming from the same address each time but i need to copy it to a shifted address. Would STL be the easiest method for accomplishing this?

Thanks
 
Is this example processing correct?

Part arrives
Copy 40 bytes from DB1.DBB0 to DB2.DBB0
Part arrives
Copy 40 bytes form DB1.DBB0 to DB2.DBB40
Part arrives
Copy 40 bytes form DB1.DBB0 to DB2.DBB80
etc
until DB2 is full and start back at DBB0?
 
Is this example processing correct?

Part arrives
Copy 40 bytes from DB1.DBB0 to DB2.DBB0
Part arrives
Copy 40 bytes form DB1.DBB0 to DB2.DBB40
Part arrives
Copy 40 bytes form DB1.DBB0 to DB2.DBB80
etc
until DB2 is full and start back at DBB0?

Yes, precisely. I'm currently playing with an SCL function to do this but if you have something simpler that would be great.
 
Example SCL implementation added:

This is excellent.

The only change I need to make is not based on a max record number. Basically I just need to keep shifting data until I get a bit high that tells me to send the data to my oracle system( i already have this written) and clear DB2.

This is the way I currently have it written. It's not very clean.

Code:
VAR_INPUT
    
    iLayerIndex : INT; //Current Layer index of module
    iTrigger : BOOL; //Trigger to copy data over
    
END_VAR

   
BEGIN

IF itrigger = true THEN
    
    CASE iLayerIndex OF 
        
        1 : CopyBytesToBytes(SrcStart := DB822.DB558,ByteCnt := 20,DstStart := db1200.db0); 
        2 : CopyBytesToBytes(SrcStart := DB822.DB558,ByteCnt := 20,DstStart := db1200.db21);
        3 : CopyBytesToBytes(SrcStart := DB822.DB558,ByteCnt := 20,DstStart := db1200.db41);
        4 : CopyBytesToBytes(SrcStart := DB822.DB558,ByteCnt := 20,DstStart := db1200.db61);
        5 : CopyBytesToBytes(SrcStart := DB822.DB558,ByteCnt := 20,DstStart := db1200.db81);
        6 : CopyBytesToBytes(SrcStart := DB822.DB558,ByteCnt := 20,DstStart := db1200.db101);
        7 : CopyBytesToBytes(SrcStart := DB822.DB558,ByteCnt := 20,DstStart := db1200.db121);
        8 : CopyBytesToBytes(SrcStart := DB822.DB558,ByteCnt := 20,DstStart := db1200.db141);
        9 : CopyBytesToBytes(SrcStart := DB822.DB558,ByteCnt := 20,DstStart := db1200.db161);
        10 : CopyBytesToBytes(SrcStart := DB822.DB558,ByteCnt := 20,DstStart := db1200.db181);
                
    END_CASE;
ELSE; 
END_IF;

I only have 10 layers there but my max will be 45. What I am doing is stacking parts on top of each other, the stack size varies, so I need to keep traceability of that data until i remove the stacked part and begin stacking another part.
 

Similar Topics

I'm not super familiar with the Micrologix line of processors, but I am pretty familiar with RSLogix 500. I'm trying to simply copy a string to...
Replies
4
Views
303
Hi All, I am looking to copy and paste a routine. I know this has to be done offline. My question is, when I go back online, these tags are...
Replies
6
Views
553
Hello everyone, friends. I need help with something related to SCL. In a FB, I need to copy the value in the DB to the DB at another address. I...
Replies
3
Views
1,385
Hello all! Is it possible to COP a SINT array to a UDT structured the same as a SINT array, except all BOOL bits? I have a module that has an...
Replies
5
Views
3,171
Hello, looking for a way to capture and display the accumulated time for a retentive timer in rslogix 500 on a microligix 1400 plc example move...
Replies
3
Views
1,649
Back
Top Bottom