Use a Microcontroller’s Functionality to Quickly Implement Analog Signal Chains in Compact Designs

By Stephen Evanczuk

Contributed By DigiKey's North American Editors

With the addition of these analog signal conditioning circuits on a microcontroller, developers now have an effective way to configure these components to meet a broad range of analog interface requirements for wearables and other IoT devices by manipulating only a few lines of code.

Interfacing a sensor to a microcontroller

Diagram of Texas Instruments MSP430FR2355 MCU

Integrated analog components

คัดลอก
//Select external source for both positive and negative inputs
SAC_OA_init(SAC0_BASE, SAC_OA_POSITIVE_INPUT_SOURCE_EXTERNAL, SAC_OA_NEGATIVE_INPUT_SOURCE_EXTERNAL);
 
//Select low speed and low power mode
SAC_OA_selectPowerMode(SAC0_BASE, SAC_OA_POWER_MODE_LOW_SPEED_LOW_POWER)
 
// Enable OA 
SAC_OA_enable(SAC0_BASE);
 
// Enable SAC 
SAC_enable(SAC0_BASE);

SAC_OA_initSAC_OA_selectPowerMode

Diagram of Texas Instruments MSP430FR2355 MCU

Diagram of Texas Instruments SAC module's digital-to-analog converter

คัดลอก
//Select internal shared reference as DAC reference voltage
SAC_DAC_selectRefVoltage(SAC0_BASE, SAC_DAC_SECONDARY_REFERENCE);
 
//Select the load trigger for DAC data latch
//DAC always loads data from DACDAT at the positive edge of Timer output TB2.1 
SAC_DAC_selectload(SAC0_BASE, SAC_DAC_LOAD_DEVICE_SPECIFIC_0);
 
//Enable DAC Interrupt 
SAC_DAC_interruptEnable(SAC0_BASE);
 
//Write data to DAC Data Register SACxDAT
//DAC_data is an unsigned int type variable defined by user SAC_DAC_setData(SAC0_BASE, DAC_data);
 
//Enable DAC 
SAC_DAC_enable(SAC0_BASE);
 
//Select internal DAC for positive input and PGA source for negative input 
SAC_OA_init(SAC0_BASE, SAC_OA_POSITIVE_INPUT_SOURCE_DAC,
     SAC_OA_NEGATIVE_INPUT_SOURCE_PGA);
 
//Select Buffer Mode
SAC_PGA_setMode(SAC0_BASE, SAC_PGA_MODE_BUFFER);
 
//Enable OA 
SAC_OA_enable(SAC0_BASE);
 
//Enable SAC 
SAC_enable(SAC0_BASE);

Multiple stages

Diagram of Texas Instruments one SAC module in DAC mode and a second SAC in OA mode

SAC_OA_initSAC0_BASESAC_OA_NEGATIVE_INPUT_SOURCE_PGASAC_OA_POSITIVE_INPUT_SOURCE_PAIR_OA

คัดลอก
    //Configure Op-Amp functionality
    GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P3,
                                               GPIO_PIN1 | GPIO_PIN3 | GPIO_PIN2,
                                               GPIO_TERNARY_MODULE_FUNCTION);
 
    //Select external source for both positive and negative inputs
    SAC_OA_init(SAC2_BASE, SAC_OA_POSITIVE_INPUT_SOURCE_EXTERNAL,
                SAC_OA_NEGATIVE_INPUT_SOURCE_EXTERNAL);
 
    //Select low speed and low power mode
    SAC_OA_selectPowerMode(SAC2_BASE, SAC_OA_POWER_MODE_LOW_SPEED_LOW_POWER);
 
    SAC_OA_enable(SAC2_BASE);                  // Enable SAC2 OA
    SAC_enable(SAC2_BASE);                     // Enable SAC2
 
    //Select external source for both positive and negative inputs
    SAC_OA_init(SAC0_BASE, SAC_OA_POSITIVE_INPUT_SOURCE_PAIR_OA,
                SAC_OA_NEGATIVE_INPUT_SOURCE_PGA);
 
    SAC_OA_enable(SAC0_BASE);                  // Enable SAC0 OA
    SAC_enable(SAC0_BASE);                     // Enable SAC0

SAC_OA_POSITIVE_INPUT_SOURCE_PAIR_OA

Diagram of Texas Instruments one SAC module in DAC mode and a second SAC in OA mode

Diagram of Texas Instruments MSP430FR2355 MCU and its SAC modules

บทสรุป

 
DigiKey logo

Disclaimer: The opinions, beliefs, and viewpoints expressed by the various authors and/or forum participants on this website do not necessarily reflect the opinions, beliefs, and viewpoints of DigiKey or official policies of DigiKey.

About this author

Image of Stephen Evanczuk

Stephen Evanczuk

Stephen Evanczuk มีประสบการณ์มากกว่า 20 ปีในการเขียนรวมทั้งประสบการณ์เกี่ยวกับอุตสาหกรรมอิเล็กทรอนิกส์ในด้านต่าง ๆ มากมายซึ่งรวมถึงฮาร์ดแวร์ซอฟต์แวร์ระบบและแอพพลิเคชั่นรวมถึง IoT เขาสำเร็จการศึกษาระดับปริญญาเอกทางด้านระบบประสาทเกี่ยวกับเครือข่ายเซลล์ประสาทและทำงานในอุตสาหกรรมการบินและอวกาศเกี่ยวกับระบบความปลอดภัยแบบกระจายจำนวนมากและวิธีการเร่งอัลกอริทึม ปัจจุบัน หากว่าเขาไม่ยุ่งกับการเขียนบทความเกี่ยวกับเทคโนโลยีและวิศวกรรม ก็จะทำงานเกี่ยวกับการประยุกต์ใช้การเรียนรู้เชิงลึกกับระบบการจดจำและการแนะนำ

About this publisher

DigiKey's North American Editors