//TU480A.MNU Menu file for TU480X272C with single red pen. //////////// // Files // //////////// LIB(backg,"SDHC/image2.bmp?back=\\ffffff"); //Load the graph axis image LIB(asc16,"SDHC/asc_16b.fnt"); //Load the Ascii size 16 font ////////////// // Styles // ////////////// STYLE(BlackPg, Page) { back=white; update=changed; } //white background STYLE( CText, Text ) { font=asc16; col=black; maxLen=64; maxRows=1; curRel=CC; } //Center aligned text style STYLE( LText, Text ) { font=asc16; back=white; col=black; maxLen=64; maxRows=1; curRel=LC; } //Left aligned tezt style STYLE( RText, Text ) { font=asc16; col=black; maxLen=64; maxRows=1; curRel=RC; } //right aligned text style STYLE(Box,DRAW){type=box; back=white; col=black; width=1; maxX=480; maxY=272; curRel=LC; } //White box black border style STYLE(graphst,DRAW){type=t; back=\\eeeeee; col=\\ff0000; width=3; maxX=480; maxY=272; curRel=CC; } //red pen for graph STYLE(box1St,draw){type=box;maxX=30;maxY=30;col=black;back=\\ff0000;width=2;} //Red colour box STYLE(box2St,draw){type=box;maxX=30;maxY=30;col=white;back=\\00ff00;width=2;} //Green colour box STYLE(box3St,draw){type=box;maxX=30;maxY=30;col=white;back=\\0000ff;width=2;} //Blue colour Box STYLE(stGenImg,Image) {curRel=TL;} ////////////// // Setup // ////////////// SETUP( adc ){active=1; calib1=0.194; avg1=8; } //Setup of the adc port ///////////////// // Variables // ///////////////// VAR(varADC1,0,U16); //Variable to store current ADC value VAR(PixXVal,1,U16); //Variable storing x value along graph VAR(CurVal,40,FLT2); //Variable containing the Current Voltage VAR(CurValT,"",TXT); //Variable to show current voltage as text VAR(MaxVal,0,FLT2); //Variable containing Max Voltage VAR(MaxValT,"",TXT); //Variable to show Max Voltage as text VAR(MinVal,194,FLT2); //Variable containing Min Voltage VAR(MinValT,"",TXT); //Variable to show Min Voltage as text //////////// // Page // //////////// PAGE(GraphPage,BlackPg) { POSN(239,10); TEXT(TitleT,"ADC1 Graph Application",CText); //Title of application POSN(216,263);TEXT(XAL,"Seconds",CText); //Label along X axis POSN(57,248); TEXT(XA0,"0",CText); //Label along X axis POSN(162,+0); TEXT(XA1,"1",CText); //Label along X axis POSN(267,+0); TEXT(XA2,"2",CText); //Label along X axis POSN(373,+0); TEXT(XA3,"3",CText); //Label along X axis POSN(46,15); TEXT(YAL,"Volts",RText); //Label along Y axis POSN(+0,236); TEXT(YA5,"0",RText); //Label along Y axis POSN(+0,187); TEXT(YA4,"0.8",RText); //Label along Y axis POSN(+0,136); TEXT(YA3,"1.6",RText); //Label along Y axis POSN(+0,87); TEXT(YA2,"2.4",RText); //Label along Y axis POSN(+0,36); TEXT(YA1,"3.2",RText); //Label along Y axis POSN(390,38); DRAW(MaxBox,80,25,Box); //Maximum Box POSN(+5,+0); TEXT(MaximumT,"Maximum",LText); //Maximum label POSN(+0,+26); TEXT(MaximumV,"",LText); //Maximum text value POSN(-5,96); DRAW(MinBox,75,25,Box); //Minimum Box POSN(+5,+0); TEXT(MinimumT,"Minimum",LText); //Minimum Label POSN(+0,+26); TEXT(MinimumV,"",LText); //Minimum text value POSN(-5,154); DRAW(CuBox,75,25,Box); //Current Box POSN(+5,+0); TEXT(CurrentT,"Current",LText); //Current Label POSN(+0,+26); TEXT(CurrentV,CurValT,LText); //Curernt text value POSN(-5,212); DRAW(RsBox,75,25,Box); //Reset Button POSN(+5,+0); TEXT(ResetT,"Reset",LText); //Reset Label POSN(427,+0); KEY(ResetK,[LOAD(PixXVal,1);RESET(MyGraphRed);RUN(MaxVF,MinVF);],75,25,TOUCH); //REST Key and Function to reset graph POSN(402,250);DRAW(box1,28,28,box1St);KEY(key1,fnc1,28,28,TOUCH); //Change colour of graph to red box and key POSN(432,+0); DRAW(box2,28,28,box2St);KEY(key2,fnc2,28,28,TOUCH); //Change colour of graph to green box and key POSN(462,+0); DRAW(box3,28,28,box3St);KEY(key3,fnc3,28,28,TOUCH); //Change colour of graph to blue box and key POSN(217,133);DRAW(MyGraphRed,313,196,graphst); //Draw the graph area POSN(0,0); IMG(BackG,backg,stGenImg); LOOP(GraphLoop,FOREVER) { LOAD(varADC1,ADC1); //Load the current ADC value into the variable LOAD(CurVal,ADC1); //Load the current ADC value into the current cariable CALC(CurVal,CurVal,61.8,"/"); //Calculation to make value suitable for graph LOAD(CurValT,CurVal,"V"); TEXT(CurrentV,CurValT); //Load the variable into the text variable and add the units on the end IF(CurVal>MaxVal?MaxVF); //Maximum maximum value near top IF(CurVal307?[LOAD(PixXVal,1);RESET(MyGraphRed);RUN(MaxVF,MinVF);]:[CALC(PixXVal,PixXVal,4,"+");]);; //Move 4 pixels in x direction if less than 307 if not reset the graph } } SHOW(GraphPage); //Show Page ///////////////// // Functions // ///////////////// FUNC(MaxVF) {LOAD(MaxVal,CurVal);LOAD(MaxValT,MaxVal,"V");TEXT(MaximumV,MaxValT);} //Load the highest adc value into the maximum text FUNC(MinVF) {LOAD(MinVal,CurVal);LOAD(MinValT,MinVal,"V");TEXT(MinimumV,MinValT);} //Load the lowest adc value into the minimum text FUNC(fnc0) //function to turn all the colour change boxes borders to white { LOAD(box1St.col,white); //turn red boxes border to white LOAD(box2St.col,white); //turn green boxes border to white LOAD(box3St.col,white); //turn blue boxes border to white } FUNC(fnc1) { RUN(fnc0); LOAD(graphst.col,\\ff0000); LOAD(box1St.col,black); } //Changes graph trace to red and highlights selected colour box FUNC(fnc2) { RUN(fnc0); LOAD(graphst.col,\\00ff00); LOAD(box2St.col,black); } //Changes graph trace to greeen and highlights selected colour box FUNC(fnc3) { RUN(fnc0); LOAD(graphst.col,\\0000ff); LOAD(box3St.col,black); } //Changes graph trace to blue and highlights selected colour box