custom board for smart serial interface?

More
24 Nov 2018 04:33 #121284 by nghung270192
Replied by nghung270192 on topic custom board for smart serial interface?
Hello everyone

Please help me? where is wrong. this function is not run. I want to use DAC only. Thanks.

void smart_serial_create_parameter() {
heap_ptr = memory.heap;
uint16_t input_bits = 8; // this starts at 8 bits = 1 byte for the fault byte
uint16_t output_bits = 0;

// these are temp toc arrays that the macros will write pointers into. the tocs get copied to main memory after everything else is written in
uint16_t ptoc[32];
uint16_t gtoc[32];

uint16_t *ptocp = ptoc;
uint16_t *gtocp = gtoc;
process_data_descriptor_t *last_pd;

ADD_PROCESS_VAR(
("dac_1", "V", 32, DATA_TYPE_FLOAT, DATA_DIRECTION_OUTPUT, -INFINITY, INFINITY));
metadata(&(pd_table.dac_1), last_pd);

ADD_GLOBAL_VAR(
("scale", "none", 32, DATA_TYPE_FLOAT, DATA_DIRECTION_OUTPUT, -INFINITY, INFINITY));

ADD_MODE(("Position mode", 0, 1));

// automatically create padding pds based on the mod remainder of input/output bits
if (input_bits % 8)
ADD_PROCESS_VAR(
("padding", "", 8 - (input_bits % 8), DATA_TYPE_PAD, DATA_DIRECTION_INPUT, 0, 0));
if (output_bits % 8)
ADD_PROCESS_VAR(
("padding", "", 8 - (output_bits % 8), DATA_TYPE_PAD, DATA_DIRECTION_OUTPUT, 0, 0));

// now that all the toc entries have been added, write out the tocs to memory and set up the toc pointers

//calculate bytes from bits
memory.discovery.input = input_bits >> 3;
memory.discovery.output = output_bits >> 3;

........ continue

Please Log in or Create an account to join the conversation.

Moderators: PCWjmelson
Time to create page: 0.050 seconds
Powered by Kunena Forum