This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: buzzer on PC


On Mon, Sep 08, 2003 at 05:38:57PM +0200, David N. Welton wrote:
> Piotr Trojanek <ptroja@elproma.com.pl> writes:
> 
> > how to 'beep' on PC buzzer from ecos?
> 
> Oh, I know this one!
> 
>     countdown = 1193180 / speaker_frequency;
> 
> set_speaker(int countdown)
> {
>     char snd = 0;
>     /* Init speaker.  */
>     HAL_WRITE_UINT8(0x43, 0xb6);
>     HAL_WRITE_UINT8(0x42, countdown & 0xff);
>     HAL_WRITE_UINT8(0x42, countdown >> 8);
>     HAL_READ_UINT8(0x61, snd);
>     snd |= 3;
>     HAL_WRITE_UINT8(0x61, snd);
> }
> 
> Something like that ought to work.

works great:), thanks!

-- 
Piotr Trojanek

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]