Newbies BevP Posted June 9, 2004 Newbies Posted June 9, 2004 I need to create a text string that will be used as a command to a serial I/O device. Content includes such things as: a command code e.g. Hex 60; a calculated length field,with the 8 least significant bits stored in one byte and the next 8 significant bits stored in another; and a byte that contains the cumulative XOR of all the preceding bytes. I figured out how to do the XOR thanks to a forum entry here, but when I try to build my text string, the numbers are converted to ASCII, e.g. the hex 60 (decimal 96) displays as two bytes with a value of 9 and 6, instead of one byte. Since the length must be calculated each time, I cannot use constants in the bytes. How do I get the right values in the bytes?
The Shadow Posted June 9, 2004 Posted June 9, 2004 FileMaker doesn't have a way to convert a number directly into its ascii code, you would need to make your own version of this. One easy way I've done something similar is to have a global field (charCode) with 256 repetitions. Then use GetRepetition( charCode, 96 ) to give you the proper character for 96.
Newbies BevP Posted June 11, 2004 Author Newbies Posted June 11, 2004 Any suggestion for entering values into this array? I set it up as a table of its own instead of a repeating field, since it was easier to enter the data if I knew from the related numeric key which field I was entering. I have tried entering field values with the Alt key plus numeric key pad. All worked fine except the null (00), tab (09), line feed (0D), new record (0A). I also tried generating a tab-delimited file from a program that does allow bitwise manipulation of bytes. This worked fine except for some of the same characters, which of course were interpreted as delimiters and other non-data by the FM import function. I am going to need every value since they will be used to indicate calculated lengths, which may well be 9, 10, 12 or 13.
The Shadow Posted June 11, 2004 Posted June 11, 2004 Option-tab (maybe ctrl-tab on windows??) lets you enter a real tab into a field, otherwise you can cut/paste it from another app. I think 0D/0A is going to be a problem, Pro is probably going to try to translate these to what your system uses when you output them, and translate to an internal form on input. Similarly for 00, I doubt there is a way to enter this value directly.
Recommended Posts
This topic is 7539 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now