Here is why I ask.
In my application, I have to provide a way for my user to set the values in a table interactively. The table contains up to 125 rows. Each row represents a "channel." Each channel contains five elements representing characteristics of the channel. Information about the channels will be sent over the USB to hardware in 25-channel chunks called "messages." So channels 0-24 would be sent, followed by channels 25-49, then 50-74, then 75-99, and 100-124.
The C-language type definitions and variable declarations are shown below.
Code: Select all
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char** argv)
{
// -----------------------------------------------------------------------------
// Constants
// -----------------------------------------------------------------------------
#define QTY_CHANNELS_PER_MSG 25
#define QTY_PGA_CASES 8
#define TOTAL_QTY_CHANNELS 125
// -----------------------------------------------------------------------------
// Types
// -----------------------------------------------------------------------------
typedef unsigned short UInt16; // 0.. (2**16 - 1); [0 .. 65,535]
typedef struct Ch_Data // One record of channel data.
{
UInt16 PGA;
UInt16 Offset;
UInt16 DAMR;
UInt16 Excite_Voltage;
UInt16 ADC_Ref;
} t_Ch_Data; // "t_" = type
typedef struct s_S02_Msg // One record of message data.
{
UInt16 HW_Msg_Header;
UInt16 Starting_Channel_Number;
t_Ch_Data C [QTY_CHANNELS_PER_MSG];
UInt16 Spare_01;
UInt16 Spare_02;
} t_S02_Msg; // "t_" = type
// -----------------------------------------------------------------------------
// Variables
// -----------------------------------------------------------------------------
t_Ch_Data Ch [TOTAL_QTY_CHANNELS]; // Ch contains ALL records of channel
// data.
t_S02_Msg S02_Msg; // One structure of records to send to
// the hardware.
UInt16 i = 0;
UInt16 j = 0;
// -----------------------------------------------------------------------------
// Begin
// -----------------------------------------------------------------------------
// ...
* The PGA values can only be the following choices: [ 0, 10, 20, 50, 100, 200, 500, 1000].
* The Offset, DAMR, and Excite Voltage values can only be real numbers in the range [0.0 .. 4.99]. I scale them into the range [0x00..0xFF] using the equation
y = (UInt16) (13107 * x);
where
x is the number specified by the user ([0.0 .. 4.99]), and
y is the internal scaled value ([0x00..0xFF]).
* And ADC_Ref is always set to 0xFF. Since the identifier is constant, I just set it internally. The user won't know it's there.
Keeping in mind that there are a total of up to 125 sets of channel data to enter, what are my options to have the user enter the data manually? I'm thinking in terms of entering more than one channel dataset at a time. Maybe a scrolling screen containing combo lists and numeric lists? Can that be done? Is that the "best" way?
Thanks in advance for your comments.