[ECOS] buzzer on PC

David N. Welton davidw@dedasys.com
Mon Sep 8 15:38:00 GMT 2003


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.

-- 
David N. Welton
   Consulting: http://www.dedasys.com/
     Personal: http://www.dedasys.com/davidw/
Free Software: http://www.dedasys.com/freesoftware/
   Apache Tcl: http://tcl.apache.org/

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



More information about the Ecos-discuss mailing list