View previous topic :: View next topic |
Author |
Message |
farizah
Joined: 26 Dec 2009 Posts: 5
|
Buzzer interrupt using rs232 |
Posted: Wed Jan 06, 2010 6:36 pm |
|
|
Hello, I'm new here and need some help. For example: play the happy birthday on buzzer, hold if there is incoming data sending from rs232, do another .c, then play again the sound. thanks for your help. (I'm using ccs v4.084)
Code: |
/////////////////////////////////////////////////////////////////////////
//// EX_TONES.C ////
//// ////
//// This example plays the song "Happy Birthday." ////
//// ////
c:\program files\picc\examples\ex_tones.c
|
+++++++++++++++++++++++
Code removed.
Reason: Forum rule #10
10. Don't post the CCS example code or drivers.
-- Forum Moderator
+++++++++++++++++++++++ |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Jan 07, 2010 1:16 pm |
|
|
You can use getc() to wait for a character to arrive on the RS-232
serial port. Then it will get the character.
This post shows how to do it. In a while(1) loop, getc() is called at
the top of the loop. When it gets a character, it uses a switch-case
statement to detect which character was received. It then takes action
based on the character. In this example, it does SPI actions.
You could substitute code to call the generate_tone() function.
http://www.ccsinfo.com/forum/viewtopic.php?t=39145&start=1
If you have any questions, add them to this thread. Do not post on
the SPI thread. |
|
|
|