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: Fuel Load Indicator: It's Alive? (software testing)
  • 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 3:34 AM Date Created
  • Views 557 views
  • Likes 2 likes
  • Comments 2 comments
  • flight simulator
  • nexgen
  • arduino mega 2560
  • fuel load indicator
  • diy_cockpit
  • software
Related
Recommended

NexGen: Fuel Load Indicator: It's Alive? (software testing)

phoenixcomm
phoenixcomm
22 Dec 2020


Header Pins Mapping to Arduino Megaimage

 

Header
Pins

Color Signal Mega Pins Header
Pins
Color Signal Mega Pins Pins.h

pinModes.h

1 RED Power Ext 30 BLACK Ground
Ext


#define INT5 5

 

#define SDA 20
#define SCL 21

 

#define CE1 44

#define CE2 36

#define CLK1 33

#define CLK2 34

#define CLS1 41

#define CLS2 37

#define FL1 46

#define FL2 45

#define RD1 35
#define RD2 43

#define RST1 32

#define RST2 47

#define WR 42

#define MISO 50
#define MOSI 51
#define SCLK52
#define CS 53

 

 

 

 

 

pinMode (INT5, INPUT);

 

pinMode (CE1, OUTPUT);

pinMode (CE2, OUTPUT);

 

pinMode (CLS1, OUTPUT);

pinMode (CLS2 OUTPUT);

 

pinMode (FL1, OUTPUT);

pinMode (FL2, OUTPUT);

 

pinMode (RD1, OUTPUT);

pinMode (RD2, OUTPUT);

 

pinMode (RST1, OUTPUT);

pinMode (RST2, OUTPUT);

 

pinMode (WR, OUTPUT);

 

pinMode (MISO, OUTPUT);

pinMode (MOSI, INPUT);

pinMode (SCLK, OUTPUT);

pinMode (CS, OUTPUT);

2 n/a n/a 29 WHITE Ground Ground
3 Blue RST1 47 28 Red RST1 32
4 Green FL! 46 27 Orange CLK1 33
5 Yellow FL2 45 26 Yellow CLK2 34
6 Orange CE1 44 25 Green RD1 35
7 Red RD2 43 24 Blue CE2 36
8 Brown WR 42 23 Purple CLS2 37
9 Green CLS1 41 22
10
11 20
12 19
13 18
14 17
15 16
I2C
BUS
Yellow SDA 20 Orange SCL 21
CAN
BUS
Red MISO
SO
50 Orange MOSI
SI
51
Yellow SCLK
SCK
52 Green SS
CS
53

This has been a huge pain in the rear, too, too many jump wires. The only thing that I could trust was the Header Pins as defined in the blog Rexdux v2.  So  I gripped and ripped the pins on the Mega and started over.  Below is the current revolution. First I reserved pins 53 - 50 for the CAN interface. Then I put in the stuff from the header 1-9 to the Mega starting at pin 47. Pins 20 and 21 are reserved for the I2C bus.  Pin 5 is the Interrupt for the CAN module. Pins 8 to 11 are the Front Panel Switch inputs.

The Code Base

#include <Pins.h>

char lowerBufer[8];

char upperBuffer[8];

 

int tanksMax = 8;

int tankCur =1;

 

setup () {

//Initialize serial and wait for port to open:

  Serial.begin(9600);

  while (!Serial) {

    ; // wait for serial port to connect. Needed for native USB

  }

Wire.begin();

// i2c expander = MCP23017

// We set port A to outputs, we use:

// This will be used for the Address Bus AB0 - AB4

Wire.beginTransmission(0x20);

Wire.write(0x00); // IODIRA register

Wire.write(0x00); // set all of port A to outputs

Wire.endTransmission();

 

 

// Then to set port B to outputs, we use:

// This will be used for the Data Bus DB0 - DB7

Wire.beginTransmission(0x20);

Wire.write(0x01); // IODIRB register

Wire.write(0x00); // set all of port B to outputs

Wire.endTransmission();

#include "pinModes.h"

 

resetDisplay( UPPER );

resetDisplay( LOWER );

}

void loop() {

  

}

void writeDisplay(int Display, char Data, int Address) {

     // set address on expanders A port

      

          switch ( Display ) {

          case 1:

              delay(1);

              digitalWrite(CE_U, LOW);

              delay(1);

              digitalWrite(WR, LOW);

              delay(1);

              digitalWrite(WR, HIGH);

              delay(1);

              digitalWrite(CE_U, HIGH);

              break;

           case 2:

              delay(1);

              digitalWrite(CE_L, LOW);

              delay(1);

              digitalWrite(WR, LOW);

              delay(1);

              digitalWrite(WR, HIGH);

              delay(1);

              digitalWrite(CE_L, HIGH);

              break;

          delay(1);  }}

  • Sign in to reply

Top Comments

  • DAB
    DAB over 4 years ago +2
    It is always a good day when you bring something to life. DAB
  • phoenixcomm
    phoenixcomm over 4 years ago in reply to DAB +1
    Still Not alive! but I'm not throwing out the bathwater. ~~Cris
  • phoenixcomm
    phoenixcomm over 4 years ago in reply to DAB

    Still Not alive! but I'm not throwing out the bathwater.

    ~~Cris

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB over 4 years ago

    It is always a good day when you bring something to life.

     

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