Hot answers tagged

3

A flickering or flashing UV LED will be more noticeable than one that is continuously on at low power. Just use a resistor from the forklift's 12V to power the LED


3

Under an RTOS, a context switch means the RTOS changes which task (process) is currently running on MCU. The switch to another task may happen due to user code (e.g. OS call to sleep for some amount of time) or via timer interrupt if a task is running and time slice it was given is used so it is time to run other tasks. Or a task says to OS it is done and ...


2

You can start a timer and read the count until it is large enough. Or you can poll the overflow flag when it rolls over. No need for interrupts. You can also sit in a while or for loop for enough counts to reach 10us.


2

The ATMega32 will not run from a 16MHz external crystal by default. If you have not programmed its fuse bits for a 16MHz external clock (or the fuse bits are otherwise set to their factory defaults), then the ATMega32 will not use the external crystal and it will not be running at 16MHz. Don't be intimidated by the name 'fuse bit', the 'fuse' part is not ...


1

If you really want to do low duty cycles always less than 50% with a 555, just invert the output, i.e. drive the LEDs on when the output is low. Otherwise just use a MCU so you can get any kind of pattern to drive the LEDs. Also running the LEDs constantly at low current would be just as same.


1

An interrupt in a Cortex-M CPU would probably count as a context switch by itself. When handling an interrupt, the CPU: Pushes its registers to the stack Saves the address of the next instruction it would have executed. Branches to the address of the ISR. If "context" means register contents, stack frame, and PC, then an interrupt is a context ...


1

I was suggested to not use SysTick timer for too small of a delay anyways and rather go for hardware timers. Yes, this is the sensible approach. 10us is a pretty "hard" real-time constraint. I read up on Timers and to me, it looks more like they're mainly used for tasks where you need to do a function at a specific interval Not necessarily. They ...


1

Timers are great at making accurate time intervals. But if you just need a one time delay of some period longer than 10us, when the chip is enabled and don't want to hassle with configuring a timer, then a simple for loop with a NOP might be the most expeditious path. Add a pragma to it so that it doesn't change with optimization levels and you are good to ...


1

For a delay of at least some amount, You could set a flag in the main loop and enable a timer interrupt that resets the flag. The main loop polls the flag in sequence while running other tasks and skips the function that executes the second half while it is set. You may need another flag to indicate that the second half is armed to run. (Or just poll the ...


Only top voted, non community-wiki answers of a minimum length are eligible