[mC V8 PIC] sound library

Discuss about beta versions of mikroC compiler.
Post Reply
Author
Message
bruno
Posts: 767
Joined: 10 Sep 2005 02:10
Location: Lyon, France
Contact:

[mC V8 PIC] sound library

#1 Post by bruno » 08 Feb 2008 12:33

Hello,

Anybody to test :

Code: Select all

Sound_init(&PORT_BUZZER, NUM_BIT_BUZZER) ;
Sound_play(250, 1000) ;
(replace PORT_BUZZER and NUM_BIT_BUZZER with your own definitions)

go you get expected results (a 250 Hz tone for 1 second) ?

ME : is there a lower limit to the frequency parameter ? Fosc dependency ?

BTW :
it would have been better to leave Sound_play() as it was for backward compatibility, and to create a new function like Sound_freq() for example :?

Thanks !
Bruno
Bored with 7-segment ? Try the [url=http://www.micro-examples.com/public/microex-navig/doc/079-touchclock.html]TouchClock[/url]

bruno
Posts: 767
Joined: 10 Sep 2005 02:10
Location: Lyon, France
Contact:

#2 Post by bruno » 14 Feb 2008 00:20

:| not confirmed ?
Bruno
Bored with 7-segment ? Try the [url=http://www.micro-examples.com/public/microex-navig/doc/079-touchclock.html]TouchClock[/url]

User avatar
zristic
mikroElektronika team
Posts: 6608
Joined: 03 Aug 2004 12:59
Contact:

#3 Post by zristic » 14 Feb 2008 09:42

We are just about to test this.

User avatar
milan
mikroElektronika team
Posts: 1013
Joined: 04 May 2006 16:36
Contact:

#4 Post by milan » 14 Feb 2008 10:56

Hi,

what seems to be the problem?

Frequency or signal duration?

What MCU/crystal you use for tests ?

bruno
Posts: 767
Joined: 10 Sep 2005 02:10
Location: Lyon, France
Contact:

#5 Post by bruno » 14 Feb 2008 11:16

PIC18F4620 4.194304 Mhz crystal with 4x PLL
nb : clock is set to 16.177216 Mhz in project setup

lowest frequencies between 200 and 500 Hz (approximately) are not correct

durations are correct

try something like this :

Code: Select all

for(i = 200 ; i < 2000 ; i += 200)
 {
 sound_play(i, 1000) ;
 }
during the first steps, I can ear up & down frequencies

thanks !
Bruno
Bored with 7-segment ? Try the [url=http://www.micro-examples.com/public/microex-navig/doc/079-touchclock.html]TouchClock[/url]

User avatar
milan
mikroElektronika team
Posts: 1013
Joined: 04 May 2006 16:36
Contact:

#6 Post by milan » 14 Feb 2008 11:33

Hi,

thank you for providing details.
We will check this.

User avatar
milan
mikroElektronika team
Posts: 1013
Joined: 04 May 2006 16:36
Contact:

Re: [mC V8 PIC] sound library

#7 Post by milan » 25 Feb 2008 14:39

Hi Bruno,

you are right, frequencies below 800Hz can't be reproduced correctly.

As you know function SoundPlay generates square signal with given frequency.
This is implemented through calling Delay_Cyc function.
This function has parameter range 3..255

This is the reason why frequency has limited range.

This will be documented in next Help:
Maximum frequency that can be produced by this function is
Freq_max = Fosc/(80*3). Minimum frequency is Freq_min = Fosc/(80*255).
bruno wrote: BTW :
it would have been better to leave Sound_play() as it was for backward compatibility, and to create a new function like Sound_freq() for example
New set of parameters is far more intuitive than the old one (in our opinion)
and we introduced it to make the Sound Library usage easier.
We were assuming that users that used old set of parameters will
easily move to the new(better) parameters.
I am sorry if we were wrong and caused you trouble.
If we get more requests for maintaining backward compatibility -
we will think about the Library design again.

bruno
Posts: 767
Joined: 10 Sep 2005 02:10
Location: Lyon, France
Contact:

#8 Post by bruno » 25 Feb 2008 22:21

Hi Milan, thank you for your explanations
I think we beta testers are the less impacted than others by library changes since we follow all compiler releases, so the trouble is not big for me
Bruno
Bored with 7-segment ? Try the [url=http://www.micro-examples.com/public/microex-navig/doc/079-touchclock.html]TouchClock[/url]

Post Reply

Return to “mikroC Beta testing”