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

  • SEARCH
  • Home
  • 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 5969005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:10:09+00:00 2026-05-22T20:10:09+00:00

I was looking into this ITE8712 watchdog timer demo code when I saw this:

  • 0

I was looking into this ITE8712 watchdog timer demo code when I saw this:

void InitWD(char cSetWatchDogUnit, char cSetTriggerSignal)
{
OpenIoConfig();     //open super IO of configuration for Super I/O

SelectIoDevice(0x07);   //select device7

//set watch dog counter of unit
WriteIoCR(0x72, cSetWatchDogUnit|cSetTriggerSignal);

//CloseIoConfig();      //close super IO of configuration for Super I/O
}

and, I wonder what is meant by this line:

cSetWatchDogUnit|cSetTriggerSignal

because the WriteIoCR function looks like this:

void WriteIoCR(char cIndex, char cData)
{
//super IO of index port for Super I/O
//select super IO of index register for Super I/O
outportb(equIndexPort,cIndex);

//super IO of data for Super I/O
//write data to data register
outportb(equDataPort,cData);
}

So cIndex should be 0x72, but what about the cData? I really don’t get the “|” thing as I’ve only used it for OR (“||”) in a conditional statement.

  • 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-05-22T20:10:10+00:00Added an answer on May 22, 2026 at 8:10 pm

    It’s a bitwise or, as distinct to your normal logical or. It basically sets the bits in the target variable if the corresponding bit in either of the source variables was set.

    For example, the expression 43 | 17 can be calculated as:

    43 = 0x2b = binary 0010 1011
    17 = 0x11 = binary 0001 0001
                       ==== ====
            "or" them: 0011 1011 = 0x3b = 59
    

    See this answer for a more thorough examination of the various bitwise operators.

    It’s typically used when you want to manipulate specific bits within a data type, such as control of a watchdog timer in an embedded system (your particular use case).

    You can use or (|) to turn bits on and and (&) to turn them off (with the inversion of the bitmask that’s used to turn them on.

    So, to turn on the b3 bit, use:

    val = val | 0x08; // 0000 1000
    

    To turn it off, use:

    val = val & 0xf7; // 1111 0111
    

    To detect if b3 is currently set, use:

    if ((val & 0x08) != 0) {
        // it is set.
    }
    

    You’ll typically see the bitmasks defined something like:

    #define B0 0x01
    #define B1 0x02
    #define B2 0x04
    #define B3 0x08
    #define B4 0x10
    

    or:

    enum BitMask {
        B0 = 0x01,
        B1 = 0x02,
        B2 = 0x04,
        B3 = 0x08,
        B4 = 0x10
    };
    

    As to what this means:

    WriteIoCR (0x72, cSetWatchDogUnit|cSetTriggerSignal);
    

    More than likely, 0x72 will be an I/O port of some sort that you’re writing to and cSetWatchDogUnit and cSetTriggerSignal will be bitmasks that you combine to output the command (set the trigger signal and use a unit value for the watchdog). What that command means in practice can be inferred but you’re safer referring to the documentation for the watchdog circuitry itself.

    And, on the off chance that you don’t know what a watchdog circuit is for, it’s a simple circuit that, if you don’t kick it often enough (with another command), it will reset your system, probably by activating the reset pin on whatever processor you’re using.

    It’s a way to detect badly behaving software automatically and return a device to a known initial state, subscribing to the theory that it’s better to reboot than continue executing badly.

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

Sidebar

Related Questions

Currently I'm looking into this C++ source code. I'm not a C++ dev. void
How would you test this scenario? I've just started looking into NHibernate and having
I have a coworker looking for this, and I don't recall ever running into
I have been looking into this for a while and can't figure it out.
I've just started looking into this, I want to scrape my Netgear Router (
Before I begin looking into this myself, I wanted to check if anyone had
OK, I've been looking into this a few days and am not particularly sure
This is a very high-level question. I'm looking for insight into this problem that
I have been looking into this for hours and still at a loss. I
I'm looking into using Visual Studio 2008's built in unit test projects instead of

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.