Author Topic: Simple menu navigation  (Read 10119 times)

CrArC

  • Newbie
  • Posts: 2
  • I'm a llama!
    • View Profile
Simple menu navigation
« on: January 08, 2006, 04:04:54 PM »
Hello there,
I'm a student and I've decided to try out a T100MD+888 as a potential controller for a colour sensor, but I'm confused and so I have a few questions before I can really get anywhere with it :)

Firstly, I need a crash course in creating simple menus! I intended to have just two buttons, OK and Cancel that doubled as One and Two for the odd multiple choice menu. The structure would be something like:

MAIN MENU: Calibrate or Sample? (input 1 or 2)
Input 1: goto calibration menu
Input 2: goto sampling menu

Within the calibration menu, Input 1 will just be used to cycle through the various stages until calibration is complete, with input 2 functioning as Cancel (return to main menu). In sampling, I would like to use Input1 as a pause button, with Input2 as a Cancel button once again.

The only thing is, I can't suss out how to get this to work at all :D my best attempt managed to get pressing Input 1 to take me to the calibrate menu and Input2 to the sampling menu, but pressing Input 1 would take me back to the beginning of the dCusfn on that circuit... (input1 & 2 I put on the first circuit, not sure if that's what's supposed to happen but the demo apps were quite similar).

Any pointers?

Also, for storing the readings from the sensor (an LDR on a potential divider to ADC1) should I be using "DM" table-things or storing the values to counters? Apologies if this all seems rather disjointed or unclear :)  

Menu displayed on a 4x20LCD (I know how to work that)... help much appreciated!

 

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:Simple menu navigation
« Reply #1 on: January 09, 2006, 12:02:08 PM »
You will need to use either a variable (in TBASIC) or a relay bit (in Ladder) to keep track of the "state" of the logic so that the same input button can react differently at different state of logic.

E.g. first press of input 1 can be used to latch a relay.


    IN1               RLY1
|---||--------------[Latch]

Now, if RLY1 is ON, then only CF1 is executed when IN1 is pressed again. Otherwise, only CF2 will be executed:

    IN1   RLY1         CF1
|---||----||--------{dCusF}
    IN2   RLY1         CF2
|---||----|/|-------{dCusF}


Alternatively, you can use only a single CF1 and then within CF1 you will test the logic state of RLY1 to decide what to do:


    IN1                  CF1
|---||---------------{dCusF]

Within CF1, has statements as follow:

   IF TESTIO(RLY1)  THEN
      ....
   ELSE
      ....
   ENDIF
 
« Last Edit: January 09, 2006, 12:06:55 PM by support »
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

CrArC

  • Newbie
  • Posts: 2
  • I'm a llama!
    • View Profile
Re:Simple menu navigation
« Reply #2 on: January 10, 2006, 09:09:48 AM »
Ah, that's worked a treat :) thankyou very much.