EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Topics / Usage of sbit with structure members

Usage of sbit with structure members

|

Microcontroller › 8051 › Usage of sbit with structure members

  • This topic has 1 reply, 2 voices, and was last updated 12 years, 8 months ago by AJISH ALFRED.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • June 24, 2013 at 7:59 am #2499
    Venkatesh Dhiravath
    Participant

    Hi all,

     

    go trough the following program,

     

     

    struct node{

     

                     bit    open;

                     bit    close;

    }door[2];

     

     

    sbit door[0].open = P1^0;

    sbit door[0].close = P1^1;

    sbit door[1].open = P1^2;

    sbit door[2].close = P1^3;

     

     

     

    when I compile / build this program, error is thrown stating that C141: Invalid usage of sbit. Can any one verify and suggest me, how to assign SFR bit to structure members or arrays.

     

     

    June 27, 2013 at 5:08 am #10045
    AJISH ALFRED
    Participant

    Yes, it is invalid usage.

     

    sbit door[0].open = P1^0;

     

    In the above line you can use struct node instead of sbit, like

     

    struct node door[0].open = P1^0;

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • What diode should I use? March 7, 2026
  • LM016L + PCF8574 I2C Backpack Schematic with Backlight Control March 7, 2026
  • Expensive hobby March 7, 2026
  • USING EASYEDA BUT SOMETHING ISN'T RIGHT? March 7, 2026
  • What is this component and what is its function? March 6, 2026

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2026 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise