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 Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • 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
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • 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: CP-1252: Front Panel Switches, Interrupts!! 2-level
  • Blog
  • Documents
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: phoenixcomm
  • Date Created: 1 Jan 2020 10:04 PM Date Created
  • Views 298 views
  • Likes 2 likes
  • Comments 0 comments
  • flight simulator
  • nexgen
  • cp-1252/asn-128
  • diy software
  • arduino
  • arduino mega
  • 2 level interrupts
Related
Recommended

NexGen: CP-1252: Front Panel Switches, Interrupts!! 2-level

phoenixcomm
phoenixcomm
1 Jan 2020

image

OK, last time I might have confused you with 2-level interrupts. So here it is and please refer to the schematic. So here's how it works. In this diagram, you see 4 switches 2 rotary and 2 thumbwheel switches.  You will notice that each of the two rotary switches are inputs to 8 to 3 priority encoders and 8 input NAND gates aswell. And the Thumbwheel switches do not have them as they already have BCD outputs. So we can just use their raw outputs.  Also, the Thumbwheel switches are also inputs to 4 input NAND gates as well. That gives us our four interrupt levels which then goes into another 8 to 3 priority encoder which will give us the interrupt number. But I am getting ahead of you. So we use another 4 input NAND gate followed by an R/C network, for signal conditioning, and a Schmitt trigger which gives you a hard interrupt on your CPU. Basically for each of these interrupts, you only use one (1)  interrupt pin, but the downside it will take six (6) to seven (7) bitWrite instructions.  So these are the outputs:

  1. NA (000)  = Never should get this so it's pulled up. (default)
  2. Mode Switch  (001)    = 1 = ISR1
  3. Display Switch (010)  = 2 = ISR2
  4. Thumbwheel 1 (011)    = 3 = ISR3
  5. Thumbwheel 2 (100)   = 4 = ISR4                   

Please remember that this schematic will NOT work as is, as there are no Vcc or Grounds or pull up resistors etc.  

 

image

int ISR_A = 50;

int ISR_B = 49;

int ISR_C = 48

int DSw_A = 47;

int DSw_B = 46;

int DSw_C = 47;

 

int ISR = 19;                // ISR

int ISR_Rcv = 20;        // ISR Network Recvice

int ISR_Tx  =  21;        // ISR Network Transmit

int ISR_Dsp = 22;        // ISR Display Timer

int ISR_Kbd = 23;        // ISR Keyboard

int ISR_Dsp = 24;        // ISR Switches

int DisplaySw_Value = 0;

attachInterrupt (digitalPinToInterrupt (ISR), getDisplaySwitch, mode);

// INERRUPT SERVICE ROUTINE

void getISRnumber() {

    int ISR_Value = 0;

    int DisplaySw_Value = 0;

      biteWrite ( ISR_Value, 0, digitalRead ( ISR_A ));

      biteWrite ( ISR_Value, 1, digitalRead ( ISR_B ));

      biteWrite ( ISR_Value, 2, digitalRead ( ISR_C ));

      switch ( ISR_Value ) {

          case 1: {

               biteWrite ( DisplaySw_Value, 0, digitalRead (DSw_A ));

               biteWrite ( DisplaySw_Value, 1, digitalRead ( DSw_B ));

               biteWrite ( DisplaySw_Value, 2, digitalRead ( DSw_C ));

               break; }

          case 2: {

                getModeSwitch ();

                break; }

          case 3: {

                 getTWheelSwitch_1 ();

                 break; }

          case 4: {

                 getTWheelSwitch_1 ();

                 break; }

          default () { // Error To Be Determind.

                    }}

  • 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 © 2025 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