Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8781383
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:17:14+00:00 2026-06-13T20:17:14+00:00

I have the c code for the micro-controller with buzzer. It works, but I

  • 0

I have the c code for the micro-controller with buzzer. It works, but I wonder how it works.
In wh.h/.cpp I have the function:

void setBuzzer(tBool on)
{
  if (TRUE == on)
    IOCLR = BUZZER_PIN;
  else
    IOSET = BUZZER_PIN;
}

That can enable and disable the buzzer. I don’t know what it really makes and what BUZZER_PIN, IOCLR and IOSET are?

The BUZZER_PIN occurs only once more in the code, in:

void immediateIoInit(void)
{
  tU8 initCommand[] = {0x12, 0x97, 0x80, 0x00, 0x40, 0x00, 0x14, 0x00, 0x00};
  //                                                         04 = LCD_RST# low
  //                                                         10 = BT_RST# low

  //make all key signals as inputs
  IODIR &= ~(KEYPIN_CENTER | KEYPIN_UP | KEYPIN_DOWN | KEYPIN_LEFT | KEYPIN_RIGHT);

  IODIR |= BUZZER_PIN;
  IOSET  = BUZZER_PIN;

  IODIR |= BACKLIGHT_PIN;
  IOSET  = BACKLIGHT_PIN;

It looks strange to me, because the IOSET value is changing just after setting it to BUZZER_PIN. So, what it can that way does?

One more question: can I do something more with buzzer? E.g. change to volume? Of course, the duration of sound can be adjusted with setBuzzer(1) than pause(time) and setBuzzer(0).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T20:17:15+00:00Added an answer on June 13, 2026 at 8:17 pm

    Somewhere you will find an include file that contains the #define for IOSET IOCLR etc.

    Usually, they map to GPIO register addresses, eg:

    #define FIO0DIR (*(volatile unsigned long *)0x3FFFC000)

    IOSET is usually a writeable address that is hardware-capable of setting to 1 all bits written to it that are 1, while leaving the remainder of the GPIO bits in their previous state. This eliminates the need for a read/modify/write operation and so is much more interrupt/thread friendly. It normally has a similar ‘IOCLR’ partner that can clear the bits on the GPIO port that are set in its argument without affecting the state of others.

    The port register itself is probabaly called’ IOPIN’, or something like that. Modifying one or subsets of bits directly using IOPIN requires a read/modify/write 🙁

    It appears that the buzzer is connected to one GPIO pin, so you can only turn it on and off – no finer control is possible.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have large C code base for a micro-controller. I am working on a
I have code that generates a List<string[]> variable but can't quite figure out how
I have code like this in my view model: function ChatListViewModel(chats) { var self
I have code that looks more or less like the code below but it
I have code in a managed bean: public void setTestProp(String newProp) { FacesMessage yourFailure
On a micro-controller program I have a few instructions that I would like to
I have found this macro while digging in the source code of tweejump game.
I have code which has a drop down list. And when a certain option
I have code to create a live screenshot of the stage in my swf.
I have code similar to the following: <div class=container> <div class=overlay> // hover content

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.