Hi!
I have a problem.
Something is going on in the process of converting letters to numbers, and I do not get the answers I want. I do not get a good answer when I use the StringToFloat & () function or the StringToInt $ () function. However, if you put "123.4" in the position of String, the value is good. I do not know if there is something wrong with variable assignment or kind. Can anyone tell me what's wrong with the program?
The protocol is repeated as follows.
CD,73,US,NT,+0006.98kg
I put the program together.
Thank you.
StringToFloat$(), StringToInt$() Ploblem Help me!!
Moderator: Benj
-
- Posts: 164
- Joined: Fri Jan 13, 2012 4:21 am
- Location: South KOREA
- Has thanked: 18 times
- Been thanked: 16 times
- Contact:
StringToFloat$(), StringToInt$() Ploblem Help me!!
- Attachments
-
- AD4325_1_3.fcfx
- (26.48 KiB) Downloaded 146 times
- Steve
- Matrix Staff
- Posts: 3418
- Joined: Tue Jan 03, 2006 3:59 pm
- Has thanked: 114 times
- Been thanked: 422 times
- Contact:
Re: StringToFloat$(), StringToInt$() Ploblem Help me!!
In your code, you are using constants to determine the position of the numbers within your data and I don't think these are set to the correct values.
For example, you have the following:
Which, if the constant values and sample data are substituted, becomes:
This would mean Weight_Str1 = "6." and Weight_Str2 becomes "k".
For example, you have the following:
Code: Select all
Weight_Str1 = Mid$ (Buffer1,Data_Start_Point,Data_Start_Length)
Weight_Str2 = Mid$ (Buffer1,Data_End_Point,Data_End_Length)
Weight_uINT1 = StringToInt$ (Weight_Str1)
Weight_uINT2 = StringToInt$ (Weight_Str2)
Code: Select all
Weight_Str1 = Mid$ ("CD,73,US,NT,+0006.98kg",16,2)
Weight_Str2 = Mid$ ("CD,73,US,NT,+0006.98kg",19,1)
Weight_uINT1 = StringToInt$ (Weight_Str1)
Weight_uINT2 = StringToInt$ (Weight_Str2)