Host Engineering Forum
General Category => Do-more CPUs and Do-more Designer Software => Topic started by: mhw on September 05, 2013, 12:24:39 PM
-
I am trying to take a date (11/12/2013) from a string and place it into a UDT memory address. Following is some code to test the concept. The first time through it will move the one or two digits before the / and move them into UDT, and then delete those digits and the /. The second time it turns the not found bit on in the STRFIND instruction. The third time it will work as expected. Whatup??
SG $Main.S0
STR C10
STRFIND SS0 0x2 D2 C0 C1 """/"""
RST C10
STR C0
JMP $Main.S1
RST C0
SG $Main.S1
STRSUB SS0 0 0x0 D2 SS1
STR2INT SS1 10 UDT0.Month DST511
MATH D3 "D2 + 1"
STRDELETE SS0 0 D3
STRTRIM SS0 0x3
JMP $Main.S0
NOP
-
Works fine for me.
Do you have the latest release of designer?
Have you updated the OS in the processor?
-
I think D2 must be reset back to 0 at the bottom of S1 since you are adjusting the string contents?
or at the top of S0 - that's probably better
-
I think D2 must be reset back to 0 at the bottom of S1 since you are adjusting the string contents?
That worked. Thanks
-
Did you see my edit - probably at the top of S0 instead of the bottom of S1 (i.e. you should always starting from 0 whenever you enter S0, the STRFIND stage).
Probably do a
MOVE 0 D2
in the same rung driving the STRFIND (i.e. whenever C10 is ON)
-
Sorry about that, It was stripping all but the 2013 and so I assumed it was fine...
Glad it's working for you.