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 6030503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:02:46+00:00 2026-05-23T05:02:46+00:00

I need help with a python version for this C code: #define HostBusy_high 0x02

  • 0

I need help with a python version for this C code:

#define HostBusy_high   0x02
#define control_register    0x37a

Out32 (control_register,(unsigned char)(Inp32(control_register) | HostBusy_high));

the Out32 and Inp32 are functions located in the inpout32.dll used to interface parallel ports. These functions take hex values as their parameters. I tried to code in python to get the desired value but that is not what I am getting. See python version below:

from ctypes import windll

#parallel port instance
p_port = windll.inpout32
HostBusy_high = 0x02
control_register = 0x37a

write_data = write(p_port(Inp32(control_register) | HostBusy_high))
 Out32 (control_register,write_data))

With the code above i do not seem to get the value I want. I suspect it is the unsigned value.

Thanks

  • 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-23T05:02:47+00:00Added an answer on May 23, 2026 at 5:02 am

    Maybe you just should get the modulo 256 of your value. Then it is surely unsigned. Examples:

    >>> 12 % 256
    12
    >>> 1022 % 256
    254
    >>> -1 % 256
    255
    >>> -127 % 256
    129
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry to bother again, but I really need help transforming this Python2 code into
I need help on this following aspx code aspx Code: <asp:Label ID =lblName runat
I need urgent help in this regard. I am trying to run a Python
I need some help calculating Pi. I am trying to write a python program
Need help writing a script downloads data from google insight using c# this is
I need help with this route map routes.MapRoute(Blog_Archive, Blog/Archive/{year}/{month}/{day}, new { controller = Blog,
Newbie in Python need help! I have a file with a structure: [timestamp] [level]
I need to convert unicode strings in Python to other types such as unsigned
I need some help implementing threading using Python 2.1. I would readily update to
I have a program written for text simplification in python language, I need this

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.