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
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 9 years, 1 month 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

  • How to power up two stereo audio amplifiers from a single source of power supply August 12, 2022
  • Nokia 5110 HW in Oshonsoft August 12, 2022
  • Drill speed controller fault August 12, 2022
  • Charging shutdown circuit question. August 12, 2022
  • My NE555 chips gone bad August 12, 2022

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2022 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