/**************************************************************************** * * MPS routines for the Toroid BCM * * * * michael cecere 09/2006 * ****************************************************************************/ #include "system.h" extern float pC_Adj[]; extern SYS_Config_Struct SYS_Config; extern int Force_MPSLevel; extern int Force_MPSChan; float OC_THRESHOLD = 1200.0; // PicoColoumbs int MPS_Fault; int prt3=1, Previous_Location=0, Previous_ID_Number=0; /**************************************************************************** * * Init_MPS_Parameters * * to be called once to initialize MPS parameter * such as which chans are comparators etc. * * ****************************************************************************/ void Init_MPS_Parameters() { int location; // Set MPS configuration //////////////////////////////////////////////////////////////////////////// location = 0; // LKG21-1405 IM01,IM02,IM03,IMS1 // overcharge limit for each individual channel, in pC SYS_Config.MPS_OC_Threshold[location][0] = OC_THRESHOLD; // IM01 SYS_Config.MPS_OC_Threshold[location][1] = OC_THRESHOLD; // IM02 SYS_Config.MPS_OC_Threshold[location][2] = OC_THRESHOLD; // IM03 SYS_Config.MPS_OC_Threshold[location][3] = OC_THRESHOLD; // IMS1 // comp channel 1 SYS_Config.MPS_Comp_ON[location][0] = 1; // IM03/IM02 SYS_Config.MPS_Comp_Chan[location][0][0] = 1; // IM02 SYS_Config.MPS_Comp_Chan[location][0][1] = 2; // IM03 SYS_Config.MPS_Comp_Threshold[location][0][0] = 0.1; // 10% SYS_Config.MPS_Comp_Threshold[location][0][1] = 0.5; // 50% // comp channel 2 SYS_Config.MPS_Comp_ON[location][1] = 1; // IMS1/IM02 SYS_Config.MPS_Comp_Chan[location][1][0] = 1; // IM02 SYS_Config.MPS_Comp_Chan[location][1][1] = 3; // IMS1 SYS_Config.MPS_Comp_Threshold[location][1][0] = 0.1; // 10% SYS_Config.MPS_Comp_Threshold[location][1][1] = 0.5; // 50% // comp channel 3 SYS_Config.MPS_Comp_ON[location][2] = 0; // not used SYS_Config.MPS_Comp_Chan[location][2][0] = 0; // denominator SYS_Config.MPS_Comp_Chan[location][2][1] = 0; // numerator SYS_Config.MPS_Comp_Threshold[location][2][0] = 0.1; // 10% SYS_Config.MPS_Comp_Threshold[location][2][1] = 0.5; // 50% // comp channel 4 SYS_Config.MPS_Comp_ON[location][3] = 0; // not used SYS_Config.MPS_Comp_Chan[location][3][0] = 0; // denominator SYS_Config.MPS_Comp_Chan[location][3][1] = 0; // numerator SYS_Config.MPS_Comp_Threshold[location][3][0] = 0.1; // 10% SYS_Config.MPS_Comp_Threshold[location][3][1] = 0.5; // 50% //////////////////////////////////////////////////////////////////////////// location = 1; // LKG21-1407 IMBC1I,IMBC1O,FC01,FCG1 // overcharge limit for each individual channel, in pC SYS_Config.MPS_OC_Threshold[location][0] = OC_THRESHOLD; // IMBC1I SYS_Config.MPS_OC_Threshold[location][1] = OC_THRESHOLD; // IMBC1O SYS_Config.MPS_OC_Threshold[location][2] = OC_THRESHOLD; // FC01 SYS_Config.MPS_OC_Threshold[location][3] = OC_THRESHOLD; // FCG1 // comp channel 1 SYS_Config.MPS_Comp_ON[location][0] = 1; // IMBC1O/IMBC1I SYS_Config.MPS_Comp_Chan[location][0][0] = 0; // IMBC1I SYS_Config.MPS_Comp_Chan[location][0][1] = 1; // IMBC1O SYS_Config.MPS_Comp_Threshold[location][0][0] = 0.1; // 10% SYS_Config.MPS_Comp_Threshold[location][0][1] = 0.5; // 50% // comp channel 2 SYS_Config.MPS_Comp_ON[location][1] = 0; // not used SYS_Config.MPS_Comp_Chan[location][1][0] = 0; // denominator SYS_Config.MPS_Comp_Chan[location][1][1] = 0; // numerator SYS_Config.MPS_Comp_Threshold[location][1][0] = 0.1; // 10% SYS_Config.MPS_Comp_Threshold[location][1][1] = 0.5; // 50% // comp channel 3 SYS_Config.MPS_Comp_ON[location][2] = 0; // not used SYS_Config.MPS_Comp_Chan[location][2][0] = 0; // denominator SYS_Config.MPS_Comp_Chan[location][2][1] = 0; // numerator SYS_Config.MPS_Comp_Threshold[location][2][0] = 0.1; // 10% SYS_Config.MPS_Comp_Threshold[location][2][1] = 0.5; // 50% // comp channel 4 SYS_Config.MPS_Comp_ON[location][3] = 0; // not used SYS_Config.MPS_Comp_Chan[location][3][0] = 0; // denominator SYS_Config.MPS_Comp_Chan[location][3][1] = 0; // numerator SYS_Config.MPS_Comp_Threshold[location][3][0] = 0.1; // 10% SYS_Config.MPS_Comp_Threshold[location][3][1] = 0.5; // 50% //////////////////////////////////////////////////////////////////////////// location = 2; // LKG24-1306 IMBC2I,IMBC2O // overcharge limit for each individual channel, in pC SYS_Config.MPS_OC_Threshold[location][0] = OC_THRESHOLD; // IMBC2I SYS_Config.MPS_OC_Threshold[location][1] = OC_THRESHOLD; // IMBC2O SYS_Config.MPS_OC_Threshold[location][2] = OC_THRESHOLD; // SYS_Config.MPS_OC_Threshold[location][3] = OC_THRESHOLD; // // comp channel 1 SYS_Config.MPS_Comp_ON[location][0] = 1; // IMBC2O/IMBC2I SYS_Config.MPS_Comp_Chan[location][0][0] = 0; // IMBC2I SYS_Config.MPS_Comp_Chan[location][0][1] = 1; // IMBC2O SYS_Config.MPS_Comp_Threshold[location][0][0] = 0.1; // 10% SYS_Config.MPS_Comp_Threshold[location][0][1] = 0.5; // 50% // comp channel 2 SYS_Config.MPS_Comp_ON[location][1] = 0; // not used SYS_Config.MPS_Comp_Chan[location][1][0] = 0; // denominator SYS_Config.MPS_Comp_Chan[location][1][1] = 0; // numerator SYS_Config.MPS_Comp_Threshold[location][1][0] = 0.1; // 10% SYS_Config.MPS_Comp_Threshold[location][1][1] = 0.5; // 50% // comp channel 3 SYS_Config.MPS_Comp_ON[location][2] = 0; // not used SYS_Config.MPS_Comp_Chan[location][2][0] = 0; // denominator SYS_Config.MPS_Comp_Chan[location][2][1] = 0; // numerator SYS_Config.MPS_Comp_Threshold[location][2][0] = 0.1; // 10% SYS_Config.MPS_Comp_Threshold[location][2][1] = 0.5; // 50% // comp channel 4 SYS_Config.MPS_Comp_ON[location][3] = 0; // not used SYS_Config.MPS_Comp_Chan[location][3][0] = 0; // denominator SYS_Config.MPS_Comp_Chan[location][3][1] = 0; // numerator SYS_Config.MPS_Comp_Threshold[location][3][0] = 0.1; // 10% SYS_Config.MPS_Comp_Threshold[location][3][1] = 0.5; // 50% //////////////////////////////////////////////////////////////////////////// location = 3; // B911-2206 IM31,IM36 // overcharge limit for each individual channel, in pC SYS_Config.MPS_OC_Threshold[location][0] = OC_THRESHOLD; // IM31 SYS_Config.MPS_OC_Threshold[location][1] = OC_THRESHOLD; // IMB36 SYS_Config.MPS_OC_Threshold[location][2] = OC_THRESHOLD; // SYS_Config.MPS_OC_Threshold[location][3] = OC_THRESHOLD; // // comp channel 1 SYS_Config.MPS_Comp_ON[location][0] = 1; // IM36/IM31 SYS_Config.MPS_Comp_Chan[location][0][0] = 0; // IM31 SYS_Config.MPS_Comp_Chan[location][0][1] = 1; // IMB36 SYS_Config.MPS_Comp_Threshold[location][0][0] = 0.2; // 20% (changed to 20% because of noise DGB) SYS_Config.MPS_Comp_Threshold[location][0][1] = 0.5; // 50% // comp channel 2 SYS_Config.MPS_Comp_ON[location][1] = 0; // not used SYS_Config.MPS_Comp_Chan[location][1][0] = 0; // denominator SYS_Config.MPS_Comp_Chan[location][1][1] = 2; // numerator SYS_Config.MPS_Comp_Threshold[location][1][0] = 0.1; // 10% SYS_Config.MPS_Comp_Threshold[location][1][1] = 0.5; // 50% // comp channel 3 SYS_Config.MPS_Comp_ON[location][2] = 0; // not used SYS_Config.MPS_Comp_Chan[location][2][0] = 0; // denominator SYS_Config.MPS_Comp_Chan[location][2][1] = 0; // numerator SYS_Config.MPS_Comp_Threshold[location][2][0] = 0.1; // 10% SYS_Config.MPS_Comp_Threshold[location][2][1] = 0.5; // 50% // comp channel 4 SYS_Config.MPS_Comp_ON[location][3] = 0; // not used SYS_Config.MPS_Comp_Chan[location][3][0] = 0; // denominator SYS_Config.MPS_Comp_Chan[location][3][1] = 0; // numerator SYS_Config.MPS_Comp_Threshold[location][3][0] = 0.1; // 10% SYS_Config.MPS_Comp_Threshold[location][3][1] = 0.5; // 50% //////////////////////////////////////////////////////////////////////////// location = 4; // B921-2306 IMUNDI,IMUNDO,IMDUMP // overcharge limit for each individual channel, in pC SYS_Config.MPS_OC_Threshold[location][0] = OC_THRESHOLD; // IMUNDI SYS_Config.MPS_OC_Threshold[location][1] = OC_THRESHOLD; // IMUNDO SYS_Config.MPS_OC_Threshold[location][2] = OC_THRESHOLD; // IMDUMP SYS_Config.MPS_OC_Threshold[location][3] = OC_THRESHOLD; // // comp channel 1 SYS_Config.MPS_Comp_ON[location][0] = 1; // IMUNDO/IMUNDI SYS_Config.MPS_Comp_Chan[location][0][0] = 0; // IMUNDI SYS_Config.MPS_Comp_Chan[location][0][1] = 1; // IMUNDO SYS_Config.MPS_Comp_Threshold[location][0][0] = 0.2; // 20% (changed to 20% because of noise DGB) SYS_Config.MPS_Comp_Threshold[location][0][1] = 0.5; // 50% // comp channel 2 SYS_Config.MPS_Comp_ON[location][1] = 1; // IMDUMP/IMUNDO SYS_Config.MPS_Comp_Chan[location][1][0] = 1; // IMUNDO SYS_Config.MPS_Comp_Chan[location][1][1] = 2; // IMDUMP SYS_Config.MPS_Comp_Threshold[location][1][0] = 0.2; // 20% (changed to 20% because of noise DGB) SYS_Config.MPS_Comp_Threshold[location][1][1] = 0.5; // 50% // comp channel 3 SYS_Config.MPS_Comp_ON[location][2] = 0; // not used SYS_Config.MPS_Comp_Chan[location][2][0] = 0; // denominator SYS_Config.MPS_Comp_Chan[location][2][1] = 0; // numerator SYS_Config.MPS_Comp_Threshold[location][2][0] = 0.1; // 10% SYS_Config.MPS_Comp_Threshold[location][2][1] = 0.5; // 50% // comp channel 4 SYS_Config.MPS_Comp_ON[location][3] = 0; // not used SYS_Config.MPS_Comp_Chan[location][3][0] = 0; // denominator SYS_Config.MPS_Comp_Chan[location][3][1] = 0; // numerator SYS_Config.MPS_Comp_Threshold[location][3][0] = 0.1; // 10% SYS_Config.MPS_Comp_Threshold[location][3][1] = 0.5; // 50% //////////////////////////////////////////////////////////////////////////// location = 5; // // overcharge limit for each individual channel, in pC SYS_Config.MPS_OC_Threshold[location][0] = OC_THRESHOLD; // SYS_Config.MPS_OC_Threshold[location][1] = OC_THRESHOLD; // SYS_Config.MPS_OC_Threshold[location][2] = OC_THRESHOLD; // SYS_Config.MPS_OC_Threshold[location][3] = OC_THRESHOLD; // // comp channel 1 SYS_Config.MPS_Comp_ON[location][0] = 1; // SYS_Config.MPS_Comp_Chan[location][0][0] = 0; // SYS_Config.MPS_Comp_Chan[location][0][1] = 1; // SYS_Config.MPS_Comp_Threshold[location][0][0] = 0.1; // 10% SYS_Config.MPS_Comp_Threshold[location][0][1] = 0.5; // 50% // comp channel 2 SYS_Config.MPS_Comp_ON[location][1] = 0; // SYS_Config.MPS_Comp_Chan[location][1][0] = 1; // SYS_Config.MPS_Comp_Chan[location][1][1] = 2; // SYS_Config.MPS_Comp_Threshold[location][1][0] = 0.1; // 10% SYS_Config.MPS_Comp_Threshold[location][1][1] = 0.5; // 50% // comp channel 3 SYS_Config.MPS_Comp_ON[location][2] = 0; // not used SYS_Config.MPS_Comp_Chan[location][2][0] = 0; // denominator SYS_Config.MPS_Comp_Chan[location][2][1] = 0; // numerator SYS_Config.MPS_Comp_Threshold[location][2][0] = 0.1; // 10% SYS_Config.MPS_Comp_Threshold[location][2][1] = 0.5; // 50% // comp channel 4 SYS_Config.MPS_Comp_ON[location][3] = 0; // not used SYS_Config.MPS_Comp_Chan[location][3][0] = 0; // denominator SYS_Config.MPS_Comp_Chan[location][3][1] = 0; // numerator SYS_Config.MPS_Comp_Threshold[location][3][0] = 0.1; // 10% SYS_Config.MPS_Comp_Threshold[location][3][1] = 0.5; // 50% } // end Init_MPS_Parameters() /**************************************************************************** * * MPS_Init * * Sets the MPS outputs on boot-up & reads parameters. * * Default to all OK * ****************************************************************************/ void MPS_Init() { // Read MPS Parameter Values. Init_MPS_Parameters(); // set all 4 channels to overcharge = 1, fault condition MPS_OverCharge(0); // set all comparator outputs to FAULT MPS_Comparator(0); } /**************************************************************************** * * MPS_Set_Fault() * * Sets the MPS outputs, and MPS_Fault to true * * * ****************************************************************************/ void MPS_Set_Fault() { MPS_Fault = 1; } /**************************************************************************** * * MPS_OverCharge * * Sets the MPS outputs for each toroid * * each bit corresponds to each channel * bit [0] = chan 0 * * first 4 bits corresponds to each of the four possible channels * 1 = no overcharge * 0 = is overcharge * michael cecere 09/2006 * ***************************************************************************/ void MPS_OverCharge(unsigned data) { CPLD_LE = 0; // set CPLD Latch to in-active CPLD_Set_Chan(OVERCHARGE); CPLD_Set_Mode(CPLD_MPS); CPLD_Set_Data(data); Latch_CPLD(); } /**************************************************************************** * * MPS_Comparator * * Sets the MPS outputs for each toroid based on data input * * two bits for each channel, packed into one byte * each pair of bits mean: * 0 = fault condition * 1 = > threshold 1 * 2 = > threshold 2 * 3 = OK * * Bit Position 7 6 5 4 3 2 1 0 * Comp Chan # x x 3 3 2 2 1 1 * * michael cecere 09/2006 * ****************************************************************************/ void MPS_Comparator(unsigned data) { CPLD_LE = 0; // set CPLD Latch to in-active CPLD_Set_Chan(COMPARATOR); CPLD_Set_Mode(CPLD_MPS); CPLD_Set_Data(data); Latch_CPLD(); } /**************************************************************************** * * MPS_Update * * calculates status of each MPS channel and drives the outputs * * * * * michael cecere 09/2006 * ****************************************************************************/ void MPS_Update(int MPS_prt) { unsigned stat=0; int Chan; static int UP_G_DN[4], DN_G_UP[4]; long indexnum, indexden; char flag=1; float f1, fnum, fden; //float ratio[4]; char tstr[80] = " "; // update overthreshold status first // first 4 bits corresponds to each of the four possible channels // 1 = no overcharge // 0 = is overcharge stat = 0; //default to not-faulted flag = 1; // calculate which channels are over their limits for (Chan=0; Chan <= 3; Chan++) { // get the limit for that chan f1 = SYS_Config.MPS_OC_Threshold[SYS_Config.Location_ID][Chan]; // calculate the actual pC for that chan if (pC_Adj[Chan] > f1) stat = stat + flag; flag = flag << 1; if(MPS_prt) { sprintf(tstr,"pC_Adj[%d] = %4.0f\t\tstat = %02x\r\n", Chan, (double)pC_Adj[Chan], stat); UART2PutStr(tstr); } } // drive outputs MPS_OverCharge(stat); // calculate comparator pair status stat = 0; for (Chan=0; Chan <= 3; Chan++) { flag = 0x03; // set OK condition if (SYS_Config.MPS_Comp_ON[SYS_Config.Location_ID][Chan]) // if channel ON { indexnum = SYS_Config.MPS_Comp_Chan[SYS_Config.Location_ID][Chan][1]; // find the toroid downstream indexden = SYS_Config.MPS_Comp_Chan[SYS_Config.Location_ID][Chan][0]; // find the toroid upstream fnum = pC_Adj[indexnum]; // get the value, in pC if (fnum < 0) fnum = 0; fden = pC_Adj[indexden]; if (fden < 0) fden = 0; if ((Force_MPSChan == Chan) && (Force_MPSLevel < 4)) // if < 4 then forcing of MPS outputs is enabled { if (Force_MPSLevel == 0) // double fault doesn't matter what the readings are { fnum = 490.; fden = 500.; } if (Force_MPSLevel == 1) // >10% error { fnum = 440.; fden = 500.; } if (Force_MPSLevel == 2) // >50% error { fnum = 240.; fden = 500.; } if (Force_MPSLevel == 3) // errors < 10%, all OK { fnum = 490.; fden = 500.; } } /* The following block was commeted out to change from % to 3x10^8 (50.0pC) ratio[Chan] = fnum / fden; ratio[Chan] = (1-ratio[Chan]); // test for greater then 10% difference (level 1) if (ratio[Chan] > SYS_Config.MPS_Comp_Threshold[SYS_Config.Location_ID][Chan][0]) { flag = 0x02; } // end if greater than first limit // test for greater then 50% difference (level 2) if (ratio[Chan] > SYS_Config.MPS_Comp_Threshold[SYS_Config.Location_ID][Chan][1]) { flag = 0x00; // modified to set both bits per Stephen Norum's request 1/21/09 } // end if greater than second limit // test for downstream greater then upstream (due to beam spray) if(ratio[Chan] < -0.2) // if greater then negative 10% { flag = 0x00; } // end if downstream greater then upstream // The following section determines trip high or low of 3*10^8 (50pC) if((fden - fnum) > 50.0) flag = 0x02; // if upstream greater then downstream by 50pC -> TRIP else if((fnum - fden) > 50.0) flag = 0x01; // if downstream greater then upstream by 50pC -> TRIP else flag = 0x03; // */ // The following section determines trip high or low of 3*10^8 (50pC) if(((fden - fnum) > 50.0) && (UP_G_DN[Chan] >= 4)) flag = 0x02; // 5 consecutive errors to Trip else if(((fnum - fden) > 50.0) && (DN_G_UP[Chan] >= 4)) flag = 0x01; // 5 consecutive errors to Trip else flag = 0x03; if((fden - fnum) > 50.0) UP_G_DN[Chan] = UP_G_DN[Chan] + 1; // if upstream greater then downstream by 50pC -> set bit else UP_G_DN[Chan] = 0; if((fnum - fden) > 50.0) DN_G_UP[Chan] = DN_G_UP[Chan] + 1; // if downstream greater then upstream by 50pC -> set bit else DN_G_UP[Chan] = 0; // change the following line if comparator should or should not fault on no signal // if (fden < SYS_Config.LowerLimit_pC && fnum < SYS_Config.LowerLimit_pC) flag = 3; // OK if less then 100pC in first toroid } // end if comp channel enabled // move bits over to their proper position flag = flag << (Chan*2); // two bits per comp chan // lock them in their positions stat = stat + flag; } // end scanning comp virtual channels stat = stat ^ 0x00FF; // XOR stat = stat & 0x00FF; // drive outputs MPS_Comparator(stat); } // end MPS_Update /***************************************************************************** * Function: Get_Location() * * Overview: Read Voltage from MPS connector to get physical location. * * Input: none * * Output: Physiacl Location * * Author: David G. Brown * * Date: May 15, 2008 * ******************************************************************************/ void Get_Location(int PON) { int Chan,i; char tstr[100] = " "; unsigned long ADC_data[20], Location; Chan = 10; // MPS MUX switch setting MUX_Chan(Chan); // Write MUX address Location = 0; for(i=0; i<8; i++) { ADC_data[i] = ADC_Chan(); if(i>0) Location = Location + ADC_data[i]; // skip first value when accumulating } Location = Location / 7; // average value. MUX_Chan(Ground); // set MUX back to first channel if(Location >= 29491 && Location < 36045) SYS_Config.Location_ID = 0; // IM01, IM02, IM03, IMS1 if(Location >= 22938 && Location < 29491) SYS_Config.Location_ID = 1; // if(Location >= 16384 && Location < 22938) SYS_Config.Location_ID = 2; if(Location >= 9830 && Location < 16384) SYS_Config.Location_ID = 3; if(Location >= 3277 && Location < 9830) SYS_Config.Location_ID = 4; if(Location < 3277 ) SYS_Config.Location_ID = 5; // Open if(Previous_Location == SYS_Config.Location_ID) prt3 = 0; else prt3 = 1; Previous_Location = SYS_Config.Location_ID; if(prt3 == 1 || PON == 1) { sprintf(tstr,"\r\nSYS_Config.Location_ID = %d\r\n", (int)SYS_Config.Location_ID); UART2PutStr(tstr); prt3 = 0; PON = 0; Init_EEPROM_Parameters(); // if location has changed, re-read EEPROM } if(SYS_Config.Location_ID == 1) { SYS_Config.Chan_Faradaycup[0] = 0; // Toroid. SYS_Config.Chan_Faradaycup[1] = 0; // Toroid. SYS_Config.Chan_Faradaycup[2] = 45; // Faraday cup. (channels 4&5) SYS_Config.Chan_Faradaycup[3] = 67; // Faraday cup. (channels 6&7) } else { SYS_Config.Chan_Faradaycup[0] = 0; // Toroid. SYS_Config.Chan_Faradaycup[1] = 0; // Toroid. SYS_Config.Chan_Faradaycup[2] = 0; // Toroid. SYS_Config.Chan_Faradaycup[3] = 0; // Toroid. } } // end Get_Location /***************************************************************************** * Function: Get_Board_ID() * * Overview: Read MUX Voltage to determine Board ID #. * * Input: none * * Output: Board ID * * Author: David G. Brown * * Date: May 19, 2008 * ******************************************************************************/ void Get_Board_ID(int print) { int Chan,i; char tstr[100] = " "; unsigned long ADC_data[20], ID_Number; Chan = 13; // MPS MUX switch setting MUX_Chan(Chan); // Write MUX address ID_Number = 0; for(i=0; i<8; i++) { ADC_data[i] = ADC_Chan(); if(i>0) { ID_Number = ID_Number + ADC_data[i]; } // Throw first value away } ID_Number = ID_Number / 7; // set MUX back to first channel MUX_Chan(Ground); // Calculate Average SYS_Config.Board_ID if(ID_Number >= 62458 ) SYS_Config.Board_ID = 1; if(ID_Number >= 52926 && ID_Number < 62458) SYS_Config.Board_ID = 2; if(ID_Number >= 44758 && ID_Number < 52926) SYS_Config.Board_ID = 3; if(ID_Number >= 36516 && ID_Number < 44758) SYS_Config.Board_ID = 4; if(ID_Number >= 28428 && ID_Number < 36516) SYS_Config.Board_ID = 5; if(ID_Number >= 19647 && ID_Number < 28428) SYS_Config.Board_ID = 6; if(ID_Number >= 11622 && ID_Number < 19647) SYS_Config.Board_ID = 7; if(ID_Number >= 3760 && ID_Number < 11622) SYS_Config.Board_ID = 8; if(ID_Number >= 0 && ID_Number < 3760) SYS_Config.Board_ID = 9; //if(Previous_ID_Number == SYS_Config.Board_ID) prt = 0; //else prt = 1; //Previous_ID_Number = SYS_Config.Board_ID; if(print) { UART2PutStr("\r\n"); sprintf(tstr,"SYS_Config.Board_ID = %d", (int)SYS_Config.Board_ID); UART2PutStr(tstr); print = 0; } } // end Get_ID_Number()