Quick STL question.

rpop91

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

Having some trouble this morning figuring out some STL. My STL is very weak and I know a lot of you on here are very good with it.

I'm having a hard time figuring out what's going on here and what's being loaded into AR1.

What I'm trying to due is stack torque and angle results. Up until now I only required 3 characters for my angel data. But a new customer is asking to report 4. When I changed some things over, My data isn't stacking properly. If someone could help me understand this STL it would be greatly appreciated. The first bit of code is where I'm really confused.

Thanks!!

Code:
 OPN   #iDataDB


      L     #sTorque_Number_Pointer
      L     L#8                         // Length Of Result Data
      *I    
      L     L#110                       // Pointer for stacking torque data
      +I    
      L     L#8
      *I    
      L     #tAddr_Start
      +I    
      LAR1  


      L     #sAngle_LeftOfDec_ASCII[3]
      T     DBB [AR1,P#0.0]

      L     #sAngle_LeftOfDec_ASCII[4]
      T     DBB [AR1,P#1.0]

      L     #sAngle_LeftOfDec_ASCII[5]
      T     DBB [AR1,P#2.0]

      L     #sAngle_LeftOfDec_ASCII[6]
      T     DBB [AR1,P#3.0]

      L     #sTorque_LeftOfDec_ASCII[5]
      T     DBB [AR1,P#4.0]

      L     #sTorque_LeftOfDec_ASCII[6]
      T     DBB [AR1,P#5.0]

      L     '.'
      T     DBB [AR1,P#6.0]

      L     #sTorque_RightOfDec_ASCII[1]
      T     DBB [AR1,P#7.0]

      L     #sTorque_RightOfDec_ASCII[2]
      T     DBB [AR1,P#8.0]




      L     #sTorque_Number_Pointer
      L     L#8
      *I    
      L     #tAddr_Start
      +I    
      LAR1
 
Hey again everyone,

Having some trouble this morning figuring out some STL. My STL is very weak and I know a lot of you on here are very good with it.

I'm having a hard time figuring out what's going on here and what's being loaded into AR1.

What I'm trying to due is stack torque and angle results. Up until now I only required 3 characters for my angel data. But a new customer is asking to report 4. When I changed some things over, My data isn't stacking properly. If someone could help me understand this STL it would be greatly appreciated. The first bit of code is where I'm really confused.

Thanks!!

Code:
 OPN   #iDataDB


      L     #sTorque_Number_Pointer
      L     L#8                         // Length Of Result Data
      *I    
      L     L#110                       // Pointer for stacking torque data
      +I    
      L     L#8
      *I    
      L     #tAddr_Start
      +I    
      LAR1  


      L     #sAngle_LeftOfDec_ASCII[3]
      T     DBB [AR1,P#0.0]

      L     #sAngle_LeftOfDec_ASCII[4]
      T     DBB [AR1,P#1.0]

      L     #sAngle_LeftOfDec_ASCII[5]
      T     DBB [AR1,P#2.0]

      L     #sAngle_LeftOfDec_ASCII[6]
      T     DBB [AR1,P#3.0]

      L     #sTorque_LeftOfDec_ASCII[5]
      T     DBB [AR1,P#4.0]

      L     #sTorque_LeftOfDec_ASCII[6]
      T     DBB [AR1,P#5.0]

      L     '.'
      T     DBB [AR1,P#6.0]

      L     #sTorque_RightOfDec_ASCII[1]
      T     DBB [AR1,P#7.0]

      L     #sTorque_RightOfDec_ASCII[2]
      T     DBB [AR1,P#8.0]




      L     #sTorque_Number_Pointer
      L     L#8
      *I    
      L     #tAddr_Start
      +I    
      LAR1

Firstly, your data record is calculated with 8 bytes size, and you use offsets from 0 to 8, also 9 bytes.

A quick analysis of the first bit of code:

L #sTorque_Number_Pointer // You have obviously more than one data string with the torque value, this points to the actual one.
L L#8 // Length Of Result Data. One bit short according to the code coming after.
*I // Multiply to find start address.
L L#110 // Pointer for stacking torque data. This is pointing to the address of the first torque string data.
+I // Add to find the byte no of the actual string. Use +D instead.
L L#8 // Mul 8 = shifting 3 bits left, makes a pointer of the start byte address. (This pointer consists of byte.bit)
*I
L #tAddr_Start // Another base address for your data.
+I // The +I here could be a trap if the start byte address exceedes 65536/8 (8192), use +D instead.
LAR1


Kalle
 
Thanks so much for the help.

I'm still having trouble. I changed the first length to match the code that came after. (The L#8 to L#9)

Unfortunately it's still not stacking correctly. I can't figure out why it's not working. Everything in the code looks like it should work.
 
sTorque_Number_Pointer
#tAddr_Start
There is problem in initialising above two addresses.
If you just want to copy few bytes then you can use SFC 20.
 
Firstly, your data record is calculated with 8 bytes size, and you use offsets from 0 to 8, also 9 bytes.

A quick analysis of the first bit of code:

L #sTorque_Number_Pointer // You have obviously more than one data string with the torque value, this points to the actual one.
L L#8 // Length Of Result Data. One bit short according to the code coming after.
*I // Multiply to find start address.
L L#110 // Pointer for stacking torque data. This is pointing to the address of the first torque string data.
+I // Add to find the byte no of the actual string. Use +D instead.
L L#8 // Mul 8 = shifting 3 bits left, makes a pointer of the start byte address. (This pointer consists of byte.bit)
*I
L #tAddr_Start // Another base address for your data.
+I // The +I here could be a trap if the start byte address exceedes 65536/8 (8192), use +D instead.
LAR1


Kalle

If my data string was 9 bytes instead of 8, which I already started to change in that bit of code I posted. What else would I have to change?
 
Can you run the code continiously? If you select Options/Customize/STL and mark the whole lot, you'll see what is happening in the accus and address registers when you are online.


And if you change those L ...ASCII[x] with known letters, f.x. L 'a', L 'b' a.s.o., it is easier to see where the stacking goes wrong.

And if you are still stuck, post an online snapshot.

Kalle
 
Can you run the code continiously? If you select Options/Customize/STL and mark the whole lot, you'll see what is happening in the accus and address registers when you are online.


And if you change those L ...ASCII[x] with known letters, f.x. L 'a', L 'b' a.s.o., it is easier to see where the stacking goes wrong.

And if you are still stuck, post an online snapshot.

Kalle

That is a huge help. Thank you so much!!
 

Similar Topics

Hi all, Just wondered if someone could confirm whether these 2 networks equate to the same code or not. I'm converting from STL to LAD and want...
Replies
0
Views
1,407
Hi all, I'm trying to convert some S5 STL to S7 LAD and I just need to know if I'm interpreting the following STL correctly: Original STL L...
Replies
2
Views
3,529
Hi, I'm looking through some software and there's quite a few networks that end with // before the coil such as... AN "A...
Replies
4
Views
1,749
My minds gone blank and I need a quick question answering. I'm looking at some S5 code offline and haven't got a PLC to test this so thought I'd...
Replies
2
Views
3,831
I'm trying to import a .prj file and I keep getting the error message: Project import error. i Any ideas how to get around this? Thanks.
Replies
0
Views
78
Back
Top Bottom