help on pointer

harrydeharry

Member
Join Date
May 2008
Location
Delhi
Posts
237
I just want to set db2.dbx0.0 when q100.0 is on, just trying to learn pointer.
Please help what i m doing wrong.
thank for help.....
L 2
T #temp_o // int
OPN DB [#temp_o]
L 0
SLD 3
T #re //word
L DBB [#re]
LAR2
L QB 1000
LAR1
A [AR1,P#0.0]
= dbx[AR2,P#0.0]
 
Here's the basics:

Code:
      L     2
      T     #temp_o
      OPN   DB [#temp_o]
      LAR2  P#DBX 0.0
      LAR1  P#Q 100.0
      A      [AR1,P#0.0]
      =      [AR2,P#0.0]
 
hi...I m just learning the pointer I write the below line, the bit of dbb0 is turing on each blink of M1000.0,
I just want know is it write method or it can b written in a easy way, second thing using the #re (temp int) is correct here of should I use and MD.
Thanks in advance.

LAR1 P#M 1000.0
L 2
T #temp_o
OPN DB [#temp_o]
L #re
L 8
==D
JCN ll
L 0
T #re
ll: L P#DBX 0.0
L #re
+D
LAR2
A [AR1,P#0.6]
= [AR2,P#0.0]

A [AR1,P#0.6]
FN #pp
JCN out
L #re
L 1
+D
T #re
out: AN [AR1,P#0.6]
JCN lo
L 0
T DBB 0
lo: NOP 0
 
Where you are using this confusion of code?
On FB or FC ?
What should do exactly the variable "#re (temp int)"?
 
He is using #re to count to 8 to turn on each bit of dbb0

temp variables should not be used to remember data between calls in FC/FB

re is a temp, what about pp?

Use an FB and use the stat area instead.
 
pp is also a temp its a fc
but so far it is working well may be because its only one fc in simulator...
thanks..............:unsure::unsure:
 
pp is also a temp its a fc
but so far it is working well may be because its only one fc in simulator...
thanks..............:unsure::unsure:
You need to use an FB if you want to store data on stat variable!
Temp variable on FC at the next scan have not a signed value , or you can use a marker bool , word , dword directly etc...

This is an example of what you wanted to write:
Code:
                 L     2
                 T     #temp_o
                 OPN   DB [#temp_o]
                 LAR2  P#DBX 0.0
                 LAR1  P#M 1000.0
                 L     8
      Next:      T     #re
                 A      [AR1,P#0.0]
                 =      [AR2,P#0.0]
                 +AR1  P#0.1
                 +AR2  P#0.1
                 L     #re
                 LOOP  Next
 
Last edited:
thanks for the help. I each time when m1000.0 blink the bits of dbb0 should blink one by one
M1000.0 DB2.dbb0
1 00000001
0 00000000
1 00000010
0 00000000
1 00000100
like this...
 

Similar Topics

i write code STL and simulate but result Q2.7 not set , i dont know why :scratch: , help me plz thanks LAR1 P#Q2.7 S [AR1,P#0.0] or LAR P#2.7...
Replies
3
Views
1,710
Hi Folks, I'm having problems completing a FB and suspect my pointer programming maybe the issue. The purpose of the FB is to transfer a...
Replies
13
Views
10,643
Hi all, I have the following FC: FC100 INPUT TRACK_NR := dint FUNCTIE_NR := dint BITJE := bool INPUT/OUTPUT FUNCTIE_WOORDEN :=...
Replies
5
Views
2,056
Hi I am looking into code to set a block of 8 booleans within a datablock, depending on the condition of 8 'flags'. The start bit of the 8 bools...
Replies
13
Views
3,587
Hello I am a rather newly hatched PLC programmer who just ran into a problem. Hopefully someone out there can give me a hint on how to move on...
Replies
5
Views
6,859
Back
Top Bottom