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 Indicator: Wire & Power-up: 3
  • Blog
  • Documents
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: phoenixcomm
  • Date Created: 22 Dec 2020 5:36 PM Date Created
  • Views 333 views
  • Likes 0 likes
  • Comments 0 comments
  • sn74ls148
  • flight simulator
  • nexgen
  • priority encoder
Related
Recommended

NexGen: Fuel Indicator: Wire & Power-up: 3

phoenixcomm
phoenixcomm
22 Dec 2020

imageIn this post, I will be talking about my switches which are done with an interrupt on Arduino Mega's pin#2, and just to keep my head on straight the interrupt service routine's name is isr2. First, let me digress. The Fuel Load Indicator has two (2) switches and each has two (2) positions for a total of four (4) switch selections. So how do I generate the interrupt?image

One way is to connect the four wires (a, b, c, d) to the Arduino and then use a quad 2-input or-gate, SN74LS32. As shown in the table below. And then you have to guess which switch was used.

image

Section A B C
1 a b e
2 c d f
3 e f g
4

The second way is to use a priority encoder SN74LS148.  The encoder has 7 inputs and 3-Bit BCD code for the output. Below is a table of its states, and I will not be using the zero state,  which is the bottom row in the table.

Basically, the priority encoder just gives us the BCD number of the switch, plus a positive or negative signal EO/GS when a switch is thrown. which is connected to the interrupt pin, and in this case is pin 2 hence the name isr2. Depending on what my oscilloscope says I might need to use a Schmitt Trigger on each of the inputs, and most likely another  Schmitt Trigger on ether the EO or GS line.

 

 

Interrupt code

// pins 30, 31, 32 are A, B, C respectively

volatile retval;  // This value is used in another function;

 

void isr2{

A = digitalRead (30);

B = digitalRead (31);

C = digitalRead (32);

A << 1;

A =+ B;

A << 1;

retval = A;

}

E! 0 1 2 3 4 A2 A1 A0 EO GS
L X L H X L L H H H L
L X X X L H H L L H L
L X X L H H H L H H L
L X L H H H H H L H L
L L H H H H H H H H L
  • Sign in to reply
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