Although I have received some advice and code snippets, I think that I should present a broader view of what I am trying to do and the trouble I am having. I have built a test fixture that has an internal microcontroller which directs traffic in and out of the T.F. In order to test a unit (P.C. or module) a file is created to hold data that is to be sent to the T.F. Another file is created to hold expected answers that will be returned from the T.F. What I want to do is load two arrays with these two files and later be able to extract the data, byte by byte during the testing process. The two files are to contain hex data, 00 through ff, (0 through 255 decimal equivalent). The micrcontroller will analyze the bit structure of the data bytes sent to it and direct the unit under test to return a byte representing the condition being tested. My problem is that I can't get the hex bytes into an array without them being distorted by something beyond my understanding of what is going on. Whenever a byte that is larger than 80 (hex), what is extracted from the array is a byte with a value equal to 253.
My form has three buttons which are labeled: "Load Data File", "Load Answer File", and "Start Test" I need to have the two files to be found on the hard drive and then loaded into the appropriate array. Then when the "Start Test" button is clicked, start retrieving the bytes for processing.
Once I can get over this hump, I believe I can handle the rest of the program. Something more than just a code snippet would be greatly appreciated.
Novice3
NOVICE3
0
Newbie Poster
Recommended Answers
Jump to PostIs the data in your file actual binary data, or is it hex strings?
I've attached a small shell program that will let you browse for 2 files and convert the contents of the files to a byte array. It assumes the data in the file is binary format …
Jump to PostTry this one. I used 7-Zip to zip it, but normally you shouldn't have trouble with it.
All 8 Replies
mcriscolo
47
Posting Whiz in Training
NOVICE3
0
Newbie Poster
mcriscolo
47
Posting Whiz in Training
NOVICE3
0
Newbie Poster
mcriscolo
47
Posting Whiz in Training
NOVICE3
0
Newbie Poster
mcriscolo
47
Posting Whiz in Training
NOVICE3
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.