Forum - MCS Electronics
View previous topic :: View next topic
Author
Message
bufere Joined: 05 Dec 2005 Posts: 14 Location: UDINE
Posted: Sat Apr 13, 2013 7:48 pm Post subject: Long var extract the single digit, help
Hy All,
I have one long var, for example 12345 , I need to extract in five Byte var the single value of every digit.
See here:
12345 (long type)
1 to var1 (byte)
2 to var2 "
3 to var3 "
4 to var4 "
5 to var5 "
the varX variable as byte
The MID(x,x,x) command work only for text (xram or string variable not for long, I need convert the long type)
I wait your tips.
Thanks
Bufere
Back to top
Frankeman Joined: 11 Aug 2004 Posts: 948 Location: the Netherlands
Posted: Sat Apr 13, 2013 9:30 pm Post subject:
Convert the long variable with the STR function to a string
Back to top
nikolai Joined: 16 Apr 2013 Posts: 7
Posted: Tue Apr 16, 2013 10:34 am Post subject:
You can calculate also:
x1 = X/10000
x=x mod 1000
x2=x/1000
x=x mod 1000
...
x5 = x
best regards
nikolai
Back to top
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum