vlct tutorial

29
CHAPTER 4 The VLCT Concept It is special dedicated test equipment, which allows testing memory modules. VLCT means “very low cost tester”. This is because, testing is not considered lie a productive phase, but more lie an “e!pense” and is always under  pressure to reduce cost. The VL CT consists o" three ma#or components$ The worstation, the system power supplies, and the test head. The worstation is a %&' &ltras %parc installed in a main"rame (e!cept "or the terminal) with the system power supplies. The test head consists o" one to "our quadrants with up to *+ channels per quadrant. The  programming language "or the available VLCT is -%CL. /or speci"ications, please consult the VLCT 0ardware manual. VLCT Programming Environment The VLCT controller is an ultra sparc running the solaris &'I1 operating system. 2penwindows is the graphical user inter"ace (3&I) that creates windows to per"orm various tass ("ile management, sending4receiving mail, shells "or running other applications, etc.) 5asically, 2penwindows taes individual &'I1 commands and uses 1windows graphics to present them in a user6"riendlier environment. The tester &ser Inter"ace (T&I) is an application that is run "rom an 2penwindows shell. The T&I so"tware was written and is supported by TTC to allow communication with the VLCT Tester. There are two possible pin con"igurations, the +7* pin VLCT can currently be con"igured as VLCT +7* mode %ingle site, +7* pins 28 VLCT *+4*+ mode dual site, and *+ pins. Electrostatic Discharge (ESD) 5e"ore handling devices and4or using the VLCT Tester it is strongly recommended that you arrange to tae a course o" 9%: protection be"ore handling this devices. VLCT general test coverage The goal o" testing with very low cost equipment requires re6de"ining device test "lows to use measu remen ts and method s that can be impleme nted. Tra ditiona l tests may need to be modi"ied, narrowly de"in ed or elimina ted. /or the VLCT, the general test coverage is$ a) Continuity . -er 6pin with a loos e -;& mea sur ement.  b) I42 Leaage.6 -er6pin with a low current -;&. c) ICC. ;easu re d with a power sup ply . d) ICC<. ;e asu re d with a power sup ply . e) %low /u nction al. /un ctiona l patte rns r un by the system co ntrolle r. ") /ast /uncti onal. 2nly u sing device 5I%T and shared h igh6s peed clocs. g) :C -ar ame tric . &sing sh are d6r eso urc e -;&=s h) C - arame tric. &sing dedicated, shar ed h ardware. i) Charac ter i>at ion . -r obably not. The Performance oar! The VLCT per"ormance board is laid out as the Vseries *+6pin per"ormance board. translator bloc is available "or polaris board. This translator is the circular gold one board. 'ewer boards have been developed to allow more room "or per"ormance board circuitry ? one uses the same pogo pin bloc and another one allows even more e!tra room space with a di""erent pogo bloc Device Po"er S#pplies ;any :evices requires speci"ic power up and power down sequences (or shutdown sequence) to prevent damage to the device and ensure a proper operation. general -ower up sequence would be$ 7

Upload: abhishek-chugh

Post on 01-Jun-2018

222 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: VLCT tutorial

8/9/2019 VLCT tutorial

http://slidepdf.com/reader/full/vlct-tutorial 1/29

CHAPTER 4

The VLCT ConceptIt is special dedicated test equipment, which allows testing memory modules. VLCT means “very low cost tester”.This is because, testing is not considered lie a productive phase, but more lie an “e!pense” and is always under 

 pressure to reduce cost. The VLCT consists o" three ma#or components$ The worstation, the system power supplies,and the test head. The worstation is a %&' &ltras %parc installed in a main"rame (e!cept "or the terminal) with thesystem power supplies. The test head consists o" one to "our quadrants with up to *+ channels per quadrant. The programming language "or the available VLCT is -%CL. /or speci"ications, please consult the VLCT 0ardwaremanual.

VLCT Programming EnvironmentThe VLCT controller is an ultra sparc running the solaris &'I1 operating system. 2penwindows is the graphicaluser inter"ace (3&I) that creates windows to per"orm various tass ("ile management, sending4receiving mail, shells"or running other applications, etc.) 5asically, 2penwindows taes individual &'I1 commands and uses 1windowsgraphics to present them in a user6"riendlier environment. The tester &ser Inter"ace (T&I) is an application that isrun "rom an 2penwindows shell. The T&I so"tware was written and is supported by TTC to allow communication

with the VLCT Tester. There are two possible pin con"igurations, the +7* pin VLCT can currently be con"igured asVLCT +7* mode %ingle site, +7* pins 28 VLCT *+4*+ mode dual site, and *+ pins.

Electrostatic Discharge (ESD)5e"ore handling devices and4or using the VLCT Tester it is strongly recommended that you arrange to tae a courseo" 9%: protection be"ore handling this devices.

VLCT general test coverageThe goal o" testing with very low cost equipment requires re6de"ining device test "lows to use measurements andmethods that can be implemented. Traditional tests may need to be modi"ied, narrowly de"ined or eliminated. /or 

the VLCT, the general test coverage is$

a) Continuity. -er6pin with a loose -;& measurement. b) I42 Leaage.6 -er6pin with a low current -;&.c) ICC. ;easured with a power supply.d) ICC<. ;easured with a power supply.e) %low /unctional. /unctional patterns run by the system controller.") /ast /unctional. 2nly using device 5I%T and shared high6speed clocs.g) :C -arametric. &sing shared6resource -;&=sh) C -arametric. &sing dedicated, shared hardware.i) Characteri>ation. -robably not.

The Performance oar!The VLCT per"ormance board is laid out as the Vseries *+6pin per"ormance board. translator bloc is available"or polaris board. This translator is the circular gold one board. 'ewer boards have been developed to allow moreroom "or per"ormance board circuitry ? one uses the same pogo pin bloc and another one allows even more e!traroom space with a di""erent pogo bloc 

Device Po"er S#pplies;any :evices requires speci"ic power up and power down sequences (or shutdown sequence) to prevent damage tothe device and ensure a proper operation. general -ower up sequence would be$

7

Page 2: VLCT tutorial

8/9/2019 VLCT tutorial

http://slidepdf.com/reader/full/vlct-tutorial 2/29

:&T Vcc pin(s) to power supply @ wait "or stabili>ation.:&T Input pin(s) to driver pins.:&T 2utput pin(s) to receiver load.

The power down sequence will occur in reverse order. The VLCT so"tware does not directly de"ine a power 

up4down sequence. -rocedures must be de"ined in the test program to set any desired sequences and wait times. TheVLCT so"tware does not directly de"ine a power up4down sequence. -rocedures must be de"ined in the test programto set any desired sequences and wait times. lso, in the VLCT, there is no such thing as a disable power supply or device pin. :evice pins are either connected or disconnected, and power supplies must be programmed "or A Voltsand a small current to power down.

This is big di""erence between the VCLT so"tware and the 'I CVI so"tware, in the C language, you can de"ine power up4down subroutines and through a relay board you can disconnect any array o" test points or pogo pines. Thegilent power supplies and electronic loads allow to be turned o"" completely.

Contin#it$ TestingContinuity test are not device speci"ication tests. Continuity or opens and shorts, test "or two things$

• -arameters o" the 9lectrostatic :ischarge (9%:) :iodes.

• -ath connections "rom the Test set6up to the :&T pins.

&sually the continuity test is not run with stringent limits. To prevent wasting time on devices that have no chance o"  passing, the test is veri"ying that the :&T has woring 9%: diodes and electrical connection "rom the tester to the:&T pins. 9%: diodes are internal to the device and are used to protect :&T "rom circuitry "rom electrostaticdischarge voltage spies and inter"ace transients. There are two types o" 9%: diodes, Vcc and 3round.

The Vcc diodes are reverse bias connected "rom the :&T pin to a :&T power supply, and 3round diodes arereverse bias connected "rom :&T pin to ground. typical 9%: diode will have a "orward voltage o" appro!imatelyBA. volts at 7m

3eneral Continuity Test :escription$7. 3nd :iode$ pply 3nd to the :&T 3nd6pin.*. Vcc :iode$ pply AV to the :&T Vcc6-in.. Vcc :iode$ /orce 7m and measure voltage minD A.EV, ma! D A.F V.E. 3nd :iode$ /orce ? 7m and measure voltage min D 6 A.E V, ma! D 6A.FV

Pin Shorts%These VLCT continuity test methods only use single magnitude limit "or testing and can chec "or opens but not "or shorts at the same time. -in shorts testing are usually done with the pin -;&=s and #ust contains o" "orcing a smallvoltage and measuring "or e!cessive current.

LEA&A'E TEST'

np#t C#rrentInput current test are device speci"ication tests and veri"y the :&T inputs can be driven to a high and a low, whileconsuming no more than a speci"ied amount o" current.

'et nto the VLCT Soft"are%Gou will need a proper account in IC:L, contact the administrator "or it. t the moment that you own an account,use it to get access to the test so"tware by %ecure %hell. In %%0 you must type your password to connect with the

*

Page 3: VLCT tutorial

8/9/2019 VLCT tutorial

http://slidepdf.com/reader/full/vlct-tutorial 3/29

server IC:L.&-8;.9:& a"ter that you must type “VLCT” in the %%0 Hindow, then the "ollowing screen willappear in the screen$

Gou will see E windows, the most le"twindow show the menu available "or each mode. The center window will showyou the de"ault directory (contact your 

administrator "or an update), the upper window show an activity log. Gou canclose all windows e!cept the most le"twindow. The close action will be per"ormed with a clic in the labels“dismiss” and “continue”.

The messages window will be closedwith the “1” button locate in the top rightcorner 

Gou cannot close the “;essages”Hindow.

The most le"t window the VLC6LT you will note the command “"ile” a"ter select it, the "ollowing directory windowwill appear$

I" you press the “edit” command with the right mouse button, the edit window will appear$

In this window we will create and edit all the "iles thatwe will use to build our programs. The procedure touse, edit, create and compile them will be e!posedlater.

Page 4: VLCT tutorial

8/9/2019 VLCT tutorial

http://slidepdf.com/reader/full/vlct-tutorial 4/29

Hith a right mouse button clic in the “"ile”command o" the edit window you will "inda small menu with the "ile options, pleasenote that is not the same “save to dis” and“save to memory”.

 Is better use the “save to dis”. 'ote too,the directory where you are saving your "iles. lways use the same.

-lease chec with your networ administrator, the properties "or a networ  printer.

t the VLC6LT main menu window, you will see the “mode” option above all the commands buttons is used tochange the test mode o" the so"tware, with thesechanges some options are available and othersnot.

This "eature will enhance the program, this because the same program is used in the entire"actory by di""erent departments, production,test, design etcJ so each one requires a di""erentaccess level or di""erent options.

This is a standard "eature "or all test so"tware.

-ress the small button that is between the modeoption and the status label ("or de"ault this one is production). 5e"ore o" press it, the "ollowingscreen will appear$

This is the “mode” in which the user ise!ecuting the value o" the mode (production, maintenance, engineering and administration) determines whatoperations are available to the user. In production mode the user is allowed to per"orm any operation. Themaintenance mode and 9ngineering modes allow most but not all operations to be per"orm.

E

Page 5: VLCT tutorial

8/9/2019 VLCT tutorial

http://slidepdf.com/reader/full/vlct-tutorial 5/29

PASCAL Test Programming

The VLCT uses -ascal due TI starts the Test 9ngineering many years ago, the -%CL in that times were the pre"erred programming language. 'e!t is a common -ascal code$

-rogram e!ample7var innum$ integer

 beginread(innum)while(innum K MM) do

 begincase innum o" 7$ writeln (Ngoodbye=)*$ writeln (Nhello=)$ writeln (Nno good=)E$ writeln (Nno say=)otherwise writeln (Ndo over=)end

read (innum)end pause

end.

This little code is an e!ample, you will "ind that$

7) The program starts with a declaration.*) The variable declaration >one is de"ined with “var”) The main code starts with a “begin” and ends with a “end.”E) 8ead the value o" innum.+) Compare i" innum is di""erent to MM, true mae the cycle, "alse don=t mae de cycle and the program ends.) I" the cycle is per"ormed, will evaluate the value o" innum, "or each value, a label will be displayed in the

screen.

+

Variable declaration >one

-rogram starts

%tarts the main code

This is the control variable8eads the value o" innum, i" the value isdi""erent o" MM will per"orm the instructions

 between begin6end. In the case that innumhas the values o" 7 to E, a label will bedisplayed in the screen

9nd o" the program

Page 6: VLCT tutorial

8/9/2019 VLCT tutorial

http://slidepdf.com/reader/full/vlct-tutorial 6/29

Lie in the C language case, all the programs in -ascal will be a mi! o" classical -ascal synta!es and severalinstructions set "or control the test equipment.

The "ollowing e!ample is a -ascal test program$

;odule cloc"uncOpPinclude NQTG-9%=Pinclude Nvar.h=Pinclude Nutilities.h=

/unction CL2CRO/&'C $ 5oolean 9!portVar 

8esult$5oolean/req$Treal

5eginTest2pen( ClocTest )%upply%et( V::C, vSV::nom, +ma, %OI3I'O71, %O0ighOCurrO2ver8ide)%etup%elect( Cloc:C ) U"orces input high, connects cloc and counter :iscard( VoltageCompare2pt( %O:8V2' ) ) Uturns the drivers onHait( +ms )Cloc%et( %OCL2CR7, /alse, 7A;g0>, *.Fv, A.v )Cloc%tart/ree8un( %OCL2CR7 )Cloc%et/reqCounter( %O/89<C'T7 )Cloc%top/ree8un( %OCL2CR7 )

HriteLn(NTest read a "requency o"=, "req)I" (/reqE.+;g0>) and (/reqK+.+;g0>) Then8esult $D T8&9

9lse8esult $D /L%9

%etup%elect(-ower:own:C)%upply%et( V::C, Av, +ma, %OI3I'O71, %O0ighOCurrO2ver8ide )8esult8ecord( 8esult )CL2CRO/&'C $D 8esult

TestClose9nd

PR*'RA++' PASCAL%

%everal Instructions are in use "or Test %o"tware the most common are$

5egin49nd 8epeat6&ntil Import-ause /or6To 9!portHriteln4Hrite /or6:ownto &se%tring Case ;odule8ead -rocedure PIncludeI"6Then /unction P:e"ine

Page 7: VLCT tutorial

8/9/2019 VLCT tutorial

http://slidepdf.com/reader/full/vlct-tutorial 7/29

I"6Then69lse. TypeHhile6:o Var  

Lie in other languages, in -ascal there are Variables and Constants too. In all -ascal programs the “Constants” andvariables must be declared a"ter the program name is declared. variable it is a space memory identi"ied by a name,this space memory contains a value de"ined by the programmer, the value o" the variable can change many times inthe program, but always it will eep the same name. ll values to be stored in a same variable must be o" the sametype. type de"ines what ind o" a group the variable is (as we go on you=ll see there are character types (te!t), realtypes (decimal numbers), and 5oolean types (true and "alse). variable is declared by$

Varia,le name - t$pe.

Integers are positive and negative counting numbers (6, 6*, 67, A, 7,*,) so, a variable that is an integer type, canstore positive and negative counting numbers.

constant is a name given to a value that cannot be changed later in the program. The constant is declared by$

Constant name / val#e.

0a$s to Store val#es in Varia,les%

In -ascal E there are many ways to store values in variables$

 Direct Assignment:  'umber7 $D A

 'otice the use o" “$D” the e!pression is always assigned "rom right to le"t. %o, here we are saying the variable“number7” is to store the value >ero.

 Indirect Assignment: number7 $D sum

0ere, variable “number7” is to store the value that currently resides in “sum”. 'ote at this point we don=t now i" sum is a variable or a constant. lso note that only variable “number7” changes values, “sum” does not because weevaluate this e!pression "rom right to the le"t.

%o we have the "ollowing variables types$

a) 8eals b) Integers.c) Char  

d) 5oolean

8eals are numbers with decimals, could be positive or negative. Integers are number without decimals, could be positive or negative. Char are characters or characters chain stored in a variable, these characters will appear in thescreen. 5oolean are true and "alse logic values.

Logic *perations%

The logic operations are$

a) 'ot

W

Page 8: VLCT tutorial

8/9/2019 VLCT tutorial

http://slidepdf.com/reader/full/vlct-tutorial 8/29

 b) nd.c) 2r.

nd we use the "ollowing true tables to use the logic operations$

AD

Varia,le 1 Varia,le 2 Res#lt

True True True

/alse True /alse

True /alse /alse

"alse "alse /alse

*R 

Varia,le 1 Varia,le 2 Res#lt

True True True

/alse True True

True /alse True

"alse "alse /alse

*T

Varia,le 1 Res#lt

True /alse

"alse true

*T VARALE 1 AD VARALE 2 0TH A AD RES3LT

Varia,le 1 Varia,le 2 Res#lt

True True /alse

/alse True True

True /alse True

"alse /alse True

*T VARALE 1 *R VARALE 2 0TH A *R RES3LT

Varia,le 1 Varia,le 2 Res#lt

True True /alse

/alse True /alse

True /alse /alse

"alse "alse True

Gou can change, “true” "or number 7 and “"alse” "or a cero value. It is valid.

+athematical *perators%

F

Page 9: VLCT tutorial

8/9/2019 VLCT tutorial

http://slidepdf.com/reader/full/vlct-tutorial 9/29

The mathematical operators are$ (B, 6, D, 4, :IV, ;2:). Lie in another languages you are only allowed to per"ormany mathematical operations with the same variable type, you cannot per"orm a division with mi!ed variables types.

Comparison *perators%

The Comparison operators are$ (K , , D , K , D , KD ) and are used in i"6then statement and others.

  less than5  greater than/  equal to5  not equal to

5/ equal to or greater than/ equal to or less than.

ARRA6%2ne o" the most important point in a programming language is the array, an array is a space memory de"ined with 1 by G dimensions. /irst lets wor with a one6dimensional array. Xust "ollow the ne!t steps$

a) :e"ine the array. b) :eclare the variable.c) /ill the array.

/or e!ample, an one6dimensional array could be a matri! 7!7, vertical or hori>ontal. The only di""erence between both is which position will be always 7.

&ni6dimensional array o" 7 by $

Gou must de"ine this array in the ne!t way$

TG-9rrayOname D 88GS7..! o" type

Var rrayOvariable $ arrayOname

0ere is an e!ample, please note the comments ,et"een 7(89 an! 78)9 $

Program E:ample;arra$. (Yprogram declarationY)

T6PE (Ytype section where the user describes the set o" possible values and gives the set a name or a type

identi"ierY)

arrayOe!ample D 88GSE..M o" integer (Yhere the user declares an array "rom E to M integerY)

M

7

7 * E7

+

Page 10: VLCT tutorial

8/9/2019 VLCT tutorial

http://slidepdf.com/reader/full/vlct-tutorial 10/29

VAR  (YV8 eyword indicates the start o" variable declaration sectionY)

i$integer (Y declares variable “i” lie integerY)

store$arrayOe!ample (Y declare “store” lie an arrayY)

,egin (Yeyword used to start the main code Y)

<*R  i$D E T* M D* (Y starts a loop it will count "rom E to M at “i” and will e!ecute all

 belowY)egin (Ystarts the loop=s codeY)

writeln(Ninput an integer to "ill position=, i$*, Nin the array=) (Ywrites te!t in the screen and the

value o" “i”Y)

read(storeSi) (Ywaits "or the input "rom the user to be stored in “store”Y)

en!. (Yends the loopY)

<*R  i$D E T* M D* (Y starts a loop it will count "rom E to M at “i” and will e!ecute all

 belowY)

writeln(Nposition P N,i$7, ND=, storeSi$7) (Ywrites te!t and values o" “i” and “store”Y)

writeln(N=) (Y write a blan lineY)

-ause (Ypauses program e!ecution and later ends the programY)

En!%

This tiny program, de"ines an integer array in a si>e o" 7 by , it is no necessary start in one. Then, the programde"ines two variables$ integer and arrayOe!ample. Later, starts the code with the instruction “begin” and starst the"irst o" two cycles, the "irst cycle will as "or a value to be stored in each matri! cell, the second cycle will display inthe screen the value o" each matri! cell.

This is the output$

-8238; 919C&TI2' 89%&LT%$

Input an integer to "ill position E in the arrayInput an integer to "ill position + in the array*Input an integer to "ill position in the array+Input an integer to "ill position W in the array*EInput an integer to "ill position F in the array*7-osition P E D -osition P + D *

-osition P D +-osition P W D *E-osition P F D *7

YYY-&%9

7A

Single =#ote t"ice (>)%%%

*T !o#,le =o#te (7)

Page 11: VLCT tutorial

8/9/2019 VLCT tutorial

http://slidepdf.com/reader/full/vlct-tutorial 11/29

I" you de"ine a variable, and the program will as it, during e!ecution, you must enter a value with the same typethat the de"ined value or the program will give you an error or incorrect output.

nd this is how we proceed under VLCT to programming$

"ter open VLCT under secure shell, you must select the option “edit” and then “new "ile”.

Then start to write the code in the blan or white window, note the windows that show in"o o" the current directory.

Gou can save to memory or  save to dis, is recommendsave to dis, so, the upper  windows will show you thein"o o" the events.

Hhen all code is correctlywrote, you must compile thecode, lie the pictureshows.

77

Page 12: VLCT tutorial

8/9/2019 VLCT tutorial

http://slidepdf.com/reader/full/vlct-tutorial 12/29

I" the compilation is success"ul, the VLCT will show the “"ile is error "ree” window. Then you must con"irm thewindow and then close the window to start the run command.

The run command here is located in the e!ecute option, you will select it and the VLCT will show you a list o" the program recently edited and ready to e!ecute, you only need to select it.

/inally, this is the real output o" the program$

7*

Page 13: VLCT tutorial

8/9/2019 VLCT tutorial

http://slidepdf.com/reader/full/vlct-tutorial 13/29

String Arra$%This is used to store te!t characters. &sed "or screen messages. Gou must "ollow two rules$

a) ;ust be a paced array. b) Lower limit must start with 7.

-rogram 9!ample$

-rogram e!ampleOstringOarray (Yprogram declarationY)

TG-9 (Ytype section where the user describes the set o" possible values and gives the set a name

or a type identi"ierY)

arrayOe!ample D -CR9: 88GS7..+ o" char (Yhere the user declares an array "rom 7 to + charY)

V8  (YV8 eyword indicates the start o" variable declaration sectionY)

i$integer (Y declares variable “i” lie integerY)

store$ arrayOe!ample (Y declare “store” lie an arrayY)

,egin (Yeyword used to start the main code Y)

/or i$D 7 T2 + :2 (Y starts a loop it will count "rom E to M at “i” and will e!ecute all

 belowY)

egin (Ystarts the loop=s codeY)

writeln(NInput an alpha character=) (Ywrite the te!t in the screenY)

readln(storeSi) (Ywaits "or the input "rom the user to be stored in “store” with

inde! D i Y)

7

Page 14: VLCT tutorial

8/9/2019 VLCT tutorial

http://slidepdf.com/reader/full/vlct-tutorial 14/29

en!. (Yends the loopY)

/28 i$D 7 T2 + :2 (Y starts a loop it will count "rom E to M at “i” and will e!ecute all

 belowY)

writeln(Nposition P N, i$7, ND=, storeSi) (Ywrites te!t and values o" “i” and “store”Y)

 pause (Ypauses program e!ecution and later ends the programY)en!

-rogram outputs$

Input an alpha character VInput an alpha character LInput an alpha character CInput an alpha character T-osition P 7 D V-osition P * D L-osition P D C-osition P E D TYYY -ause

The bove program only stores the /irst Character, i" you entry more than one character, only the "irst will be storedand later displayed.

The ne!t program is a little di""erent, it will de"ine an array o" 7 by EA to store enough characters to be displayed liea name store device.

7E

Page 15: VLCT tutorial

8/9/2019 VLCT tutorial

http://slidepdf.com/reader/full/vlct-tutorial 15/29

Program name;pascal.

TG-9

arrayOe!ample D -CR9: 88GS7..7AA o" charV8 name$stringSEAstore$arrayOe!ample

,egin

writeln(Nplease type your complete name=)readln(name)writeln(N=)writeln(Nyour name is=, name)

 pause

en!%

-rogram 2utput$

-lease type your complete name%ergio couttolenc valdes

Gour name is sergio couttolenc valdesYYY-&%9

7+

Page 16: VLCT tutorial

8/9/2019 VLCT tutorial

http://slidepdf.com/reader/full/vlct-tutorial 16/29

T"o?Dimensional Arra$s%

Gou can de"ine also, an '!; matri!, in this e!ample we de"ine a * by matri! and using two cycles /28, we inputthe data to each matri! cell.

0ere is the e!ample.

-rogram bidimensional

TG-9arrayOe!ample D 88GS7..*, 7.. o" integer  (Yde"ines an array o" * by , the "irs pair o" numbers is the G and

the second the 1Y)

V8 i$ integerstore$ arrayOe!ample

,egin

/28 I$D 7 T2 :2 (Y this loop will "ill the positions 7,7 to 7, Y)

,egin

writeln(Ninput an integer to "ill position 7=,=,=,i$7,= in the array=)read(storeS7,i) (Yread the imput "orm the user and store it in the array Y)

en!.

/28 I$D7 T2 :2 (Y this loop will "ill the positions *,7 to *, Y)

,egin

writeln(Ninput an integer to "ill position *=,=,=,i$7,= in the array=)read(storeS*,i) (Yread the imput "orm the user and store it in the array Y)

en!.

/28 i$D T2 :2 (Ythis loop will display all values o" all the array elementsY)

7

7

7 * E

7

+

*

7,7 7,* 7, 7,E 7,+ 7,

*,7 *,* *, *,E *,+ *,

Page 17: VLCT tutorial

8/9/2019 VLCT tutorial

http://slidepdf.com/reader/full/vlct-tutorial 17/29

,egin

writeln(Nposition P N,=,=7,=,i$D7,=D=, storeS7,i$7)writeln(Nposition P N,=,=*,=,i$D7,=D=, storeS7,i$7)writeln(“)en!.

 pauseen!%

-rogram 2utput$

Input an integer to "ill position 7,7 in the array*Input an integer to "ill position 7,7 in the array+Input an integer to "ill position 7,7 in the arrayMFInput an integer to "ill position 7,7 in the array+EInput an integer to "ill position 7,7 in the arrayWInput an integer to "ill position 7,7 in the array*Input an integer to "ill position 7,7 in the array*EInput an integer to "ill position 7,7 in the arrayAInput an integer to "ill position 7,7 in the array+Input an integer to "ill position 7,7 in the array+

Input an integer to "ill position 7,7 in the arrayEInput an integer to "ill position 7,7 in the arrayM

 position P 7,7 D* position P *,7 D *E

 position P 7,* D + positon P *,* D A

 position P 7, D MF position P *, D +

 position P 7,E D +E position P *,E D +

 position P 7,+ D W position P *,+ D E

 position P 7, D * position P *, D M

7W

Page 18: VLCT tutorial

8/9/2019 VLCT tutorial

http://slidepdf.com/reader/full/vlct-tutorial 18/29

YYY-&%9

 'e!t, is the same program, with the only di""erence that the two cycles are one inside the other and we don=t start the inde! at 7, because is onl$ the pac@e! arra$ is the ones "ho nee!e! it .

-rogram twoOcyclesTG-9arrayOe!ample D 88GS7..*, .. o" integerV8 i,! $ integerstore$ arrayOe!ample

,egin

/28 i$D 7 T2 * :2 (Y loop used to as values o" 7 to * Y)

,egin

/28 ! $D T2 :2 (Y loop used to as values o" 7, to *, Y)

,eginwriteln(Ninput an integer "or array location N,i$7,=,=,!$7)readln(storeSI,!)en!.

en!.

/28 I$D T2 :2 (Yloop used to display the arrays contents Y)

,egin

writeln(Nlocation 7,=,i$7,=D=, storeS7,i$7)writeln(Nlocation *,=,I$7,=D=, storeS*,I$7)

7F

Page 19: VLCT tutorial

8/9/2019 VLCT tutorial

http://slidepdf.com/reader/full/vlct-tutorial 19/29

en!.

 pauseen!%

The program output is$

Input an integer "or array location 7,*Input an integer "or array location 7,MInput an integer "or array location 7,+Input an integer "or array location 7,*Input an integer "or array location 7,

+Input an integer "or array location 7,*7Input an integer "or array location 7,*Location 7, D *Location *, D *Location 7,E D MLocation *,E D +Location 7,+ D+Location *,+ D *7Location 7, D +WLocation *, D *

YYY-&%9

7M

Page 20: VLCT tutorial

8/9/2019 VLCT tutorial

http://slidepdf.com/reader/full/vlct-tutorial 20/29

Proce!#res% procedure is a subroutine, that it is de"ined be"ore the main code (be"ore the “begin” o" the main program). %ee the"ollowing illustration$

The Idea here is this$ 9ach procedure has is particular code and variables, this variables I" they are de"ined inside the procedures, they are called “local” variables because only the code inside these procedure will reach these variables.The global variables are de"ined be"ore the procedures, then, all code will reach them.

Gou can de"ine any number o" procedures, but you must be care"ully with the "ollowing tips$

a) :on=t use the same names to de"ine local variables and global variables. b) :on=t use mathematical operations in the main code mi!ing local and global variables.c) 5e speci"ic with the procedures, each procedure belongs to one operation, this mae clear you code to understand.

This is the way to use the procedures$

a) :e"ine which will be your local and global variables. b) Hrite each procedure with a speci"ic tas.c) :e"ine i" your procedure will be receiving or sending data to the main code.d) %tudy i" the mathematical operation inside the procedure will reach all the proper variables.e) 9nd the procedure.") %tarts the main codeg) %tudy I" you main code is sending or receiving data "rom4to the procedures.h) ;ae a “call” to the procedure.i) 9nd you main code.

 'e!t there is an e!ample that shows how to use the procedures$

*A

-rocedure “n”

-rocedure +

-rocedure E-rocedure -rocedure *

-rocedure 7

“begin” instruction

The main Code

9nd

-rogram Title :eclaration

Page 21: VLCT tutorial

8/9/2019 VLCT tutorial

http://slidepdf.com/reader/full/vlct-tutorial 21/29

Program E:ample proce!#res.

Var i$ integer

proce!#re !emo1.

V8 

i$ integer begini $Dwriteln(Nprocedure demo7 D N, i$*)end

proce!#re !emo2.

V8 i$ integer begini $D 7AA

writeln(Nprocedure demo* D N, i$*)end

,egin

i$D 7Ademo7demo*writeln(Nmain line D N, i$*) pause

en!%

s you can see, we intentionally use the same character in a local and global variable (i). Hhy we did thatZ 5ecauseeven using the same character, the language understands lie a two di""erent variables, so, this mae the code verydi""icult to read and understand.

 'ote that the main code maes a “call” to the procedure, this is only writing the name o" the procedure in the code,and It will be e!ecuted. Controlling local and global variables you can control the "low o" data between the maincode and the procedure. /or e!ample, you can de"ine the same global and local variables, then in the main code,store values in those variables and call a procedure to per"orm a mathematical operation with these values or viceversa. ;any programmers use only local variables, lie in the "ollowing e!ample. Gou can easily add another  procedure to the program without con"licts o" global variables.

The ne!t is a code using only local variables$

-rogram Localonly-rocedure chnOmenuV8 i, var7 $ integer5egin89-9T (Yloop condition tested at the end o" the loop in the until

statementY)

9rase%creen (Ywill erase the screenY)

*7

-rogram title declaration and 3lobal variables de"inition

-rocedure named “demo7”, note

that It has his local variablede"initions and his own code.

-rocedure named “demo*”,note that It has his localvariable de"initions and his owncode.

The main code

Page 22: VLCT tutorial

8/9/2019 VLCT tutorial

http://slidepdf.com/reader/full/vlct-tutorial 22/29

/or i$D 7 to 7A :2HritelnHriteln(N YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY=)Hriteln(N C0''9L %9L9CT ;9'& N)Hriteln(N A. %9L9CT LL C0''9L=)Hriteln(N 7. %9L9CT C0''9L =)

Hriteln(N *. %9L9CT C0''9L 5=)Hriteln(N . %9L9CT C0''9L C=)Hriteln(N E. %9L9CT C0''9L :=)Hriteln(N +. %9L9CT C0''9L 9=)Hriteln(N . %9L9CT C0''9L /=)Hriteln(N W. %9L9CT C0''9L 3=)Hriteln(N F. %9L9CT C0''9L 0=)Hriteln(N M. %9L9CT C0''9L 6=:)Hriteln(N7A. %9L9CT C0''9L 960=)HritelnHriteln(N %9L9CT G2&8 2-TI2'JJ..=)

8eadln (var7) (Ywait "or the user input to store it in “var7” Y)

&ntil ((var7DA) and (var7 K 77 )) (Y condition test i" true go to case i" "alse go to repeat Y)

Case var7 2/ (Ystart o" the case sentences. Case will compare the

var7 with the valuesY)

A$ begin (Yand it will e!ecute the code Y)

writeln(Nyou selected option A=)writeln(Nin the diagnostic program, a procedure could be N)writeln(Ncalled here to run test on all pins N)

  endM$ begin

writeln(Nyou selected option M=)writeln(Nin the diagnostic program, a procedure could be N)writeln(Ncalled here to run test on C0''9L 6: N)

  end7A$ begin

writeln(Nyou selected option 7A=)writeln(Nin the diagnostic program, a procedure could be N)writeln(Ncalled here to run test on C0''9L 960 N)

  end7..F$ begin

writeln(Nyou selected option =, var7$*)writeln(Nin the diagnostic program, a procedure could be N)writeln(Ncalled here to run test on the selected channel N)

  endend

 begin (Ymain program beginY)

C0'O;9'& (Ycalling procedureY)

-ause9nd. (Ymain program endsY)

**

Page 23: VLCT tutorial

8/9/2019 VLCT tutorial

http://slidepdf.com/reader/full/vlct-tutorial 23/29

The output o" the program will be$

YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYC0''9L %9L9CT ;9'&

A. %9L9CT LL C0''9L%7. %9L9CT C0''9L

*. %9L9CT C0''9L 5. %9L9CT C0''9L CE. %9L9CT C0''9L :+. %9L9CT C0''9L 9. %9L9CT C0''9L /W. %9L9CT C0''9L 3F. %9L9CT C0''9L 0M. %9L9CT C0''9L 6=:7A. %9L9CT C0''9L 960

%9L9CT G2&8 2-TI2'J A

Gou selected option AIn the diagnostic program, a procedure could beCalled here to run test on all pinsYYY-&%9

<#nctions. "unction is a subroutine, but the "unction always needs input and will always output. They must

 be declared be"ore the main program (be"ore the “begin” instruction). The main program will e!ecute statements,invoe a "unction, run the "unction code and then return and run the ne!t statement in the main program a"ter the"unction is invoed.

The synta! o" a "unction is$

"unction "unctionOname(V8 var7$type V8 var*$type)$ "unctionOtype

var7 and var* are the variables that are inputs "or the "unction, note the 7.9 ,et"een !ifferent t$pes of varia,les.

*

Page 24: VLCT tutorial

8/9/2019 VLCT tutorial

http://slidepdf.com/reader/full/vlct-tutorial 24/29

/unctionOtype, is the type o" value that will be returned to main program via the "unctionOname.

 'e!t an e!ample o" a "unction$

-rogram e!ampleO"unctionV8  'um$ real

/unction issOmyO"oot(V8 var7$real)$real5eginRissOmyO"oot $D (var7Yvar7)9nd

5eginHriteln(Nthis program will calculate the square o" a number=)Hriteln(Nplease input a real number D N)8ead(num)Hriteln(NThe square o"=, num$*, ND=, issOmyO"oot(num))-ause9nd

-rogram 2utput$

This program will calculate the square o" a number -lease input a real number D .MMMMMThe square o" E.AeBAA D 7.+MMMM*eBA7YYY-&%9

*E

Page 25: VLCT tutorial

8/9/2019 VLCT tutorial

http://slidepdf.com/reader/full/vlct-tutorial 25/29

This programs wors in this wayJ "irst, are declared the global variables, then the "unction with is own variablesand code and "inally, the main code, the which one invoe the "unction passing “num” as a parameter "rom the main program via “var7”, but the "unction will return the parameter “issOmyO"oot”, instead o" returning “var7” and thisis the di""erence between "unctions and procedures.

3se of +P*RT EBP*RT an! CL3DE%

The procedures and "unctions are codes that actually are inside the main program, but with the use o" I;-28T,91-28T and PI'CL&:9 we will use code stored in an e!ternal "ile instead o" use in the same "ile where the main program resides. 9ach o" these, will only “load and compile”, because they will be e!ecuted a"ter be called by main program.

 'e!t there is an e!ample o" the use o" I;-28T491-28T4&%9 instructions. /irst we build the au!iliary code thatwill be called by the main program. The code must be saved in a directory with a easy to understand "ile name. 'otethe path directory where the au!iliary code will be saved. This path is under your discretion, but you must write itdown.

;2:&L9 &1ILI8GTG-9 proOvector D array S7..7A o" integer-82C9:&89 sum(data7$ proOvector V8 results7$ proOvector) EBP*RTV8 sublength, current, tempsum$ integer

 begin"or sublength $D 7 to 7A :2

 begin

tempsum $D A"or current $D 7 to sublength :2tempsum $D tempsum B data7Scurrentresults7Ssublength $D tempsum

endend

The code above should be saved with “&%-” e!tension, then saved it with this "ormat, without the quotes$

“"ilename.usp”

*+

Page 26: VLCT tutorial

8/9/2019 VLCT tutorial

http://slidepdf.com/reader/full/vlct-tutorial 26/29

 'ote that a"ter the procedure declaration, is the “91-28T” eyword, this mean that this au!iliary code will e!portor return data to a main code. The path where the "ilename.usp is stored is an important data, because the main program will loo "or the "ile using the path lie data to locate and load it. %o the path will be included in the main program and i" this path is incorrect this will cause a “"atal error”. 'e!t is a e!ample o" a main program using theI;-28T4&%9 instructions and calling the above code. 'ote the “I;-28T” eyword, it means that the main codewill import or retrieve data "rom an au!iliary code$

-8238; storeOarrays7&%9 N4driveZZ4pathO"ileZZ4"ilename.usp=TG-9vector D arrayS7..7A o" integerV8 "irst, second$ vectori$ integer

-82C9:&89 sum(data$ vector V8 results$ vector) I;-28T

 begin"or i $D 7 to 7A do"irstSi $D isum("irst, second)

"or i$D 7 to 7A :2write(N"irstSi$E)writeln

"or i $D 7 T2 7A do

writeln"or i$D 7 T2 7A dowrite(secondSI$E)writeln pause

end.

The program output is$

7 * E + W F M 7A

7 7A 7+ *7 *F E+ ++YYY-&%9

The CL3DE instr#ction%

He can use the PI'CL&:9 to separate the variable declaration "rom the main code. Then, we will write a special"ile with the TG-9 data inside it. ;odi"y the above code in this way$

7) 2pen and save another "ile with a "ile name “myOtypes.include”*) In this new "ile, write the "ollowing code$

*

Page 27: VLCT tutorial

8/9/2019 VLCT tutorial

http://slidepdf.com/reader/full/vlct-tutorial 27/29

TG-9vector D arrayS7..7A o" integer

) In the main program, below the &%9 instruction, write$

P:9/I'9 QTG-9% N4drive4path4myOtypes.include "ile=PI'CL&:9 N4drive4path4myOtypes.include "ile=

E) :elete the Type declaration section in your main program.

 'e!t is a complete e!ample o" the use o" &%- and I'CL&:9 "iles./irst we should write the code "or a &%- "ile.

;2:&L9 &1ILI8GTG-9 proOvector D array S7..7A o" integer-82C9:&89 sum(data7$ proOvector V8 results7$ proOvector) EBP*RTV8 sublength, current, tempsum$ integer

 begin

"or sublength $D 7 to 7A :2 begin

tempsum $D A"or current $D 7 to sublength :2tempsum $D tempsum B data7Scurrentresults7Ssublength $D tempsum

endend

Then we write the code "or the include "ile$

TG-9vector D arrayS7..7A o" integer

5oth stored with the same names. Then the ;ain program will be$

-8238; storeOarrays7

&%9 N4driveZZ4pathO"ileZZ4"ilename.usp=

*W

Page 28: VLCT tutorial

8/9/2019 VLCT tutorial

http://slidepdf.com/reader/full/vlct-tutorial 28/29

P:9/I'9 QTG-9% N4drive4path4myOtypes.include "ile=PI'CL&:9 N4drive4path4myOtypes.include "ile=

V8 "irst, second$ vectori$ integer

-82C9:&89 sum(data$ vector V8 results$ vector) I;-28T

 begin"or i $D 7 to 7A do"irstSi $D isum("irst, second)

"or i$D 7 to 7A :2write(N"irstSi$E)writeln

"or i $D 7 T2 7A dowriteln"or i$D 7 T2 7A dowrite(secondSi$E)writeln pause

end.

 'e!t is the program output, please chec with your instructor or your computer room manager 

the right path to store and call programs.

*F

Page 29: VLCT tutorial

8/9/2019 VLCT tutorial

http://slidepdf.com/reader/full/vlct-tutorial 29/29

*M