Buzzer Routine Help

Status
Not open for further replies.

rrb011270

New Member
Mabuhay!

My buzzer routine below:
output_high(BUZZER);
delay_ms(200);
output_low(BUZZER);
delay_ms(450);

Is there another way such that I can use interrupt driven o reduce the instruction cycle of this routine?

My application is an RF reader which use an #int_ext2 to capture the ID from the badge. When it is successfull a buzzer will sound for success.

most of my code use the interrupt handler routine like the clock which use the #int_timer0 such it will capture the time and date and added to a complete packet of data which are compose of date, time, RFid, etc...

Any help will do?

Tenkyu
 

Assuming you have a timer interrupt running, simple decrement a counter on each interrupt call, when the counter reaches zero, toggle the output pin and reload the counter with the next value (you could use different values to give the assymetrical waveform you are currently using). To turn the buzzer on and off, simply set a flag - have the interrupt routine check the flag before decrementing the counter.
 

Can you u share a code snippet if any?
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…