Share this

Design of CSR power control system based on microcontroller MSC1210

2026-04-06 08:32:55 · · #1

introduction


The MSC1210 is a highly integrated mixed-signal processing device manufactured by Texas Instruments (TI). It integrates an enhanced 8051 core, eight 24-bit high-precision Δ-Σ A/D converters, 21 interrupt sources, 16-bit PWM, full-duplex UART (with SPI compatibility), 32KB of FLASH memory, and up to 1.2KB of on-chip SRAM. The MSC1210 features high analog and digital integration, small size, high measurement accuracy, and flexible applications, making it widely applicable in industrial control processes, intelligent transmitters, and intelligent sensors.


1. Working principle of the MSC1210 microcontroller


The MSC1210 microcontroller is a high-performance microcontroller system from TI, integrating analog, digital, and flash memory. Its applications are very wide-ranging. Utilizing an enhanced digital processing core and high-speed flash memory, along with high-performance analog and peripheral components, it achieves superior system performance. The MSC1210 includes flash memory, on-chip SFRs, SRAM, flash memory, scratchpad, and Boot ROM. Its memory has four physical storage spaces: on-chip and off-chip program memory, and on-chip and off-chip data memory. Different addressing instructions address the 64KB space from 0000H to FFFFH. Due to the different addressing modes, program and data segments can overlap. Program memory is automatically read by the MCU, or the MOVC instruction can be used to specify the program area to be read, typically used for table lookups. Data memory is read using the MOVX instruction, which provides multiple addressing modes to specify the destination address for reading the 64KB data memory. When on-chip memory is enabled, on-chip operations will read on-chip memory, while off-chip operations will read external memory through ports P0 and P2. Users can flexibly configure the size of program and data storage space. Partition size is determined by hardware configuration bits and can be programmed serially or in parallel. In user application mode, both program and data Flash storage space are readable and writable.


2 Hardware System Design


The main function of the power supply control system of the HIRFL-CSR (Lanzhou Heavy Ion Accelerator Cooling Storage Ring), a major national scientific project during the Ninth Five-Year Plan period, is to exchange information with the central control center through the communication module between the power supply and the computer, receive various monitoring and remote control commands from the remote control center, and feed back various status information of the power supply to the control center. The design of the control system's communication module is crucial to the construction of the switching power supply control system. The designed communication module communicates with the computer, realizing a 1:N (N=26 in this system) master-slave bus communication mode between the computer and the power supply, and adopts RS232C and RS485 dual serial communication bus standard interfaces. Through this communication module, the computer can perform real-time operations on the power supply, including switching power supply control loop, switching power supply main loop, switching power supply, power supply fault reset, power supply polarity reversal, reading the current status of the power supply, reading the current current value of a single power supply, reading the current current value of multiple power supplies, and writing the current value of the power supply. It also acquires real-time status verification information such as power supply good, load fault, power supply cooling water fault, output overcurrent, fast fuse status, IGBT status, AC phase loss, input overvoltage, input overcurrent, and power supply temperature.


3 Software Design


The software design development platform is Keil C7.0 from Keil Corporation. In order to realize command operation of the microcontroller MSC1210Y5, the main program code of the CSR power control system written in C1210 language is as follows.


void serial_init (void) file://serial port initialization{
PCON |=0x80;
SCON = 0x52;
TMOD |= 0x20;
file://TH1 = 0xfe;
TH1 = 0xff;
TR1 = 1;
IE=0x80;
ES0 = 1;
CON_TXD=0;
}
void read_cmd(char i_cmd_buf) file://read command operation{
}
void init_I_O(void) file://initialize I/O port{
P0DDRL = 0x55; file://P0 is the output mode P0DDRH = 0x55;
P2DDRL = 0xff; file://P2 is the input mode P2DDRH = 0xff;
P3DDRH = 0x55;
P0=0xff;
P3 |=0xc0;
}
void init_dac_adc(void) // Initializes the DAC and ADC
{
int decimation=1728;
/* Timer Setup */
CKCON = 0;
USEC = 10;
/* ADC-Vref, SPI and Systimers */
PDCON = 0x1b;
PDCON &= 0x14;
SPICON = 0x06;
SPITCON = 0x28;
ACLK = 9;
/* Set up Aux interrupt */
AIE=0x40;
EAI=1;
/* Setup ADC */
PDCON &=0x0f7;
ADMUX=0x78;
ADCON0=0x00;
ADCON2=decimation &0xff;
ADCON3=(decimation >>8)&0x07;
ADCON1=0x41;
AI = CLEAR;
SSCON=0x00;
SSCON=0xDB;
}
void dacout (unsigned int val) file://DAC output{
Sync = SET;
Sync = CLEAR;
SPIDATA = 0;
SPIDATA = (char)(val>>8 & 0x00ff);
SPIDATA = (char)(val & 0x00ff);;
}
serial() interrupt 4 using 2 { file://register group 2 is used for interrupts unsigned char c,i;
if (RI) { // If the receiver generates an interrupt c = SBUF; // Read data RI = 0; // Clear the interrupt request flag if(!(cmd_err==0&&cmd_finish==1&&addr_ok==1)){
switch (c) { file://process data}
ADCcmd_proc() interrupt 6 using 3 file://ADC command processing{
unsigned long sum;
sum = ((unsigned long int)SUMR3 << 24)
+ ((unsigned long int)SUMR2 << 16)
+ ((unsigned long int)SUMR1 << 8)
+ (unsigned long int)SUMR0;
adcsum[adcin_p]=(float)(sum*LSB);
adcin_p++;
adcin_p = adcin_p & 7;
AI = CLEAR;
SSCON=0x00;
SSCON=0xDB; file://acc shift enable, accum 16x, right shift 4
}


4. Conclusion


The MSC1210, a 51-core mixed-signal processor from Texas Instruments (TI) with a 24-bit A/D converter, boasts high performance, high integration, and great flexibility. Its 24-bit A/D converter with programmable gain amplification enables very high-precision analog-to-digital conversion. Several months of operation have demonstrated that the power control system operates stably and performs well in fulfilling the system's real-time monitoring and display tasks.

Read next

Discussion on the Integration and Upgrading of DCS Control Systems

1. Process Status and Automation System Background of Nantong Acetate Fiber Co., Ltd. Nantong Acetate Fiber Co., Ltd. (h...

Articles 2026-02-22