Thread: Dragon Board Serial Monitor C Programming menu

  1. #1
    Registered User
    Join Date
    Apr 2014
    Posts
    2

    Question Dragon Board Serial Monitor C Programming menu

    I am working on my senior project and my currect task is to make a menu. I dont know what the best way to do it. i really do need assistance. my code is not complete and i am completely lost. code found below:

    Code:
    #include <hidef.h> /* common defines and macros */#include "derivative.h" /* derivative-specific definitions */
    #include "lcd.h"
    
    
    #include<menu.h> 
    void main(void) {
    char *msg1 = "Menu";
    char *msg2 = "Alarm ON";
    char *msg3 = "Alarm 1";
    char *msg4 = "Snooze Enable";
    char *msg5 = "Alarm Type";
    char *msg6 = "Standard";
    char *msg7 = "Cognitive";
    char *msg8 = "Lamp Only";
    char *msg9 = "Lamp at Alarm";
    char *msg10 = "Alarm Set";
    char *msg11 = "Display Color";
    char *msg12 = "White";
    char *msg13 = "Blue";
    char *msg14 = "Red";
    char *msg15 = "Green";
    char *msg16 = "Clock";
    char *msg17 = "Manual";
    char *msg18 = "Automatic";
    char *msg19 = "Time Zone";
    char *msg20= "DST";
    char *msg21= "Eastern";
    char *msg22= "Central";
    char *msg23= "Mountain";
    char *msg24= "Pacific";
    char *msg25= "Lamp Enabled";
    char *msg26= "Yes";
    char *msg27= "No";
    char *msg28= "On";
    char *msg29 = "Off";
    char *msg30= "Sync Now";
    char *msg31= "Hour";
    char *msg32= "Min";
    char *msg33= "Alarm 2";
    openlcd(); // Initialize LCD display
    
    
     DDRA = 0;
     
     
     if( PORTA = 2 && 4)
     
     goto  MENU ;
     
    
    
    
    
     MENU:
     
        puts2lcd(msg1);
        
        put2lcd(0xC0,CMD);  //NEXT LINE ON LCD
     
        puts2lcd(msg3) ;
        
        if (PORTA == 8)  // 4th button
    {
          openlcd();
        goto ALARM1;
        
    }
        if ( PORTA == 4)  // 3rd button //
         
         {
          
        
        
        
        puts2lcd(msg1);
        
        puts2lcd(msg33) ;
         } 
         
         else (PORTA == 8)  // 4th button
    ;    {
          
        goto ALARM2;
        
        }
        
        MENU *my_menu
        
        
         
        
        
     
        
     ALARM1:
     
     openlcd();
     
     
     
      
     
     puts2lcd(msg3); // PUT MESSAGE ON BOARD
     
     put2lcd(0xC0,CMD);  //NEXT LINE ON LCD
     
     puts2lcd(msg4);
     
        
    }
    
    
    
    
        
     ALARM2:
     
     openlcd();
     
     
     
      
     
     puts2lcd(msg33); // PUT MESSAGE ON BOARD
     
     put2lcd(0xC0,CMD);  //NEXT LINE ON LCD
     
     puts2lcd(msg4);
     
        
    }

    here is the pseudo code:



    Menu
    1. Alarm On
    a. Alarm 1 On/Off
    b. Alarm 2 On/Off
    2. Alarm 1
    a. Snooze enable
    i. Yes
    ii. No
    b. Alarm type
    i. Standard
    ii. Cognitive
    iii. Lamp only (if enabled)
    c. Lamp at Alarm
    i. Yes
    ii. No
    d. Alarm Set
    i. Hr
    ii. Min
    3. Alarm 2
    a. Snooze enable
    i. Yes
    ii. No
    b. Alarm type
    i. Standard
    ii. Cognitive
    iii. Lamp only (if enabled)
    c. Lamp at alarm
    i. Yes
    ii. No
    d. Alarm Set
    i. Hr
    ii. Min
    4. Display Color
    a. White
    b. Blue
    c. Red
    d. Green
    5. Clock
    a. Set
    i. Manual
    1. Hr
    2. Min
    3. 24Hr/AM/PM
    ii. Automatic
    1. On/Off
    2. Sync now
    b. Time Zone
    i. Eastern
    ii. Central
    iii. Mountain
    iv. Pacific
    c. DST
    i. Yes
    ii. No
    6. Lamp Enabled
    a. Yes
    b. No

  2. #2
    TEIAM - problem solved
    Join Date
    Apr 2012
    Location
    Melbourne Australia
    Posts
    1,907
    The best way to do make a menu is by using switch statements.

    i.e. Wait for input, put input into switch statement

    In that case you can have another switch statement for any submenus
    Fact - Beethoven wrote his first symphony in C

  3. #3
    Registered User
    Join Date
    Apr 2014
    Posts
    2
    I thought of using a case but my fear is with a dragon board and my project allows for limited inputs options(5). if there is an option to make a case with using only 5 inputs please give an example.

  4. #4
    misoturbutc Hodor's Avatar
    Join Date
    Nov 2013
    Posts
    1,787
    Your pseudocode isn't pseudocode...

  5. #5
    TEIAM - problem solved
    Join Date
    Apr 2012
    Location
    Melbourne Australia
    Posts
    1,907
    Quote Originally Posted by Matthew Wiener View Post
    I thought of using a case but my fear is with a dragon board and my project allows for limited inputs options(5)
    What?


    Quote Originally Posted by Matthew Wiener View Post
    if there is an option to make a case with using only 5 inputs please give an example.
    A switch statement can have as many cases as you want (or rather, as many as you can fit in memory)
    Fact - Beethoven wrote his first symphony in C

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 04-08-2011, 06:26 AM
  2. Serial Port Monitor Control Signals Changes
    By s_Fanous in forum Linux Programming
    Replies: 5
    Last Post: 04-19-2008, 07:02 AM
  3. How to kill a dragon with various programming languages
    By g4j31a5 in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 10-01-2007, 12:13 PM
  4. Serial Programming
    By gvector1 in forum Networking/Device Communication
    Replies: 3
    Last Post: 07-16-2003, 06:32 PM
  5. Serial programming
    By stovellp in forum C++ Programming
    Replies: 6
    Last Post: 01-20-2003, 12:29 PM

Tags for this Thread