SendsChr.c 716 B

12345678910111213141516171819202122
  1. #include <hidef.h> /* common defines and macros */
  2. #include "derivative.h" /* derivative-specific definitions */
  3. #include "funct.h"
  4. int tone=0; //value to hold the tone to be generated
  5. int tone_count=0; //counter to test the tone to be generated
  6. void SendsChr(char NewTone, int dummy)
  7. {
  8. dummy++; //increment the dummy value to supress the warning
  9. tone=NewTone; //set the tone passed on the stack
  10. }
  11. void PlayTone(void)
  12. {
  13. tone_count++; //increment tone counter
  14. if(tone_count>=tone) //if the tone count is equal to or higher than the tone
  15. {
  16. tone_count=0; //reset the counter
  17. PTT = PTT ^ 0x20; //toggle the speaker bit.
  18. }
  19. }