In this 'Tips 'n Tricks' article from Microchip Technologies, the company describes a method of structuring faster code for detecting change.
When using a comparator to monitor a sensor, it is often just as important to know when a change occurs as it is to know what the change is. To detect a change in the output of a comparator, the traditional method has been to store a copy of the output and periodically compare the held value to the actual output to determine the change. An example of this type of routine is shown in Figure 1.
Figure 1. Routine 1
This routine requires five instructions for each test; nine instructions if a change occurs and one RAM location for storage of the old output state. A faster method for microcontrollers with a single comparator is to use the comparator interrupt-flag to determine when a change has occurred.
Routine 2 (Figure 2) requires two instructions for each test; three instructions if a change occurs and no RAM storage. If the interrupt flag cannot be used or if two comparators share an interrupt flag, an alternate method that uses the comparator output polarity bit can be used.
Figure 2. Routine 2
Routine 3 (Figure 3) requires two instructions for each test; five instructions if a change occurs and no GPR storage.
Converter power modules for 48 V networks Altron Arrow
Power Electronics / Power Management
The economic and quality-of-life benefits of electrification is driving the adoption of HV to 48 V DC-DC conversion across many markets with 48 V power modules becoming more common.
Read more...Memory for asset tracking Altron Arrow
DSP, Micros & Memory
The Page EEPROM, ST’s latest memory, has been designed for efficient datalogging and fast firmware upload/download in battery-operated devices.
Read more...Engineered for high-reliability applications Future Electronics
DSP, Micros & Memory
The MCX E series of Arm Cortex-M4F and Arm Cortex-M7 microcontrollers from NXP are engineered for demanding industrial and IoT environments.
Read more...NXP’s development platform guide
DSP, Micros & Memory
Choosing between the FRDM i.MX 93, FRDM i.MX 91 and FRDM i.MX 91S development platforms can be intimidating, but once designers understand how each platform aligns with their application’s requirements, the decision becomes straightforward.
Read more...Microchip and AVIVA Links collaboration Altron Arrow
News
Microchip and AVIVA Links have achieved groundbreaking ASA-ML interoperability, accelerating the shift to open standards for automotive connectivity.
Read more...XJTAG launches two new Flash programmers ASIC Design Services
DSP, Micros & Memory
XJTAG has announced XJExpress and XJExpress-FPGA, a pair of Flash programmers perfect for development, debug and in-service applications.
Read more...Expanded STM32WL3x line for IoT sensors Altron Arrow
Telecoms, Datacoms, Wireless, IoT
The STM32WL31x and STM32WL30x are more tailored versions of the STM32WL33x for designers who wish to focus on specific features, while lowering their bill of materials.
Read more...Processor offers competitive solution for advanced HMIs Future Electronics
DSP, Micros & Memory
The new RZ/A3M microprocessor from Renesas features 128 Mbytes of fast DDR3L DRAM memory for system cost reduction, and supports 1280 x 800 px video resolution at a rate of 30 frames/s.
Read more...Ultra-low jitter clock buffers Altron Arrow
Telecoms, Datacoms, Wireless, IoT
New SKY53510/80/40 family of clock fanout buffers from Skyworks are purpose-built for data centres, wireless networks, and PCIe Gen 7 applications.
While every effort has been made to ensure the accuracy of the information contained herein, the publisher and its agents cannot be held responsible for any errors contained, or any loss incurred as a result. Articles published do not necessarily reflect the views of the publishers. The editor reserves the right to alter or cut copy. Articles submitted are deemed to have been cleared for publication. Advertisements and company contact details are published as provided by the advertiser. Technews Publishing (Pty) Ltd cannot be held responsible for the accuracy or veracity of supplied material.