oxlacey Member O Join Date Aug 2012 Location SC Posts 38 Aug 23, 2012 #1 This should be easy (I hope). I have a MOV statement with no conditional. I want to move 6 into Number (integer). However, it never happens. Number remains 0. What am I missing?!
This should be easy (I hope). I have a MOV statement with no conditional. I want to move 6 into Number (integer). However, it never happens. Number remains 0. What am I missing?!
daba Lifetime Supporting Member D Join Date Jul 2004 Location uk Posts 5,401 Aug 23, 2012 #2 Is the code in a subroutine that is not being called ?...
Lancie1 Lifetime Supporting Member Join Date Jul 2003 Location Alabama Posts 9,999 Aug 23, 2012 #3 One way:
TConnolly Lifetime Supporting Member Join Date Apr 2005 Location Salt Lake City Posts 6,152 Aug 23, 2012 #4 In addition to checking to make sure the subroutine is being called make sure that something else is not clearing the integer register.
In addition to checking to make sure the subroutine is being called make sure that something else is not clearing the integer register.
oxlacey Member OP O Join Date Aug 2012 Location SC Posts 38 Aug 23, 2012 #5 oh my gosh i feel like the village idiot. sorry for that guys, it's been a while since i've actually had to program! i forgot to call the task. OK. now that works. I want to put a variable into a tag called Rack_Contents that is a DINT with 13 elements (for 13 racks). How do I move a value of "6" into Rack_Contents for rack number 11? I can do this with 2 MOV statements; is there a way to do this with a single MOV? Last edited: Aug 23, 2012
oh my gosh i feel like the village idiot. sorry for that guys, it's been a while since i've actually had to program! i forgot to call the task. OK. now that works. I want to put a variable into a tag called Rack_Contents that is a DINT with 13 elements (for 13 racks). How do I move a value of "6" into Rack_Contents for rack number 11? I can do this with 2 MOV statements; is there a way to do this with a single MOV?
bernie_carlton Lifetime Supporting Member + Moderator Join Date Apr 2002 Location Yakima, Washington Posts 6,413 Aug 23, 2012 #6 It kind of depends on how you refer to the 'Rack Number' Is Rack_Contents[0] called "Rack 0"? If so then rack number 11 is Rack_Contents[11] and placing a "6" in it would be: MOV 6 Rack_Contents[11] But realize this method means you cant have a Rack Number 13. The last one would be rack number "12" Last edited: Aug 23, 2012
It kind of depends on how you refer to the 'Rack Number' Is Rack_Contents[0] called "Rack 0"? If so then rack number 11 is Rack_Contents[11] and placing a "6" in it would be: MOV 6 Rack_Contents[11] But realize this method means you cant have a Rack Number 13. The last one would be rack number "12"
oxlacey Member OP O Join Date Aug 2012 Location SC Posts 38 Aug 23, 2012 #7 ok, thanks for the help folks. got it running. it's been a long day!
daba Lifetime Supporting Member D Join Date Jul 2004 Location uk Posts 5,401 Aug 23, 2012 #8 oxlacey said: I want to put a variable into a tag called Rack_Contents that is a DINT with 13 elements (for 13 racks). Click to expand... bernie_carlton said: It kind of depends on how you refer to the 'Rack Number' Is Rack_Contents[0] called "Rack 0"? If so then rack number 11 is Rack_Contents[11] and placing a "6" in it would be: MOV 6 Rack_Contents[11] But realize this method means you cant have a Rack Number 13. The last one would be rack number "12" Click to expand... I make arrays one element larger when needed so for 35 racks numbered 1 to 35 I create my array as 36 elements. You get Rack[0] to Rack[35], and you don't use rack[0]. It wastes an element, yes, but it is simpler to program. Last edited: Aug 23, 2012
oxlacey said: I want to put a variable into a tag called Rack_Contents that is a DINT with 13 elements (for 13 racks). Click to expand... bernie_carlton said: It kind of depends on how you refer to the 'Rack Number' Is Rack_Contents[0] called "Rack 0"? If so then rack number 11 is Rack_Contents[11] and placing a "6" in it would be: MOV 6 Rack_Contents[11] But realize this method means you cant have a Rack Number 13. The last one would be rack number "12" Click to expand... I make arrays one element larger when needed so for 35 racks numbered 1 to 35 I create my array as 36 elements. You get Rack[0] to Rack[35], and you don't use rack[0]. It wastes an element, yes, but it is simpler to program.