= DLCRepeatMultiIncludeCellWts = Enable or disable inclusion of individual cell weight information in repeat multi event when used with DLC {{{ int DLCRepeatMultiIncludeCellWts(int dlcCard, bool enable); }}} == Parameters == * dlcCard - card number of DLC card * enable - true to set app to receive cell weights, false for no cell weights == Return Value == * Returns the result - OK success == Remarks == == Examples == {{{ extern struct mnbd_dlc_cmd_struct g_dlc_cmd; extern struct mnbd_dlc_response_struct g_dlc_response; struct dlc_card_struct { int numScales; int numCellsPerScale[10]; }; dlc_card_struct dlc_card[10]; int numCells = 0; void GetCellInfo(int dlcNum) { int i; int cell; uint8 cellScale; int numScales; dlc_card[dlcNum].numScales = 0; for(i = 0; i < 10; i++) { dlc_card[dlcNum].numCellsPerScale[i] = 0; } // Get the number of cells from the mainboard memset(&g_dlc_cmd, 0, sizeof(g_dlc_cmd)); memset(&g_dlc_response, 0, sizeof(g_dlc_response)); g_dlc_cmd.cmd_code = DLC_GET_SCALE_INFO; if(MnBdRequest(dlcNum + 1, MNBD_REQ_DLC_GET_SCALE_INFO, WAIT_ACK) == OK) { numCells = g_dlc_response.cmd_response[0]; numScales = g_dlc_response.cmd_response[1]; dlc_card[dlcNum].numScales = 0; for(cell = 0; cell < numCells; cell++) { memset(&g_dlc_cmd, 0, sizeof(g_dlc_cmd)); memset(&g_dlc_response, 0, sizeof(g_dlc_response)); g_dlc_cmd.cmd_code = DLC_GET_CELL_SCALE; g_dlc_cmd.cmd_param[0] = cell; if(MnBdRequest(dlcNum + 1, MNBD_REQ_DLC_GET_SCALE_INFO, WAIT_ACK) == OK) { cellScale = g_dlc_response.cmd_response[1]; if(cellScale > 0 && cellScale < 11) { dlc_card[dlcNum].numCellsPerScale[cellScale - 1]++; if(cellScale > dlc_card[dlcNum].numScales) { dlc_card[dlcNum].numScales = cellScale; } } } } for(i = 0; i < dlc_card[dlcNum].numScales; i++) { printf("scale %d has %d cells\r\n", i + 1, dlc_card[dlcNum].numCellsPerScale[i]); } } } void IndStartup(void) { MnBdStartup(); SetBackgroundEvent(BackgroundEventComm); GetCellInfo(0); AllocateRepeatMultiCellWtMemory(GetNumScales()); if(DLCRepeatMultiIncludeCellWts(1, true) != OK) { DEBUG_MSG("Error set multi repeat cell wts\r\n"); } MnBdSetEvent(MNBD_REQ_REP_MULTI, MnBdEventMultiRcv); if(StartRepeatMulti(100) == OK) DisplayText(0, 0, "Wt and I/O 10 times per second"); } void IndShutdown(void) { MnBdClearEnent(MNBD_REQ_REP_MULTI); StopRepeatMulti(); DLCRepeatMultiIncludeCellWts(1, false) DeallocateRepeatMultiCellWtMemory(); } MNBD_EVENT(MultiRcv) { if(repeat_multi_record == 0) // Scale weights and I/O status { // Do typical processing for scale weights } else if(repeat_multi_record > 0x30 && repeat_multi_record < 0x34) // Cells weights for scale { int scaleIndex = repeat_multi_record - 0x31; DEBUG_MSG("Cell wts for scale %d - ", scaleIndex + 1); int cell; for(cell = 0; cell < dlc_card[0].numCellsPerScale[scaleIndex]; cell++) { DEBUG_MSG(" %6.0f", REPEAT_MULTI_CELL_WT(scaleIndex, cell)); } DEBUG_MSG("\r\n"); } return 0; } BACKGROUND_EVENT(Comm) { int n; for (n = 0; n <= GetNumScales(); n++) { MnBdRead(n); } }}} The above example will output cell weights such as: {{{ Cell wts for scale 1 - 0 0 0 0 Cell wts for scale 2 - -0 0 0 0 Cell wts for scale 3 - 7302 9932 4074 5342 321 141 Cell wts for scale 1 - 0 -0 0 0 Cell wts for scale 2 - 0 0 0 0 Cell wts for scale 3 - 7302 9932 4074 5342 321 141 }}} == See Also == * [wiki:StartRepeatMulti StartRepeatMulti]