element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • 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: Fuel Load Meter: Revised Plan of attack-UPDATE
  • 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 2023 12:37 AM Date Created
  • Views 774 views
  • Likes 4 likes
  • Comments 2 comments
  • flight simulator
  • nexgen
  • diy hardware
  • diy cockpit
  • mcp23017
  • arduino mega 2560
  • kicad
  • arduino leonardo
  • RS232 Module
  • softwareSerial
  • spi-can module
Related
Recommended

NexGen: Fuel Load Meter: Revised Plan of attack-UPDATE

phoenixcomm
phoenixcomm
1 Jan 2023

imageBlond Moment
Ok, Boy Blond Moment Strikes Again: if you remember I used a CANbus Module hooked up via an I2C bus. But Wait nope it's the SPI bus.  And the 2 switches in my diagram showed them hooked up to Digital Pins directly, even though they will have to be debounced with a Schmitt Trigger and an R/C network before they get to the CPU.  Now back to the silliness of 'Who's on First'. I need to prioritize which of the five (5) states the switches are in. If I take the output of the two switches and send the 4 lines to the input of a priority encoder, this gives me 000, 001, 010, 011, and 100 as outputs plus I also get GS as well. E0 which is low when one of the inputs goes low. To prevent an output in the zero state, the 0 input pin is pulled up via 5v. Now E0 will only go low during a low, which goes to an interrupt pin on the processor. BTW, please don't ask me why I did not use software debouncing. It just eats CPU time, and I don't like to waste it. 
Below I have included an abbreviated Function Table for a 74xx148, and a schematic of the switches and the logic for them. I used imageto do the schematic and the custom switch.

Abbreviated Function Table 74xx148

INPUTS OUTPUTS
EI 1 2 3 4 A2 A1 A0 EO
H X X X X H H H H
L H H H H H H H H
L H H H L L H H L
L H H L H H L L L
L H L H H H L H L
L L H H H H H L L
Note: inputs 0, 5, 6, 7 are pulled up +5v;
pin EI is pulled down to ground.
imageimage

Here is an UPDATED Wiring Plan.

Wiring Plan
Arduino Mega IO Modules Arduino Leonardo Instrument Head
mnemonic pin mnemonic pin mnemonic pin mnemonic pin
SI ICSP.10 SI
SO ICSP.11 SO
SCK ICSP.9 SCK
DIO.0.x 13 CS
INT1 2 INT
DP 12 RST1
DP 11 RST2
DP 10 CE1
DP 9 CE2
DP 8 CLK1
DP 7 CLK2
DP 6 RD1
DP 5 RD2
DIO.I.13 13 See Logic Diagram FILL J1.1
DIO.I.12 12 See Logic Diagram TEST J1.6
DIO.I.11 11 See Logic Diagram UP J1.2
INT5 21 See Logic Diagram DOWN J1.7
VCC VCC VCC
GND GND GND
RS232
TX1 18 RX 0
RX1 19 TX 1
VCC VCC
GND GND
RS232
TX TX
RX RX
VCC VCC
GND GND
I2C - CAN Module
INT5 INT J1.1
SCK SCK J1.2
SI SI J1.3
SO SO J1.4
DIO.O.x CS J1.5
GND GND J1.6
VCC VCC J1.7

Notes:

  • I will be adding and or changing pin numbers as I go along.
  • I will add the values for the RC circuit. TDB

Updates:

  • 1/1/23: I surrounded the 74xx148 table and the logic Diagram with a table to get them to look correct.
  • 1/1/23: I took out 6 <br> between the new table and the Wiring Plan Table.  
  • 1/1/23: I had to add one line in the Wiring Plan to include SCK - SCK which goes to the MC23017 from the Laerdeno the line has been underlined.
  • 1/1/23: I am getting the SI, SO, SCK from the ICSP connector. 
  • 11/4/23: Can't even spell blond.. LOL
  • 11/4/23: Added why I don't like software debouncing. 

Parts List:

Ref Description Part Number Manufacture Quantity
S1 Switch-Supplied DPDT-centerOFF 8856K12 1
S2 Switch-Supplied DPDT-centerOFF 8869K11X 1
J1,2 Connector, DB9 Female Crimp L177RRE09SVF
Pins Pins, Crimp for D-sub connectors 16
R1 Resistor Pack
R2, 3, 4, 5 Resistor*
R6 Resistor
C1, 2, 3, 4* Capacitor
  • Sign in to reply
  • phoenixcomm
    phoenixcomm over 2 years ago in reply to DAB

    Dab I have no idea what came over me. LOL  old and blond!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB over 2 years ago

    Nice fix.

    • Cancel
    • Vote Up 0 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 © 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