element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Personal Blogs
  • Community Hub
  • More
Personal Blogs
NexGen Flight Simuator NexGen: Fuel Load Indicator: Switches on Interrupts!
  • Blog
  • Documents
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: phoenixcomm
  • Date Created: 2 Nov 2020 11:52 PM Date Created
  • Views 908 views
  • Likes 4 likes
  • Comments 1 comment
  • flight simulator
  • nexgen
  • 90-00659-1
  • arduino mega 2560
  • interrupts
  • parker 219-100-001
  • bit shift operator
  • recycleretrofitch
  • fuel load indicator
  • c programming
Related
Recommended

NexGen: Fuel Load Indicator: Switches on Interrupts!

phoenixcomm
phoenixcomm
2 Nov 2020

imageWell, for starters there are problems with the Arduino CAN bus library, as ANY node in the system can be a master or a slave. Currently, the Arduino CAN supports a SLAVE - MASTER, relationship. On the MCP2515_CAN module, you have the following connection on the header, plus outputs High and Low. So with what little time I have remaining. I just will be sending and receiving messages via the USB port using CANaerospace formatted messages.

SIGNAL MODULE MEGA PIN ICSP Definition
MOSI SI 51 4 Master Out / Slave In
MSO SO 50 1 Master Slave Out
SCLK SCK 52 3 System Clock
CS CS 53 Slave Select
INT

The Fuel Load Indicator has two switches:

1. UP / DOWN switches control which fuel tank is being filled or the current value of the selected tank. This is a circular list.

2. Fill controls the filling of the selected tank (see switch 1)

3. TEST position tests the system when selected both displays will turn on both displays.

After TESTING the upper display will display total fuel load in pounds, the lower display will display the tank number and US Gallons.

There can be up to eight (8) tanks with CAN identifiers 668 - 675  with fuel total identifier at 1301. The Fule Load Indicator must also respond to IDS (node 0) Identification service. Requests a "sign-of-life" response together with the configuration from the addressed node.

 

Now back to the switches. I plan on using an SN74LS148 an 8 input to 3 BCD priority encoder. A nice feature of the encoder it has an extra output EO since all of the switches are pulled up EO = LOW, when a switch is energized EO = HIGH. The EO output is input to an SN74LS14 hex Schmitt-Trigger. The output of the Schmitt-Trigger is pin number 3 on the Arduino's Interrupt Pin.

Afterthought:

  • Please Note that pin Interrups value equals 3 and the name of the interrupt is ISR3.  This keeps things straight in my mind.
  • I could use bit manipulation:

valA = digitalRead (pinA );

valB = digitalRead (pinB );

valB << 2;

valC = digitalRead (pinC );

valC << 3;

testValue = valA + valB + ValC;

switches ( testValue );

 

// in setup
int pinInerrupt = 3;
int pinA = 22;
int pinB = 23;
int pinC = 24;
attachInterrupt(digitalPinToInterrupt(pinInterrupt),ISR3, CHANGE);

void ISR3() {
int valA;
int valB;
int valC;

valA = digitalRead( pinA );
valB = digitalRead( pinB );
valC = digitalRead( pinC );

if ( valC == 0 ) {
    switches ( 4 ); }
else if (valA == 0 && valB == 0){
    switches ( 3 );
else if (valB == 0 ){
    switches ( 2 ); }
else if ( valA == 0 ){
    switches ( 1 ); }
// in setup
#define UP 1
#define DOWN  2
#define TEST 3
#define FILL 4
int maxTanks = 8;
int curTank = 0;

void switches( int value ) {
    switch( value ) {
    case UP {
        if( curTank < maxTank ) {
            curTank++;
        else if( curTank == maxTank ) {
            curTank = 1; }}
    case DOWN {
        if( curTank = 1 ) {
            curTank = MaxTank;
        else curTank--; }}
    case TEST {
        test();}
    case FILL {
        fill( );}
}
  • Sign in to reply

Top Comments

  • DAB
    DAB over 5 years ago +2
    Yep, interrupts is the way to go. DAB
  • DAB
    DAB over 5 years ago

    Yep, interrupts is the way to go.

     

    DAB

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube