To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.handyboardOpen lugnet.robotics.handyboard in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / Handy Board / 3418
3417  |  3419
Subject: 
Re: I can't beep my handy (again)
Newsgroups: 
lugnet.robotics.handyboard
Date: 
Sat, 14 Mar 1998 21:27:03 GMT
Original-From: 
Will Bain <willbain@{spamless}cs.umt.edu>
Viewed: 
1447 times
  
German Gentile--

I know nothing about Imagecraft C, but here's how the beep function is
defined in lib_hb.c (the Interactive C library of functions written for the
Handy Board):

void beep()
{
    tone(500., .1);
}

/*  1/2 cycle delay in .5us goes in 0x26 and 0x27  */
void tone(float frequency, float length)
{
    set_beeper_pitch(frequency);
    beeper_on();
    sleep(length);
    beeper_off();
}

void beeper_on()
{
    bit_set(0x1020, 0b00000001);
    bit_set(0x1022, 0b00001000);
}

void beeper_off()
{
    bit_clear(0x1022, 0b00001000);
    bit_clear(0x1020, 0b00000001);
    bit_clear(0x1000, 0b00001000); /* turn power to spkr off */
}

void set_beeper_pitch(float frequency)
{
    pokeword(0x26, (int)(1E6 / frequency));
}

If Imagecraft C has poke and bit manipulation functions, then you ought to
be able to translate this directly.  Good luck.

--Will
                                          , ,
        __@_/             \_@__           |/
          |                /__,           o             @_/
          )\              )              ( \            (\/\\,
~~~~~~~~~ ' ` ~~~~~~~~~~~ ` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Wendy Parson,               Conscience:  the inner voice which warns us
Will Bain,                                 that someone may be looking.
& Tatoosh                                               --H. L. Mencken



1 Message in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR