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.
Highest increase in global cyberattacks in two years
Information Security News & Events
Check Point Global Research released new data on Q2 2024 cyber-attack trends, noting a 30% global increase in Q2 2024, with Africa experiencing the highest average weekly per organisation.
Read more...Adaptive optics’ power solution Altron Arrow
Opto-Electronics
Vicor power-dense adaptive optical modules enable colossal telescopes to look into the past for deep space discoveries.
Read more...MCU for low-power, IoT applications NuVision Electronics
DSP, Micros & Memory
Silicon Labs recently announced the PG26, a general-purpose microcontroller with a dedicated matrix vector processor to enhance AI/ML hardware accelerator speeds.
Read more...Wide input voltage buck-boost converter Altron Arrow
Power Electronics / Power Management
The MAX77859 from Analog Devices is a high-efficiency, high-performance buck-boost converter targeted for systems requiring a wide input voltage range of between 2,5 and 22 V.
Read more...EEPROMs for industrial and military markets Vepac Electronics
DSP, Micros & Memory
Designed to ensure the data retention and the secure and safe boot of digital systems, the memory product line includes small and medium density EEPROMs from 16 kb to 1 Mb.
Read more...PLCnext – Open, IIoT-ready industrial platform IOT Electronics
DSP, Micros & Memory
PLCnext can be used alongside an existing PLC system, collecting control system data via EtherNet/IP, PROFINET, or MODBUS, and can push this information to a cloud instance.
Read more...ICs vs modules: Understanding the technical trade-offs for IoT applications NuVision Electronics
Editor's Choice DSP, Micros & Memory
As the IoT continues to transform industries, design decisions around wireless connectivity components become increasingly complex with engineers often facing the dilemma of choosing between ICs and wireless modules for their IoT applications.
Read more...Hardware quantum resistance to embedded controllers Avnet Silica
DSP, Micros & Memory
To help system architects meet evolving security demands, Microchip Technology has developed its MEC175xB embedded controllers with embedded immutable post-quantum cryptography support.