Results 1 to 10 of 10
  1. #1
    10+ Posting Member
    Join Date
    Feb 2013
    Location
    Brisbane
    Posts
    11
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    LCD help for a noob please

    Hello All,
    This is my first post, so Hello to all !!!
    A bit about me, I have built and flown my own aircraft a Vans RV7A, and have been around Australia in it.
    Im now looking at building a scale 737NG sim
    I have looked at all 5 pages here about Link2FS, and have not found many example files to help me along.
    I have 2 Arduino megas and im working on a 4x20 HD44780
    I have only been able to do this so far.

    /*
    LiquidCrystal

    LCD Pin Symbol Function Arduino Pin
    1 Vss ground (0 V) ground (0 V)
    2 Vdd power (4.5 5.5 V) +5V
    3 Vo contrast adjustment 9
    4 RS H/L register select signal 12
    5 R/W H/L read/write signal ground (0 V)
    6 E H/L enable signal 11
    11 DB4 H/L data bus for 4-bit mode 5
    12 DB5 H/L data bus for 4--bit mode 4
    13 DB6 H/L data bus for 4-bit mode 3
    14 DB7 H/L data bus for 4-bit mode 2

    // include the library code:
    #include

    // initialize the library with the numbers of the interface pins
    LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

    void setup() {
    // declare pin 9 to be an output:
    pinMode(9, OUTPUT);
    analogWrite(9, 50);
    // set up the LCD's number of columns and rows:
    lcd.begin(20, 4);
    // Print a message to the LCD.
    lcd.setCursor(2,0); // Position cursor
    lcd.print("comm1"); // Print a message to the LCD
    lcd.setCursor(2,1);
    lcd.print("comm2");
    lcd.setCursor(2,2);
    lcd.print("ADF");
    lcd.setCursor(2,3);
    lcd.print("TXPDR");


    }

    void loop() {
    // set the cursor
    lcd.setCursor(9, 0);
    // print the number of seconds since reset:
    lcd.print(millis()/1000);
    lcd.setCursor(9, 1);
    // print the number of seconds since reset:
    lcd.print(millis()/500);
    lcd.setCursor(9, 2);
    // print the number of seconds since reset:
    lcd.print(millis()/250);
    lcd.setCursor(9, 3);
    // print the number of seconds since reset:
    lcd.print(millis()/100);
    }

    What i would like if some kind person could post some code to read FSX radio freq and display it in my 4x20 instead of the counter I now use.
    I have some serial LCD in the post from china, should have them soon I hope.
    Any help would be great.

    thanks
    jamie

  2. #2
    150+ Forum Groupie
    Join Date
    Apr 2011
    Location
    United States of America
    Posts
    232
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: LCD help for a noob please

    Hope this gets you started:


    #include
    int Vcc = 31;
    int Gnd = 30;
    int DWrite = 34;
    String inData;


    String comRad;
    String navRad;
    int j1;
    LiquidCrystal lcd(33, 35, 40, 41, 42, 43);


    void setup() {
    pinMode(Vcc, OUTPUT); digitalWrite(Vcc, HIGH);
    pinMode(Gnd, OUTPUT); digitalWrite(Gnd, LOW);
    pinMode(DWrite, OUTPUT);
    pinMode(36, OUTPUT);
    pinMode(37, OUTPUT);
    pinMode(38, OUTPUT);
    pinMode(39, OUTPUT);

    pinMode(44, OUTPUT); digitalWrite(44, LOW);
    pinMode(45, OUTPUT); digitalWrite(45, LOW);

    Serial.begin(115200);
    lcd.begin(40, 2);
    } //End setup


    void loop() {
    if (Serial.available() > 0) {
    j1 = Serial.read();
    if (j1 == 'd'){comRad = "com1"; comms();}
    if (j1 == 'e'){comRad = "com1sb"; comms();}
    if (j1 == 'h'){navRad = "nav1"; navs();}
    if (j1 == 'i'){navRad = "nav1sb"; navs();}
    } //End if (Serial.available() > 0)
    } //End void loop


    void comms(){
    for (int i = 0; i < 7; i++) {delay(11); inData += (char) Serial.read();}
    if (comRad == "com1"){lcd.setCursor(0,1); lcd.print (inData);}
    if (comRad == "com1sb"){lcd.setCursor(8,1); lcd.print (inData);}
    inData = "";
    }// End comms radio reads


    void navs(){
    for (int i = 0; i < 6; i++) {delay(11); inData += (char) Serial.read();}
    if (navRad == "nav1"){lcd.setCursor(0,0); lcd.print (inData);}
    if (navRad == "nav1sb"){lcd.setCursor(8,0); lcd.print (inData);}
    inData = "";
    } // End nav radio reads

  3. #3
    10+ Posting Member
    Join Date
    Feb 2013
    Location
    Brisbane
    Posts
    11
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: LCD help for a noob please

    Thanks JMeller,
    I had to put #include "LiquidCrystal.h" in to get it to Verify.
    Also this LiquidCrystal lcd(33, 35, 40, 41, 42, 43); I dont see these pins in the void setup ? Are they RS/E/DB4/DB5/DB6/DB7
    If you could comment these for me please.
    More reading .....

  4. #4
    150+ Forum Groupie
    Join Date
    Apr 2011
    Location
    United States of America
    Posts
    232
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: LCD help for a noob please

    The LCD library declares them for you; saves ya some steps.
    Also, since you are working with the Mega and Link2FS, the library on this page may interest you:
    http://www.mycockpit.org/forums/ardu...tml#post138464

  5. #5
    10+ Posting Member
    Join Date
    Feb 2013
    Location
    Brisbane
    Posts
    11
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: LCD help for a noob please

    Quote Originally Posted by JMeller View Post
    The LCD library declares them for you; saves ya some steps.
    Also, since you are working with the Mega and Link2FS, the library on this page may interest you:
    http://www.mycockpit.org/forums/ardu...tml#post138464
    Syntax
    LiquidCrystal LCD(rs, enable, d4, d5, d6, d7)
    LiquidCrystal LCD(33, 35, 40, 41, 42, 43)
    your code rs=pin33, enable = pin 35, d4=pin 40, d5 = pin 41, d6 = pin 42, d7 = pin 43 on my mega ? as with my code they are in LiquidCrystal lcd(12, 11, 5, 4, 3, 2) all i need to do is change the pins ?

  6. #6
    10+ Posting Member
    Join Date
    Feb 2013
    Location
    Brisbane
    Posts
    11
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: LCD help for a noob please

    Ok i sorta got it working.
    I did have to change liquidcrystal lcd (x,x,x,x,x,x) to the correct pins on my mega. i ended up with ( 7,6,5,4,3,2 )
    I also changed the two 16 to 69, and removed // to suit a mega 1111111111111111111111111111111111
    i start up link2fs and fsx, connect I can see if i change freq on a radio, the numbers change in link2fs, however my lcd only shows
    Hi_from_Jim___");
    "Waiting_for_data"

    anyone help me ?

    In the monitor i can see in the "to card"
    =A128.300=B128.600=C127.800=D127.900=E113.70=F117.20=G110.60=H116.80=I0284.0=J1200
    getting closer.....

    P.S im using pde_inout_v4.pde

  7. #7
    500+ This must be a daytime job Jim NZ's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    764
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: LCD help for a noob please

    Good one Jamie ,, your getting closer all right.
    Probably the best thing to do is just wire up you hardware exactly the same as in the picture ,, don't change anything in my PDE (INO) except "lcd.begin(40, 2);" and it should work.
    You will be running the Mega as a Uno but at least it will be running ,, and from there you get adventurous and start changing things to suit what you want it to do.

    Then start playing with cursor position and the extractions etc.

    A neat learning curve doing it that way.

    Good luck ,, Jim
    www.jimspage.co.nz/intro.htm
    All this and Liz still loves me ! !

  8. #8
    10+ Posting Member
    Join Date
    Feb 2013
    Location
    Brisbane
    Posts
    11
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: LCD help for a noob please

    In the monitor page, I get lots of " To card " data, like when i change freq on a radio. I get nothing in the " From card " could this be why im stuck on " waiting for data "
    Jim, I have it now wired as in the diagram ( accept I have no switches )
    The only code I changed is what you comment //
    3 things to change,,,
    where it says <= 19 change that to read <= 69 (on 2 lines)
    also,,
    stringoldstate = "1111111111111111 etc" you need to have the appropriate one active.

  9. #9
    10+ Posting Member
    Join Date
    Feb 2013
    Location
    Brisbane
    Posts
    11
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: LCD help for a noob please

    My com port is 3 for my setup, What i failed to do was press the save all settings button as the com port went back to com1.
    Eureka !!!!
    it works now, but I have to go to work 8-(


  10. Likes JMeller liked this post
  11. #10
    500+ This must be a daytime job Jim NZ's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    764
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: LCD help for a noob please

    I knew you would get it Jamie ,,, no wonder so many of us Kiwi's jump the ditch every year to help you Guys out
    The adventure now begins for ya.

    See ya ,,, Jim
    www.jimspage.co.nz/intro.htm
    All this and Liz still loves me ! !