Home

SCREEN CREATOR 5 K-Basic Program Description

image

Contents

1. endif end evnt 4 242 CHAPTER4 INSTRUCTION REFERENCE SWREV eg SWREV Statement E Function E Format m Example of Use E Description E Related Item E Example of Program evnt The SWREV statement sets whether to reverse the display of the specified switch when the switch status changes SWREYV switch name operation SWREV SW2 0 e The SWREV statement sets whether to reverse the display of the specified switch when the switch on the touch panel is pressed or the status is changed e switch name is the name assigned to the switch or the D type variable indicating the name e The CONF and part CONF block of the global screen cannot be used in the switch primitive where operation parameters are valid e operation indicates whether to reverse the display of the switch with the following numeric values 0 The display of the switch is not reversed 1 The display of the switch is reversed None input type id data if type 3 and id SWT000 then id SW2 SWREV id 1 endif end evnt 4 243 SWWRITE ee SWWRITE Statement E Function The SWWRITE statement changes the status of the specified switch E Format SWWRITE switch name status m Example of Use SWWRITE SW1 1 Description The SWWRITE statement changes the status ON or OFF of the specified switch even if the switch on the touch panel is not pressed When the status is changed the data indicating th
2. end conf evnt input The SETBEEP statement specifies the tone of a buzzer SETBEEP ON time OFF time sound count SETBEEP 10 5 3 e The SETBEEP statement sets the tone color of the buzzer to be sounded by the BEEP command e ON time specifies the time during which the buzzer continues to sound in units of 100 milliseconds e OFF time specifies the time during which the buzzer continues not to sound in units of 100 milliseconds sound count indicates the number of times the buzzer sounds and does not sound It is impossible to specify 0 e When OFF time is 0 the buzzer continues to sound BEEP SETBEEP 50 20 3 types id data if id BEEF D 1 else endif end evnt BEE SWT000 then 4 219 SETBLIGHT 8 SETBLIGHT Statement E Function The SETBLIGHT statement sets the time that lasts till the back light is turned off E Format SETBLIGHT OFF time m Example of Use SETBLIGHT 20 E Description e OFF time indicates the time that lasts till the back light is turned off it is an integer type variable or a numeric value OFF time is set in minutes When OFF time is 0 the back light is not turned off E Related Item GETBLIGHT E Example of Program cont getblight var var var 2 SETBLIGHT var end conf 4 220 CHAPTER4 INSTRUCTION REFERENCE SETBLIGHT be a SETDATE Statement E Function E Format m Example of Use
3. ABCD XYZ end evnt Data is written to the specified file as follows 123 2 ABCD XYZ CR LF 4 103 GETBLIGHT ae GETBLIGHT Statement E Function E Format m Example of Use E Description E Related Item The GETBLIGHT statement reads the time that lasts till the back light is turned off GETBLIGHT variable name GETBLIGHT VAR variable name specifies the variable used to write the time that lasts till the back light is turned off The unit for the read values is minute When 0 is specified the back light is not turned off SETBLIGHT m Example of Program conf GETI LIGHT var var var 2 setblight var end conf 4 104 CHAPTER 4 INSTRUCTION REFERENCE GETDATE eg GETDATE Statement E Function The GETDATE statement obtains the data representing a date E Format GETDATE year read variable month read variable day read variable day of week read variable E Example of Use GETDATE YEAR MONTH DATE DAY E Description e The GETDATE statement writes the current date value to year read variable month read variable day read variable and day of week read variable e Year is the low order two digits of A D Month is a numeric value from 1 to 12 Day is a numeric value from 1 to 31 The day of the week is a numeric value from 0 to 6 Sunday to Saturday e Read variables must be integer type variables e Once date is set using the S
4. If write is executed when the PLC is write inhibited an error will occur e Switches are controlled as follows The value used to determine the IO type is amp H60 When switches are simultaneously pressed the number of switches to be assumed ON can be controlled Specify the number of switches that can be simultaneously recognized in mode with a numeric value from 0 to 640 Specifying 0 inhibits switch input The switch cannot be used in this case Thus be sure to make a program in another way so that it resets prohibition of turning on the switch The number of switches specified using this command in a model with a battery backup calendar IC GCS56LC or GCS55EM is maintained even while the power is off The number of switches specified using this command in a model with no calendar IC GC53LC or GC53LM is lost when the power is turned off Therefore the number of switches must be specified in a program which is always executed when the power is turned on e A non procedure type send buffer is cleared as shown below The value for deciding the I O type is amp H41 Specify a port CH1 to CH3 for clearing the send buffer in mode Input a number between 1 and 3 E Related Item IOSTAT 4 125 IOCTL ee m Example of Program evnt input ty id dat if id swl and dat 1 then ioctl 0 0 else LOGE Oi endif end evnt 4 126 CHAPTER4 INSTRUCTION REFERENCE IOCTL2 eg _ I
5. conf DIM FLOAT 10 ID 5 MOJIS 10 40 for i 1 to 5 FLOAT i i 3 next end conf 4 68 CHAPTER4 INSTRUCTION REFERENCE DIR eg DIR Function E Function E Format m Example of Use E Description E Related Item The DIR function makes a list of directory or file data into character string variables and returns the number of created data i e the number of entries in the directory or file DIR directory name file attribute value offset value and character string variable NUM DIR A SUBDIR amp H20 6 LIST e A directory name can be specified in a full path name including a drive name or in an abbreviated name beginning with a current directory name Example A SUBDIRI1 SUBDIR2 SUBDIR2 SUBDIR3 e A file name instead of a directory name should be specified to create data of a single file e A file attribute value for selecting data to be created should be specified in a logical OR of the flags shown below amp HO1 Read only file amp H02 Hidden file amp HO04 System file amp HO08 Volume label amp H10 Sub directory amp H20 Standard file e An offset value is specified in order to exclude the first n data from data to be created e Each created data consists of a 40 byte record of the fixed length It is followed by detailed data as shown below Name Extension Size Day Dine of updating updating DISK_1 lt VOL gt 87 01 15 15 25 SAMPLE EXE 98765 92 11 03 9 12 AB
6. if id swl then if iostat 0 then ioctl 0 0 else ioctl 0 1 end if endif end evnt 4 128 CHAPTER4 INSTRUCTION REFERENCE JUMP eg JUMP Statement E Function The JUMP statement displays the specified screen E Format JUMP screen name m Example of Use JUMP 10 E Description e The JUMP statement displays the screen specified in screen name e screen name is the name of the screen to be displayed or the D type variable indicating the screen to be displayed Alternatively screen name specifies the screen number stored in screen registration e When this statement is executed the subsequently coded program is not executed e If anon extant screen is specified a system error occurs E Related Item None E Example of Program evnt input type id data if type 3 and id SWT000 then JUMP GAMEN end if end evnt 4 129 KILL ei KILL Statement E Function The KILL statement deletes the specified file E Format KILL file name m Example of Use KILL C ABC DOC E Description The KILL statement deletes the file specified by file name A wild card can be specified in file name E Related Item m Example of Program conf end conf KILE SABC t end evnt 4 130 CHAPTER4 INSTRUCTION REFERENCE LAMPCOLOR eg I LAMPCOLOR Statement E Function The LAMPCOLOR statement changes the ON display color of the lamp display E Format LAMPCOLOR display
7. 4 73 EOF fee EOF Function E Function E Format m Example of Use E Description E Related Item m Example of Program The EOF function checks whether the end of the file was reached EOF file number AAA EOF file number e file number specifies the number of the file for which whether the end of the file was reached is to be checked This file number must match the number of the file opened by the FOPEN statement e Return value 1 indicates that the end of the file was reached Return value 0 indicates that the end of the file is not reached FOPEN FIELD FCLOSE FPUT FGET cont field 5 global no global mojilS moji2s end field global sum fopen C TEST 2 5 end conf evnt while EOF 5 0 fget 5 i numdsp NUM000 no S S wend fclose end evnt trdsp STROOO mojil trdsp STROO1 moji2 5 4 74 CHAPTER 4 INSTRUCTION REFERENCE ERRCTL PT ERRCTL Statement E Function The ERRCTL statement controls the error number display position E Format ERRCTL mode m Example of Use ERRCTL 0 E Description e The ERRCTL statement controls the error number display position e The error display position conforms with the value specified in mode When mode is 0 An error number is displayed below a screen When mode is 1 A message is issued to the error display When mode is 1 messages of error numbers 4000 to 4499 and 5000 to 5999
8. E Description The BIN2BCD function converts binary data to BCD data e Ifthe binary data to converted to BCD data is greater than 99999999 it is fixed at 99999999 E Related Item BCD2BIN m Example of Program evnt input types id data data BIN2BCD datas 007D10 data end evnt 4 25 BITSET 8 BITSET Statement E Function The BITSET statement sets the specified bit of a variable to ON or OFF E Format BITSET variable name set position ON OFF value E Example of Use BITSET VARIABLE 10 1 E Description The BITSET statement sets the specified bit of the specified variable to Oor 1 e variable name specifies the name of the variable where the specified bit is set to O or 1 it must be an integer or floating point type variable e set position specifies where in the variable the specified bit is to be set with a value from 0 to 31 it must be a variable or constant e When 1 is set in the variable ON OFF value also specifies 1 When O is set ON OFF value also specifies 0 It must be a variable or constant E Related Item BITTEST E Example of Program conf end conf evnt if bittest input types id data numdsp NUMOOO data datas 31 1 then bitset data 31 0 else bitset data 31 1 endif numdsp NUM000 data end evnt 4 26 CHAPTER4 INSTRUCTION REFERENCE BITTEST eg BITTEST Function E Function
9. LEN character string LEN registered character string number LEN registered character string name A LEN B A LEN MOJI The LEN function returns the length of the character string specified by character string registered character string number or registered character string name in a number of bytes character string is a direct character string or a character string variable registered character string number is the numerical expression indicating the number registered by GCSGP3 registered character string name is the name of the character string created by GCSGP3 or the ID type variable indicating the name of the character string None bS abcdefg toroku 4 134 CHAPTER 4 INSTRUCTION REFERENCE LINE eoe A LINE Statement E Function The LINE statement draws a straight line on a screen E Format LINE X1 Y1 X2 Y2 m Example of Use LINE 20 30 100 200 E Description The LINE statement draws a straight line between the specified two coordinates X1 Y1 and X2 Y2 e X1 and X2 must be a numeric value from 0 to 639 Y1 and Y2 must be a numeric value from 0 to 399 GC55EM or 0 to 479 GCS6LC e A straight line is directly displayed as the background of a screen When a part is opened or closed in the area where a straight line was displayed or when a primitive is displayed the straight line may be cleared The cleared straight line is not redisplayed e The type and color of the straight
10. Vol 6 Screen Creator 5 Manual K Basic Programming Offers information on how to write action programs for creating screens and how to use functions Vol 7 Screen Creator 5 Manual Trouble Shooting and Error Codes Covers restrictions on creating screens with Screen Creator 5 how to cope with trouble and error codes iv Safety Precautions Safety Precautions Be sure to follow the safety precautions listed below in order to use the OIP safely Koyo Ltd cannot be held liable for any damages incurred if these safety precautions are not followed A WARNING Design your system so that there are sufficient countermeasures for personnel accidents and major equipment accidents The system should have an external protection and safety circuit so that even if the OIP should malfunction or even if there is a defect in the program the safety of the system is assured Do not use the touch panel of the OIP to make switches that are related to safety or people or major damages emergency safety switches etc Be sure that the system is designed so that it can cope with any errors or malfunctions in the touch panel Be sure that type 3 grounding is used for the protective grounding terminal There is a possibility of electrical shock if the unit is not grounded If the OIP should malfunction immediately turn off the poser and leave it alone If there is direct output to external output device such as PLCs direct output will be driv
11. _SW_ONKFIG changes a switch ON display graphic _SW_ONKHIG is applicable to switches and selector switches For a switch specify 1 For a selector switch specify the element number of the switch whose ON graphic is to be changed The element number starts at 1 Specify the registration graphic number displayed when a switch is ON _SW_OFFFIG changes a switch OFF display graphic _SW_OFFFIG is applicable to switches and selector switches For a switch specify 1 For a selector switch specify the element number of the switch whose OFF graphic is to be changed The element number starts at 1 Specify the registration graphic number displayed when a switch is OFF 4 191 PRMCTL l e The types and usage of the request codes that can be used by PRMCTL3 are explained below 1 _PD_RANGE Function _PD_RANGE sets the display range of a display Range _PD_RANGE is applicable to bar graph line chart free graph slide meter and plot displays Type When the plot display is used specify O Xmin change 1 Xmax change 2 Ymin change or 3 Ymax change When the bar graph line chart free graph slide or meter display is used specify 2 minimum change or 3 maximum change Control value Set the value display range to be changed 2 _PD_BSVAL Function _PD_BSVAL changes the setting value of a base or reference line Range _PD_BSVAL is applicable to bar graph and line chart displays Type Specify 0 base lin
12. starttim timid end conf evnt input type id data if type 3 and id SWT000 then stoptim timid else if id SWT001 then closetim timid end if end evnt 4 171 OPENTIM2 ee OPENTIM2 Function E Function E Format m Example of Use E Description E Related Item The OPENTIM2 function allocates opens the timer to be used RET OPENTIM2 timer number RET OPENTIN2 14 The OPENTIM2 function opens the timer specified in timer number timer number specifies the number of the timer to be used Specify this timer number with an integer type value from 0 to 15 When the OPENTIM2 function is executed any of the following value is returned 0 The timer could be opened 1 The timer could not be opened The OPENTIM2 function can be used by the screen or part program being displayed If this function is executed on an undisplayed rear screen an error occurs The allocated timer is not deallocated even if one screen changes to another If the timer is being used by the event type a message is also issued to the rear screen CLOSETIM STARTTIM STOPTIM CONTTIM SETTIM READTIM OPENTIM m Example of Program con static tin OP ENT LEU nid setim 5 tim star end conf evnt input typ if type IM2 5 20 O0 5 id 3 and id data SWT000 then O e stoptim 5 else if i d SWTOO1 t
13. FIGCOLOR end evnt FIGOOO tile S 1 1 4 86 CHAPTER4 INSTRUCTION REFERENCE FIGDSP ee FIGDSP Statement E Function The FIGDSP statement texture the graphic specified in the graphic display E Format FIGDSP control name texture name m Example of Use FIGDSP B000 FIGO00 SWFIG E Description e The FIGDSP statement displays the texture specified in the texture display This texture name must be the one created by the plotting tool e control name is the graphic display name or the ID type variable indicating the graphic display e texture name is the variable indicating the name or ID of the texture to be displayed in the texture display or the registered graphic number integer type e display value cannot be changed even if this statement is issued to the display for which operation parameters are set to effective in the control E Related Item FIGCOLOR FIGFORM m Example of Program evnt input ty id figno FIGDSP FIGOOO figno end evnt 4 87 FIGFORM ee FIGFORM Statement E Function E Format m Example of Use E Description E Related Item m Example of Program evnt The FIGFORM statement changes the display format of the texture display FIGFORM control name resize specification FIGFORM HYOJIKI 0 e When the size of the texture display differs from that of the texture to be control in the control the FIGFORM statement specifies whether to perfor
14. Statement E Function E Format m Example of Use E Description E Related Item m Example of Program conf The STATIC statement declares that static variables are to be used STATIC variable name variable name STATIC VAR XYZ 2 3 MOJI 20 e The STATIC statement declares that static variables are to be used Static variables can be used only the declared program These variables are initialized once when the power supply is turned on The values of static variables used after the power supply has been turned on are retained e A normal variable an array variable or a character string variable can be written in variable name e When an array or character variable is declared the DIM and STRING statements need not be declared AUTO BACKUP DIM GLOBAL LOCAL STRING STATIC var float STATIC moji 50 moji2 10 3 STATIC xyz 10 10 end conf 4 232 CHAPTER4 INSTRUCTION REFERENCE STOP PT STOP Statement E Function The STOP statement stops the execution of the program E Format STOP m Example of Use STOP E Description e The STOP statement stops the execution of the program following this statement E Related Item RUN m Example of Program evnt input type id data if type 3 and data 0 then STOP numdsp NUM000 data end evnt 4 233 STOPTIM et STOPTIM Statement E Function timer E Format STOPTIM timer number m Example of Use STOPTIM ID STOPTIM VAR E De
15. The MID statement replaces the character string specified in character string variable with the character string specified in replacing character string the specified number of characters bytes starting from the specified start position If the specified number of characters is greater than the specified character string variable the character string is replaced only by the size of the variable For this reason the size of the character string variable remains unchanged even if the character string is replaced The start position of the character string to be replaced starts at 1 When number of characters is negative and start position is 0 or negative an error occurs LEFT RIGHT MID input type midS mojiS static mojis al BCDEFG id datas 4 3 data 4 150 CHAPTER4 INSTRUCTION REFERENCE MID eg a MID Function E Function The MID function returns a character string the specified number of characters E Format MID character string start position number of character MID registered character string number start position number of characters MID registered character string name start position number of characters m Example of Use A MID X 2 3 A MID 10 2 3 A MID NAME 2 3 E Description e The MID function fetches the specified number of characters bytes from the specified character string starting from the position specified in start position
16. conf The STATIC statement declares that static variables are to be used STATIC variable name variable name STATIC VAR XYZ 2 3 MOJI 20 e The STATIC statement declares that static variables are to be used Static variables can be used only the declared program These variables are initialized once when the power supply is turned on The values of static variables used after the power supply has been turned on are retained e A normal variable an array variable or a character string variable can be written in variable name e When an array or character variable is declared the DIM and STRING statements need not be declared AUTO BACKUP DIM GLOBAL LOCAL STRING STATIC var float STATIC moji 50 moji2 10 3 STATIC xyz 10 10 end conf 4 232 CHAPTER4 INSTRUCTION REFERENCE STOP PT STOP Statement E Function The STOP statement stops the execution of the program E Format STOP m Example of Use STOP E Description e The STOP statement stops the execution of the program following this statement E Related Item RUN m Example of Program evnt input type id data if type 3 and data 0 then STOP numdsp NUM000 data end evnt 4 233 STOPTIM et STOPTIM Statement E Function timer E Format STOPTIM timer number m Example of Use STOPTIM ID STOPTIM VAR E Description e The STOPTIM statement stops the increment operation of the E Related Item specified timer e
17. 4 1 4 1 Instruction References es 4 1 Instruction Reference ABS si cuec nein Bet noth ie en See 4 10 CV IW tsi hott Ale eine ot atheists 4 59 ADDY Ceao eee a assis atte See 4 11 CY CEIGC peeraa A etait 4 60 ADDCY C2 is hitler igesses e a nets 4 12 CYCLIC2 anien eio o iar i esate as 4 62 ADDCYCID enan eet 4 13 ASG nh Teea E a EEEE Sa Ro h 4 14 DATES rre a a AE ees 4 63 ATN a T AE E cate dead 4 15 DECLARE AE AT 4 64 AUTO sh aisevits tisdesghtacaneyn tgtestgnalwbedtasscteventibartte 4 16 DEVRD ici iia eee e E S 4 65 DEV WR aaora eee ain 4 66 BACKUP erorar rena addaranians 4 17 DIM a aerea na Na eie EEr tSt 4 67 BARCOLOR mesoorei ite tineia a 4 18 DIR hetitai T E a cet os 4 69 BARDS P i a an AAAA TAAS 4 20 DINV eretan EEE A eh 4 71 BARSE aaea aer eE NSE he 4 21 DOT MA E NN E EAS 4 72 BARSHIPT cctech nc EREE 4 22 DSPMODE aeree TAE 4 73 BED2BUN osinetan eeinetan 4 23 BEEP D neen e Rs 4 24 BOE AS E ESES 4 74 BIN2Z BED ecis er sates 4 25 ERRE Thera AE EAA AER 4 75 BISET arnon nr A 4 26 ERRSTA Tirena n n ee E teehee 4 76 BLESS Diran ae a E E NE A 4 27 EVENTWR eeaeee iE AEE e 4 77 BEC TE titanate aren anid 4 28 EVNET END EVN Tasicccastecesisecdeisscceecines 4 78 BESTA eisai aan wives 4 29 EXECPRCODE eenia a cen 4 79 BE TCOLORS arnee ei ET EE i 4 30 EXIT FUNCTION e ereternerirusresris eesriie 4 80 BLTDS Pie heii geitene tenis essri iesene 4 31 EXP agaia ee CAA Ra 4 81 BLETSEYF ozi decent eel eee eee 4 32 BREAD oenen EA 4 33 FELOSE etus i 4 8
18. 5 end conf FGET 5 3 numdsp NUMOOO no strdsp STROOO mojil strdsp STROO1 moji2s end evnt 4 83 FIELD END FIELD ee FIELD END FIELD Statement E Function FIELD END FIELD sets a file read write unit E Format FIELD file number variable list variable list END FIELD m Example of Use FIELD 5 global abcd xyz static dddd 10 10 backup moji END FIELD E Description FIELD END FIELD declares the unit for reading the file by the FGET statement or that for writing the file by the FPUT statement e file number specifies the number of the file onto or into which the variable group in the field is to be written or read This file number must match the number of the file opened by the FOPEN statement it is a value from 1 to 16 e The variable list that can be written between FIELD and END FIELD must be the GLOBAL STATIC or BACKUP variable The method for declaring variable lists is the same as that for declaring the GLOBAL STATIC and BACKUP variables The FIELD declared in the program where the FOPEN statement was executed is the default read write unit e When a file is read or written by a part that differs from the part opened by the FOPEN statement the FIELD declared in that part is used If this FIELD is not declared the default FIELD is used If two or more FIELDs are declared in the same file number in one program the last declared FIELD is valid e FIELD
19. A numeric expression is converted to a numeric string and written to the specified file When the data to be written is positive a blank is written before it When the data is negative a minus sign is written before it A blank is also written after the written numeric string When a character string is written no delimiter is inserted file number must match the number of the file opened by the FOPEN statement E Related Item FOPEN FCLOSE FPUT WRITE m Example of Program conf fopen Cs THST 2 5 end conf evnt vars 2 fprint 5 end evnt 123 45 var ABCD PO KRYZ Data is written to the specified file as follows A 123A A 45A 2A ABCDXYZ A indicates a blank 4 94 CHAPTER4 INSTRUCTION REFERENCE FPUT eg FPUT Statement E Function The FPUT statement writes data to the specified file E Format FPUT file number record number m Example of Use FPUT 5 3 E Description e The FPUT statement writes the contents of the variable group declared by FIELD END FIELD to the specified record record number in the specified file file number e file number specifies the number of the file to be written This file number must match the number of the file opened by the FOPEN statement e record number specifies the record in the file to which the contents of the declared variable group is to be written In this case the variable group included in FIELD is used as one unit recor
20. The DEVWR statement writes data to the specified device DEVWR device name offset value write value DEVWR 00 D10 10 5 The DEVWR statement writes data to the device that is offset value away from the device specified in device name offset value specifies the distance from the device specified in device name The DEVWR statement writes data to the device corresponding to the specified distance offset value must be an integer or floating point type variable or constant write value specifies the data to be written to the specified device it must be an integer or floating point type variable or constant The DEVWR statement is used for the device e g EVENTWR 007 D10 10 where continuous write is declared in the EVENTWR statement If the device to which data is to be written does not exist an error occurs CYCLIC EVENTWR DEVRD conf eventwr 00 7D10 5 Declares that data is to be written to the device that is end conf gt 5 away from D10 evnt input types id data Writes 10 to the device whose DEVWR O00 D10 data 10 offset value is data end evnt 4 66 CHAPTER4 INSTRUCTION REFERENCE DIM eg DIM Statement E Function E Format m Example of Use E Description E Related Item The DIM statement defines an array DIM variable name maximum subscript value l maximum subscript value DIM ABC 20 XYZ 4 4 3 LOC e The DIM statement defines the variable def
21. The STRCOLOR statement changes the colors and background figure of the character display STRCOLOR control name character display color tile display color background color STRCOLOR GRAPH 1 2 5 2 e The STRCOLOR statement changes the background tile and colors of the character display 1 indicates that the color and tile for which 1 was specified remain unchanged e control name is the character display name or the ID type variable indicating the character display e character display color indicates the color in which characters are displayed Specify this character display color with a numeric value from 0 to 15 e tile indicates the background tiling figure of the character display Specify this tiling figure with a numeric value from 0 to 15 e display color is the numeric value indicating the color number of the tile display section Specify this color number with a numeric value from 0 to 15 e background color is the numeric value indicating the color number of the tile background section Specify this color number with a numeric value from 0 to 15 STRDSP STRFORM static name name end conf evnt STR00O0 input type id data 3 then STRCOLOR name 2 1 1 1 if types endif end evnt 4 236 CHAPTER4 INSTRUCTION REFERENCE STRDSP es STRDSP Statement E Function The STRDSP statement displays data in the character display E Format STRDSP control name display data
22. e character string is a direct character string or a character string variable e registered character string number is the numerical expression indicating the number registered by GCSGP3 e registered character string name is the name of the character string created by GCSGP3 or the D type variable indicating the name of the character string e When number of characters is 0 or when start position is greater than the number of bytes of the specified character string a null character string is returned E Related Item LEFT RIGHT E Example of Program evnt input type id data a mid data 3 3 strdsp STR000 a end evnt 4 151 MKB a l MKB Statement E Function The MKB statement stores data in any position of a character string variable E Format MKB character string variable name storage position integer value E Example of Use MKB MOJI 5 VAR E Description E Related Item E Example of Program conf end conf evnt The MKB statement stores one low order byte of integer value in the position specified by storage position starting from the beginning of the specified character string variable name storage position must be a integer or floating point type variable or constant 1 specifies the beginning of the character string variable integer value specifies an overwriting value it must be an integer or floating point type variable or constant When specified in integer value a fl
23. es 2 _PD_LNE Function _PD_LNE reads the display color of a line chart Range _PD_LNE is applicable to line charts Type 1 Specify the number of the line whose display color is to be changed Type 2 Specify one of the following 0 Line type read 1 Line color read Return value The values indicating the read line type and color are returned 4 202 CHAPTER4 INSTRUCTION REFERENCE PSTAT be PSTAT Function E Function The PSTAT function reads the status of the specified part E Format PSTAT part name m Example of Use MODE PSTAT BUHIN E Description e The PSTAT function reads the status of the part specified in part name e part name is the name of the part whose status is to be read or the D type variable indicating the part e The value indicating the mode of the part can be obtained by executing this function The following numeric values indicate modes 1 Switch input disable status 2 Half tone status 3 Close status E Related Item PMODE E Example of Program evnt input type id data if PSTAT BUHIN 0 then pmode BUHIN 1 endif end evnt 4 203 RANGE E RANGE Statement E Function The RANGE function modifies the area s of the control for which the maximum and minimum display data values were specified E Format RANGE control name area 1 area 2 area 3 area 4 m Example of Use RANGE GRAPH 0 0 100 100 E Description e control name is the gr
24. f types 3 and id if flags 0 then timeid opentim SWT000 and data 1 then settim timeid 10 1 starttim timeid flags 1 else if flag 1 stoptim timeid c flag 0 end if When the timer stops flag 0 executed timeid opentim This function acquires the ID of timeid settim timeid 10 1 This instruction sets the time limit of the timer to generate events in units of 100 milliseconds events repeatedly starttim timeid This instruction starts the timer then osetim timeid the program following the if flag 0 then statement is the timer to be used The ID is assigned for a variable You can set the time limit Parameter 1 following 10 means that the timer generates If it is set to 0 the timer generate only an event You must use these three instructions as a set to operate the timer flag 1 2 40 CHAPTER2 EXAMPLES OF PROGRAMMING 2 5 Creating a Part for Using a Timer In this example the variable flag is used to indicate and retain the timer state flag 1 means that the timer is in operation The statements following else if stop the timer in operation flag 1 stoptim timeid This instruction cancels counting up the timer closetim timeid This instruction cancels the use of the timer obtained with opentim and returns the timer to the system You can use up to 16 times
25. if type 7 then moji left buffer bytes 1 strdsp STROOO mois end if end evnt 4 121 INPUT 8 INSTR Function E Function E Format m Example of Use E Description E Related Item E Example of Program evnt aS t p ins specified p ins string number end evnt tr 1 aS company tr 1 num ab The INSTR function retrieves character strings to find the specified character string When the specified character string is found the function notifies the system of the start position of the character string INSTR start position character strings to be retrieved character string to be found A INSTR 10 MOJI1 MOJI2 e The INSTR function retrieves the character strings specified in character strings to be retrieved to find the character string specified in Character string to be found This retrieval starts at the start position specified in start position When the specified character string is found the function notifies the system of the position in a number of bytes relative to the beginning of the character strings to be retrieved If the specified character string is not found 0 is set e start position is 1 when retrieval starts at the beginning of character strings e Character string variables direct character strings registration character string names and registration character string numbers can be specified in character strings to be retrieved
26. input type id data if type 3 and data 1 then CLOSEPARALLEL 3 else if type 3 and data 0 then REOPENPARALLEL 3 endif end evnt 4 45 CLOSESIO 8 CLOSESIO Statement E Function E Format E Example of Use E Description E Related Item E Example of Program The CLOSESIO statement closes a non procedual communication port CLOSESIO port number CLOSESIO 2 e The CLOSESIO statement closes the port for stopping non procedual communication e port number specifies a channel for stopping non procedual communication CH1 to CH3 correspond to 1 to 3 respectively e The port to be closed must be opened in advance by the OPENSIO statement to be explained later OPENSIO SETSIO WRITESIO WRITWSIOB FLUSH cont global buf S 200 opensio 2 1 bufs setsio 2 amp HD end conf evnt strdsp STROOO buf CLOSESIO 2 end evnt 4 46 CHAPTER4 INSTRUCTION REFERENCE CLOSETIM eg CLOSETIM Statement E Function E Format m Example of Use E Description E Related Item E Example of Program conr static timid setim timid The CLOSETIM statement stops the user of the specified timer CLOSETIM timer number CLOSETIM TIMID CLOSETIM VAR e The CLOSETIM statement returns the timer allocated by the OPENTIM OPENTIM2 or OPENTIM3 function to the system e The system can use up to 16 timers The timers not to b
27. 0 Normal operation status 1 Input disable status 4 198 CHAPTER4 INSTRUCTION REFERENCE PRMSTAT pe 35 _SW_ONOFF Function Range Return value 36 _SL_SYNC Function Range Return value 37 _SL_BORW Function Range Return value 2 Halftone status _SW_ONOFF reads the ON OFF status of a switch _SW_ONOFF is applicable to switches and selector switches When a switch is in the OFF status 0 is returned When a switch is in the ON status 1 is returned When all the selector switches are in the OFF status 0 is returned When one of the selector switches is in the ON status the corresponding element number is returned _SL_SYNC reads the synchronous operation of a switch _SL_SYNC is applicable to switches and selector switches When the synchronous operation is not performed O is returned When the synchronous operation is performed 1 is returned _SL_BORW reads the switch device write method _SL_BORW is applicable to selector switches When the switch device write method is the bit type write method 0 is returned When it is the word type write method 1 is returned e The types and usage of the request codes that can be used by PRMSTAT2 are explained below 1 _PD_DCOLOR Function Range Type Return value 2 _PD_BCOLOR Function Range Type Return value _PD_COLOR reads the display color of a control _PD_DCOLOR is applicable to the ON color specification of numeric cha
28. 1 is returned For the auto repeat switch 2 is returned For a selector switch 3 is returned _SW_ONCOLOR reads a switch ON background color _SW_ONCOLOR is applicable to switches and selector switches The number 0 to 15 of the read switch ON background color is returned _SW_OFFCOLOR reads a switch OFF background color _SW_OFFCOLOR is applicable to switches and selector switches The number 1 to 15 of the read switch OFF background color is returned _SW_BMODE reads the switch background color display method _SW_BMODE is applicable to switches and selector switches When the switch background color display method is direct display 0 is returned When the display method is replacement display 1 is returned _SW_RACT reads whether to perform reverse operation when a switch is ON _SW_RACT is applicable to switches and selector switches If reverse operation is performed when a switch is ON 1 is returned If reverse operation is not performed 0 is returned _SW_BZER reads whether to sound the buzzer when a switch is ON _SW_BZER is applicable to switches and selector switches If the buzzer is sounded when a switch is pressed 1 is returned buzzer is not sounded 0 is returned If the _SW_STAT reads the status normal operation input disable halftone of a switch _SW_STAT is applicable to switches and selector switches One of the following numeric values indicating the switch status is returned
29. 10 VALUE E Description e The DEVRD statement reads data from the device that is offset value away from the device specified in device name e offset value specifies the distance from the device specified in device name The DEVRD statement reads data from the device corresponding to the specified distance offset value must be an integer or floating point type variable or constant e variable name specifies the variable that stores the read data it must be an integer or floating point type variable e The DEVRD statement is used for the device e g CYCLIC 00 D10 10 where continuous cycle is declared in the CYCLIC or CYCLIC2 statement e If the device from which data is to be read does not exist an error occurs e Be sure to use this command in an event block The value 0 is set in the variable since an initialization block or configuration block is executed before reading device data E Related Item CYCLIC EVENTWR DEVWR E Example of Program conf eyelie O07 DLO 5 Declares that data is read from the device that is 5 end conf gt away from D10 evnt input types idl data Reads and displays the continu if id SWT000 and data 1 then ous device value when a switch for i 0 to 4 is pressedfor the continuous id getid NUMOOO i 1 stage numeric display DEVRD 00 D10 i data numdsp NUM000 data next endif end evnt 4 65 DEVWR le DEVWR Statemen
30. 22 23 24 25 26 27 _PL_NUMS Function Range Return value _PL_FIRST Function Range Return value _PL_DVTYP Function Range Return value _PL_ENDI Function Range Return value _PL_SMPMSG Function Range Return value _PL_SMPTME Function Range Return value _PL_DIRECT Function Range Return value _SW_NUMS Function Range Return value _PL_NUMS reads the number of devices being used _PL_NUMS is applicable to all controls except for clock displays The number of devices being used is returned When a doubleword is specified for a numeric display the number of devices is doubled _PL_FIRST reads the start registration number of the registration graphic or character string to be displayed _PL_FIRST is applicable to character and graphic displays The start registration number to be displayed is returned _PL_DVTYP reads the type of the device being used by the control _PL_DVTYP is applicable only to numeric displays For a doubleword 0 is returned For a single word 1 is returned _PL_ENDI reads the doubleword display method _PL_ENDI is applicable only to numeric displays When doublewords are displayed from downward to upward 0 is returned When doublewords are displayed from upward to downward 1 is returned _PL_SMPMSG reads whether to issue messages to the part on which the control is placed when sampling is performed by the control
31. 35 _SW_ONOFF Function Range Return value 36 _SL_SYNC Function Range Return value 37 _SL_BORW Function Range Return value 2 Halftone status _SW_ONOFF reads the ON OFF status of a switch _SW_ONOFF is applicable to switches and selector switches When a switch is in the OFF status 0 is returned When a switch is in the ON status 1 is returned When all the selector switches are in the OFF status 0 is returned When one of the selector switches is in the ON status the corresponding element number is returned _SL_SYNC reads the synchronous operation of a switch _SL_SYNC is applicable to switches and selector switches When the synchronous operation is not performed O is returned When the synchronous operation is performed 1 is returned _SL_BORW reads the switch device write method _SL_BORW is applicable to selector switches When the switch device write method is the bit type write method 0 is returned When it is the word type write method 1 is returned e The types and usage of the request codes that can be used by PRMSTAT2 are explained below 1 _PD_DCOLOR Function Range Type Return value 2 _PD_BCOLOR Function Range Type Return value _PD_COLOR reads the display color of a control _PD_DCOLOR is applicable to the ON color specification of numeric character clock plot free graph meter and lamp displays Specify one of the following 0 Figure read 1 For
32. 4 156 CHAPTER4 INSTRUCTION REFERENCE MKS eg MKS Statement E Function The MKS statement stores data in any position of a character string variable E Format MKS character string variable name storage position character string E Example of Use MKS MOJIS 5 ABCD E Description The MKS statement stores a character string Character string in the position specified by storage position starting from the beginning of the specified character string variable name e storage position must be a integer or floating point type variable or constant 1 specifies the beginning of the character string variable e character string specifies an overwriting character string it must be a variable or constant E Related Item MKB MKW MKI MKF MKID CVB CVW CVI CVF CVID E Example of Program conf end conf evnt org 1234567 strdsp STROOO org MKS orgs 2 76543 strdsp STROO1 Orgs end evnt 4 157 MKW 8 MKW Statement E Function The MKW statement stores data in any position of a character string variable E Format MKW character string variable name storage position integer value E Example of Use MKW MOJI 5 VAR E Description E Related Item E Example of Program cont end conf evnt The MKW statement stores two bytes of integer value in the position specified by storage position starting from the beginning of the specified character string variable name storage posit
33. 8 CYCLIC2 Statement E Function E Format m Example of Use E Description E Related Item E Example of Program conf cyclic2 end conf evnt The CYCLIC2 statement declares that the contents of the specified device are periodically read as a doubleword CYCLIC2 device name device name device name number CYCLIC2 00 D01 00 D10 5 e The CYCLIC2 statement is the same as the CYCLIC statement except that the contents of the device are read as a doubleword e The word having a larger device number is the high order word e No memory table can be declared e When the screen is switched a message is issued to all the parts for which CYCLIC2 is declared INPUT CYCLIC OO d0O1l OO d7 3 input ty id dat if id numdsp end if end evnt 007 dO0l num then dat 4 62 CHAPTER4 INSTRUCTION REFERENCE DATE Eeee i DATE Function E Function The DATE function reads the current date E Format DATES m Example of Use MOJI DATE E Description e The year month and day of the current date to be read are each represented in two digits like YY MM DD The DATE function cannot be used to set a date e Once date is set using the SETDATE command in a model with a battery backup calendar IC GCS56LC or GCS5EM the date is updated even while the power is off If a model with no calendar IC GC53LC or GC53LM is turned off the date is initialized to 98 01 01 and the
34. E Example of Program conf end conf The STRING statement specifies the size of the character string variable to be used STRING variable name size variable name size STRING MOJI 50 The STRING statement is used to specify a size of a local character string variable The STRING statement is adopted to maintain the compatibility with GCSGP3 Use LOCAL instead of STRING in Screen Creator 5 The default size of the character string variable is 20 bytes Use the STRING statement to use a variable whose size is greater than 20 bytes The character string variable must be declared before it is used variable name must end with Specify size with an integer value Two or more character string variable can be specified in one line delimited by a comma GLOBAL STATIC BACKUP LOCAL string Xxx 40 string mojiS 50 4 239 SWFIG 8 SWFIG Statement E Function The SWFIG statement sets the graphic to be displayed when the status of the specified switch changes E Format SWFIG switch name display graphic status sub ID m Example of Use SWEHIG SW1 FIG3 0 0 E Description e The SWFIG statement specifies the graphic to be displayed in the specified switch when the switch changes from the ON status to the OFF status Both the unit switch and selector switch can be used When the selector switch is used its sub ID must be specified e switch name is the name assigned to the switch or the D type
35. E Format SELECT CASE CASE statement list CASE statement list CASE ELSE statement list END SELECT E Example of Use See Example of Program below E Description e The SELECT CASE statement executes the CASE statement list satisfying the specified conditional expression e When CASE CASE ELSE and END SELECT appear after the statements satisfying the specified condition have been executed the SELECT CASE statement executes the statement following END SELECT e Condition judgment can be performed up to 50 times E Related Item IF THEN ELSE m Example of Program evnt input ty id dat select case dat case 1 gt When dat is 1 aaa 1 case 2 3 gt When dat is 2 or 3 aaa 2 case 4 to 10 gt When dat is 4 to 10 aaa 3 case else gt When dat is another value aaa 4 end select end evnt 4 216 CHAPTER4 INSTRUCTION REFERENCE SEND PT SEND Statement E Function The SEND statement sends data to the specified screen part or logical connecting device E Format SEND send destination name m Example of Use SEND BUHIN E Description e The SEND statement sends the data written by the PRINT statement to the specified send destination e send destination name is the name of the screen or part to which data is to be sent the D type variable indicating the name or one of the following logical connecting devices HST Host computer PRN Printer e The screen or part script that received data is
36. END FIELD cannot be written in the global screen program E Related Item FOPEN FCLOSE FPUT FGET E Example of Program cont field 5 global no global mojilS moji2s end field fopen MEMORY 2 5 4 84 CHAPTER4 INSTRUCTION REFERENCE FIELD END FIELD mojilS product name moji2S product number Fh Q bh O n 0 UI end evnt 4 85 FIGCOLOR es FIGCOLOR Statement E Function E Format m Example of Use E Description E Related Item m Example of Program evnt The FIGCOLOR statement changes the tile and colors of the graphic display FIGCOLOR control name tile display color background color FIGCOLOR B000 FIG000 1 2 3 e The FIGCOLOR statement changes the tile and colors of the the graphic display 1 indicates that the color and tile for which 1 was specified remain unchanged e control name is the graphic display name or the ID type variable indicating the graphic display e tile indicates a tiling figure Specify this tiling figure with a numeric value from 0 to 15 e display color is a numeric value indicating the color number of the tile display section Specify this color number with a numeric value from 0 to 15 e background color is a numeric value indicating the color number of the tile background section Specify this color number with a numeric value from 0 to 15 FIGDSP input types id tile
37. GCS55EM or 0 to 479 GCS56LC For absolute move move method is 0 For relative move move method is 1 Absolute move is referenced to the upper left end on the display screen Relative move is referenced to the position of the current part E Related Item None m Example of Program evnt input type id data if type buhin 3 then buhin2 MOVE buhin 10 10 OQ endif end evnt 4 159 MTRCOLOR es MTRCOLOR Statement E Function The MTRCOLOR statement changes the needle color of the meter display E Format MTRCOLOR display name color number m Example of Use MTRCOLOR MTROOO 1 E Description e The MTRCOLOR statement changes the needle color of the meter display e control name is the meter display name or the D type variable indicating the meter display e color number is the number indicating the needle color Specify this color number with a numeric value from 0 to 15 m Related Item MTRDSP E Example of Program evnt input types id mcolor MTRCOLOR MTROOO mcolor end evnt 4 160 CHAPTER4 INSTRUCTION REFERENCE MTRDSP be MTRDSP Statement E Function The MTRDSP statement displays data in the meter display E Format MTRDSP control name display data m Example of Use MTRDSP BUHIN GRAPH 30 0 E Description e The MTRDSP statement displays data value in the meter display e control name is the meter display name or the D type variable indicating the meter display e display data
38. Indicates reading of the display start point 1 Indicates reading of the display end point e The types and usage of the request codes that can be used by PRSTAT3 are explained below 1 _PD_RANGE Function Range Type Return value 2 _PD_BSVAL Function Range Type Return value _PD_RANGE reads the display range of a control _PD_RANGE is applicable to bar graph line chart free graph slide meter and plot displays When reading Xmin specify 0 When reading Xmax specify 1 When reading Ymin specify 2 When reading Ymax specify 3 A value indicating the display range is returned _PD_BSVAL reads the setting value of a base or reference line _PD_BSVAL is applicable to bar graph and line chart displays When changing a base line specify 0 When changing reference line 1 specify 1 When changing reference line 2 specify 2 A value indicating the display range is returned e The types and usage of the request codes that can be used by PRMSTAT4 are explained below 1 _PD_PTRN Function Range Type 1 Type 2 Return value _PD_PTRN reads the display color of a control _PD_PTRN is applicable to bar graph 100 percent bar chart and pie chart displays Specify the number of the bar or zone whose display color is to be changed Specify one of the following 0 Figure read 1 Fore color read 2 Back color read The values indicating the read figure and color number are returned 4 201 PRMSTAT
39. None his is oip 2 When a character string variable is gt When a registration character is specified 4 122 CHAPTER4 INSTRUCTION REFERENCE INSTR pe INT Function E Function The INT function omits the fraction of the value specified in numerical expression to create an integer E Format INT numerical expression m Example of Use A INT 30 1 E Description e The INT function omits the fraction of the numerical expression enclosed in parentheses in the negative direction e The INT function calculates the maximum integer that does not exceed the value specified in numerical expression when omitting the decimal point e When the value specified in numerical expression is negative the INT function omits the figures below the decimal point as follows INT 1 4 gt 1 INT 1 4 gt 2 E Related Item CINT E Example of Program evnt input types id data intvar S INT data numdsp NUM000 intvar end evnt 4 123 INT 8 INTERLOCK Statement E Function E Format m Example of Use E Description E Related Item E Example of Program con The INTERLOCK statement controls transition to the system mode screen INTERLOCK mode INTERLOCK 1 e When mode is 1 the INTERLOCK statement sets the interlock to ON When 0 the INTERLOCK statement sets the interlock to OFF e When the interlock is ON the system mode screen is not displayed even if two dots on a diagonal
40. device name device name number m Example of Use EVENTWR 00 D01 00 D10 5 E Description e The EVENTWR statement declares the device s in a part or screen to which data is to be written This statement only declares the devices to which data is to be written it does not actually write data to the devices e Specifying number enables two or more devices to be continuously declared This continuous declaration however does not mean that data is written to all the declared devices at a time The DEVWR statement is used to actually write data to the declared devices e The devices to which data is to be written must be declared before the DEVWR statement is executed E Related Item CYCLIC DEVRD DEVWR m Example of Program conf EVENTWR OO7D10 5 gt Declares that data is to be written to end conf five devices from D10 evnt input types r id datas gt Writes 10 to the device whose offset devwr 00 D10 data S 10 gt value is data end evnt 4 77 EVNT END EVNT 8 EVNT END EVNT Statement E Function The EVNT END EVNT statements declares the event block area E Format EVNT END EVNT m Example of Use EVNT input ty id data END EVNT E Description e The event block is a program block that operates when it receives a message The contents executed when a switch is pressed or a message is received are written in these statements E Related Item CONF END CONF INIT END IN
41. e conditional expression is the relational operation expression obtained when the operation result is true other than 0 or false 0 e When the operation result is true as a result of executing a conditional expression the THEN and subsequent statements are executed When the operation result is false the ELSE and subsequent statements are executed e The ELSE ELSEIF and subsequent statements can also be omitted e Up to 50 ELSEIF statements can be used in IF THEN END IF None 2 then x 3 then 4 115 INIT END INIT l INIT END INIT Statement E Function E Format m Example of Use E Description E Related Item m Example of Program INIT The INIT END INIT statement declares an area of an initialization block END INIT INIT static VAR END INIT e An initialization block written in a screen program or part program is executed first only once when the program including the block is executed e Write processing which should be executed first only once such as initialization or the like CONF END CONF EVNT END EVNT global moji mo j3i initial value END INI 4 116 CHAPTER4 INSTRUCTION REFERENCE INP PT INP Function E Function The INP function reads 2 byte data from the specified parallel I O port E Format INP port number m Example of Use VAR INP 0 E Description e The INP function reads data from the specified parallel I O p
42. e control name is the meter display name or the D type variable indicating the meter display e display data is the numeric data to be displayed in the meter display e display value cannot be changed even if this statement is issued to the display for which operation parameters are set to effective in the primitive E Related Item MTRCOLOR m Example of Program Cont static name name MTROOO end conf evnt input types id data MTRDSP name data end evnt 4 161 NUMCOLOR ee NUMCOLOR Statement E Function E Format m Example of Use E Description E Related Item m Example of Program conf The NUMCOLOR statement changes the colors and background figure of the numeric display NUMCOLOR control name numeric value display color tile display color background color NUMCOLOR GRAPH 1 2 5 2 e The NUMCOLOR statement changes the display and background colors and tile in the numeric display 1 indicates that the color and tile for which 1 was specified remain unchanged e control name is the numeric display name or the D type variable indicating the numeric display e numeric value display color is the numeric value indicating the color number of the numeric value display section Specify this color number with a numeric value from 0 to 15 e tile indicates the tiling figure Specify this tiling figure with a numeric value from 0 to 15 e display color is the numeric value indi
43. else R endif end evnt if types 3 and data 0 then FOPENPARALLEL 3 4 169 OPENTIM ee OPENSIO Statement E Function The OPENSIO statement opens a non protocol communication port E Format OPENSIO port number mode reception buffer m Example of Use OPENSIO 1 1 moji E Description The OPENSIO statement opens a port for starting non procedual communication port number specifies a channel that performs non procedual communication CH1 to CH3 correspond to 1 to 3 respectively mode specifies the type of non procedual communication Specify 0 binary mode or 1 text mode reception buffer specifies the name of the variable to which the data to be received from an external device is to be written The variable to be specified must be a global or static character string variable When the condition is satisfied after data has been received from a connecting device a reception completion message is issued to the part or screen that executed this statement Two or more parts cannot execute the OPENSIO statement for the same port Binary mode In the binary mode all codes from 0 to OFFh can be transmitted and received In this mode read and write are also enabled by specifying the length of received data Text mode In the text mode codes from 1 to OFFh can be transmitted and received In this mode the end codes of texts are also set and used The end codes are used
44. evnt input type id data if types 3 then tims READTIM timid numdsp NUMO00 tim 100 end if end evnt 4 205 RENAME 8 RENAME Statement E Function The RENAME statement changes a file name or directory name E Format RENAME old file name new file name m Example of Use RENAME A SUBDIR FILE1 FILE2 E Description e A file name can be specified in a full path name including a drive name or in an abbreviated name beginning with a current directory name Example A SUBDIR FILE1 FILE1 e Anew file name must not contain a path name e To change a directory name specify a directory name instead of a file name E Related Item FOPEN KILL MKDIR RMDIR E Example of Program conf global dname 13 pnamel 13 pname2 13 pname3 13 global dsel plsel p2sel p3sel strdsp str rename end conf evnt input types id data if data 1 then paths dnameS dsel pnamel S plsel pname2S p2sel strdsp dsp str paths rename pathS pname3 p3sel end if end evnt 4 206 CHAPTER4 INSTRUCTION REFERENCE REOPENCOM pe REOPENCOM Statement E Function The REOPENCOM statement reopens the temporarily closed serial line E Format REOPENCOM logical device name m Example of Use REOPENCOM HST E Description e The REOPENCOM statement permits the program whose data reception from an external connecting device was temporarily inhibite
45. init nundisp_ NUMDOO 1234 end init Control name conf end conf Program in part Correlation of this part This sample program displays a character string 1234 on the number indicator control which is the only control for the part 2 1 Creating a Part for Displaying Numerics 3 conf to end conf This block is called a configuration block which executes a program between conf and end conf only when a part is displayed on the screen i e a part is opened or the screen is displayed or to be accurate immediately before the screen is displayed The configuration block in this sample program causes no processing 4 evnt to end evnt This portion is called Event Block The program between these statements is executed only when a message is transmitted to this portion In this example no program is processed Note A K Basic program always requires the conf end conf evnt end evnt statements Messages arrive at a part from several devices and parts For details try to use the part actually in the following section and see what messages come External device External devices such as a PLC a host Form inside the part such as a switch Operation program From inside the part such as a switch Part to which messages are to be issued Message issuance 2 14 CHAPTER2 EXAMPLES OF PROGRAMMING 2 1 Creating a Part for Displaying Numerics 2 1 7 Modifying a cre
46. it does not clear data in the buffer e The port to be flushed must be opened in advance by the OPENSIO statement to be explained later E Related Item OPENSIO CLOSESIO WRITESIO WRITWSIOB SETSIO E Example of Program conf global buf S 200 opensio 2 1 bufs setsio 2 amp HD end conf evnt strdsp STROOO buf FLUSH 2 closesio 2 end evnt 4 90 CHAPTER 4 INSTRUCTION REFERENCE FOPEN be FOPEN Statement E Function The FOPEN statement opens the specified file E Format FOPEN file name mode file number m Example of Use FOPEN MEMORY 2 5 E Description e The FOPEN statement opens the file to be read or written e file name specifies the name of the file to be opened The file having the name enclosed in double quotation marks is to be opened Specify the name of the file to be opened with up to eight characters When MEMORY is specified in file name internal memory is handled as a file Currently only MEMORY can be specified in file name e mode specifies the type of the file to be opened with one of the following numeric values 0 Read only file 1 Write only file 2 Read write file When file name is MEMORY the read write file is opened regardless of what value is specified in mode e file number is used when a file is read or written or when a record is set Specify file number directly with a numeric value from 1 to 16 it cannot be specified by a variable e To handle internal me
47. local type S id data cyclic station number lamp connected device address end init conf end conf evnt input type id data if type 16 and id station number lamp connected device address then lampdsp LAM000 data end if end if conf cyclic station number connected device address end conf evnt input type id data if type s 16 and id I station number connected device address then lampdsp LAM000 data end if end if Initialization Block As explained above a cyclic instruction is written in this block Configuration Block Noting is processed Event Block The input and if instructions are the same as that given in 2 2 1 lampdsp LAM000 data The lampdsp instruction displays the ON or OFF color in the Lamp control When the data value is 0 the instruction displays the OFF color When itis 1 the instruction displays the ON color The lanm displayed part has been created Try to set and reset the PLC device bit specified in the program from the PLC You can see the lamp color changes 2 25 2 2 Creating a Part to be Linked to a PLC Device 2 2 3 Switches Set the MO bit to 1 or 0 bit to 1 releasing this switch sets Pressing this switch sets the MO the MO bit to 0 Control to use One Switch control SWT000 Exterior view of part Figure Switch control A program of a switch to be linked a PLC device is gi
48. m Example of Use E Description E Related Item E Example of Program 4 82 The FCLOSE statement closes the specified file FCLOSE file number FCLOSE 5 The FCLOSE statement closes the file specified by file number e file number must match the number of the file opened by the FOPEN statement to be explained later If another file number is specified an error occurs Specify file number directly with a numeric value from 1 to 16 FOPEN FIELD FPUT FGET cont field 5 global no global mojilS moji2s end field fopen MEMORY 2 5 end conf FCLOSE 5 end evnt CHAPTER 4 INSTRUCTION REFERENCE FGET PT FGET Statement E Function The FGET statement reads data from the specified file E Format FGET file number record number m Example of Use FGET 5 3 E Description e The FGET statement reads the contents of the specified record record number in the specified file file number into the variable group declared by FIELD END FIELD e file number specifies the number of the file to be read This file number must match the number of the file opened by the FOPEN statement e record number specifies which record in the file is to be read first In this case the variable group included in FIELD declared in file number is used as one unit record number is 1 when data is read from the beginning of the file E Related Item FOPEN FIELD FCLOSE FPUT m Example of Progr
49. m Example of Use BLTSET BUHIN GRAPH 2 30 0 E Description e The BLESET statement sets the data to be displayed in the 100 percent bar chart display The speed of executing the PRDSP display statement after setting data in each zone is faster than that of modifying all zone values after executing the BLTDSP statement e control name is the name of the belt graph display or the D type variable e zone number indicates which zone data is to be modified The zone number is integer value data starting at 1 e display data is the numeric data indicating the size of each zone in the 100 percent bar chart E Related Item BLTDSP PRDSP E Example of Program evnt BLTSET buhin gpaph 3 20 1 var buhin graph no 4 value 23 BLTSET var no value prdsp var end evnt 4 32 CHAPTER4 INSTRUCTION REFERENCE BREAD eg BREAD Function E Function The BREAD function reads the contents of the specified device or memory table in blocks E Format BREAD device name data read count array variable to which read data is written BREAD memory table name data read count array variable to which read data is written m Example of use BREAD 00 D0001 10 VARI 2 BREAD 00 MTBL S NUMS VARI X E Description e The BREAD function reads the contents of the specified device or memory table in blocks e This function collectively reads data from the specified device by the specified data read count e device name
50. receives amessage Switches and external devices such as a PLC can issue messages Each message contains a sender ID PLC device name part name etc data and so on Part to be used Operation program External device Message ex Data from PLC ae i 1 6 CHAPTER INTRODUCTION CHAPTER 2 EXAMPLES OF PROGRAMMING 2 1 2 1 Creating a Part for Displaying Numerics 2 1 Creating a Part for Displaying Numerics Let s create the part that displays 1234 on the screen In this section try to create a part which displays a numeric value on the OIP for example First create a project on Screen Creator 5 To create a project select Project on the Screen Creator 5 menu then select New Now the Create new property of project dialog box opens Select test in the Project Name field and a model to be used in the Panel field then press the OK button Progct detinetion Connect machinery htt ba irae Proma nares HE beat I Cooprene bnsp shen bald gi Projet toler fcacvewecte Global wreath ian PAD Prajini oddat Library neigt cunnan O brary hie Function fimER isere TP Leruy hhe Tazi tig fanst O A Fejet oir Prajt taid PRES A pat foliar coe 2 2 CHAPTER2 EXAMPLES OF PROGRAMMING 2 1 Creating a Part for Displaying Numerics Then select Library on the Screen Creator 5 menu Select New then select Part Now the part creation window opens Then se
51. stoptim timid else if id SWT001 then closetim timid end if end evnt 4 171 OPENTIM2 ee OPENTIM2 Function E Function E Format m Example of Use E Description E Related Item The OPENTIM2 function allocates opens the timer to be used RET OPENTIM2 timer number RET OPENTIN2 14 The OPENTIM2 function opens the timer specified in timer number timer number specifies the number of the timer to be used Specify this timer number with an integer type value from 0 to 15 When the OPENTIM2 function is executed any of the following value is returned 0 The timer could be opened 1 The timer could not be opened The OPENTIM2 function can be used by the screen or part program being displayed If this function is executed on an undisplayed rear screen an error occurs The allocated timer is not deallocated even if one screen changes to another If the timer is being used by the event type a message is also issued to the rear screen CLOSETIM STARTTIM STOPTIM CONTTIM SETTIM READTIM OPENTIM m Example of Program con static tin OP ENT LEU nid setim 5 tim star end conf evnt input typ if type IM2 5 20 O0 5 id 3 and id data SWT000 then O e stoptim 5 else if i d SWTOO1 then closetim 5 end if end evnt 4 172 CHAPTER4 INSTRUCTION REFERENCE OPENTIM3 eg OPENTIM3 Fu
52. to judge the data to be received E Related Item CLOSESIO SETSIO WRITESIO WRITWSIOB FLUSH IOCTL m Example of Program conf global buf S 200 pos buf OPENSIO 2 setsio 2 end conf evnt amp HD strdsp STROOO buf closesio 2 end evnt 4 170 CHAPTER4 INSTRUCTION REFERENCE OPENTIM es OPENTIM Function E Function The OPENTIM function allocates timer resources E Format OPENTIM m Example of Use VAR OPENTIM E Description e The OPENTIM function allocates the resources necessary to use a timer e The OPENTIM function must be an D type variable because it returns the ID of the timer to be used e The allocated ID can be used to set the timer e The system can use up to 16 timers The timers not to be used must be returned to the system See CLOSETIM e The OPENTIM function can be used by the screen or part program being displayed If this function is executed on an undisplayed rear screen an error occurs e The allocated timer is not deallocated even if one screen changes to another If the timer is being used by the event type a message is also issued to the rear screen E Related Item CLOSETIM STARTTIM STOPTIM CONTTIM WRITETIM READTIM m Example of Program conf static timid timid OPENTIM settim timid 20 0 starttim timid end conf evnt input type id data if type 3 and id SWT000 then
53. variable indicating the name e display graphic is the graphic name or the D type variable indicating the name e status is the integer value indicating whether the graphic is displayed when the switch status is ON or OFF 0 The graphic is displayed when the switch status is OFF 1 The graphic is displayed when the switch status is ON e sub ID is required when the selector switch is used Specify the sub switch number of the selector switch in sub ID The sub switch number in the upper left end is assigned 1 The sub switch numbers increase in the right direction They decrease in the downward direction Specify 0 in sub ID when the selector switch is not used E Related Item None E Example of Program Contr static figid subid onoff figid FIGO3 subid 3 onoff 1 end conf evnt input type id data if type 3 and id SWT000 then SWFIG id figid onoff subid endif end evnt 4 240 CHAPTER4 INSTRUCTION REFERENCE SWMODE be SWMODE Statement E Function The SWMODE statement modifies the status of the specified switch E Format SWMODE switch name mode m Example of Use SWMODE SW1 2 E Description e switch name is the name of the switch whose status is to be modified or the D type variable indicating the switch e mode indicates the status to be modified 0 Normal status 1 Input disable status 2 Half tone status E Related Item None E Example of Progra
54. 212 CHAPTER4 INSTRUCTION REFERENCE ROTATE eg ROTATE Statement E Function The ROTATE function rotates the figure displayed in the graphic display E Format ROTATE control name angle of rotation m Example of Use ROTATE FIG000 2 E Description e control name is the graphic display name or the ID type variable indicating the graphic display e angle of rotation specifies the angle of rotation with one of the following numeric values 0 Rotation of 0 degree 1 Rotation of 90 degrees 2 Rotation of 180 degrees 3 Rotation of 270 degrees E Related Item FIGDSP m Example of Program evnt input ty id fig ROTATE FIGOOO figs end evnt 4 213 RSTAT 8 RSTAT Function E Function E Format m Example of Use E Description E Related Item m Example of Program The RSTAT function checks the status of registered objects RSTAT registration name type option VAR RSTAT GAMENI 0 1 Of registered objects the RSTAT function obtains the number of the object that is number specified by option away from the specified registration name A variable or constant representing a screen name registration character string name or registration graphic name can be specified in registration name Specify 0 in type When option is a positive value the RSTAT function checks the registered objects in ascending order of their numbers When option is a negative value the RSTAT function checks th
55. 5 buff writesiob 1 size buffs end evnt 4 229 SOR pe _______e SQR Function E Function The SQR function calculates a square E Format SQR numerical expression m Example of Use X SQR Y E Description e The SQR function calculates a square for the specified numerical expression numerical expression must be a numeric value greater than or equal to 0 E Related Item None E Example of Program evnt x SOR a 2 b 2 numdsp NUMOOO X end evnt 4 230 CHAPTER4 INSTRUCTION REFERENCE STARTTIM be STARTTIM Statement E Function The STARTTIM statement starts the operation of the specified timer E Format STARTTIM timer number m Example of Use STARTTIM ID STARTTIM VAR E Description e The STARTTIM statement starts the operation of the specified timer The timer starts increment from 0 e timer number is the D type variable indicating the number of the timer that starts increment or an integer type variable from 0 to 15 E Related Item OPENTIM STOPTIM CONTTIM CLOSETIM SETTIM READTIM m Example of Program conf static timid timid opentim settim timid 20 0 STARTTIM timid end conf evnt input types id data if types 3 then tims readtim timid numdsp NUMO00 tim 100 end if end evnt 4 231 STATIC fee STATIC Statement E Function E Format m Example of Use E Description E Related Item m Example of Program
56. BWRITE 00 D0001 10 VAR 1 BWRITE 00 MTBL 20 NUM VAA 1 The BWRITE function writes data to the specified device or memory table in blocks This function collectively write data to the specified device by the specified data write count device name indicates the name of the device to be written device name indicating the write start address data write count specifies the number of data to be continuously written to the specified device write data variable is the variable containing the value to be written to the specified device This variable must be a one dimensional array type variable Data is continuously written to the specified device starting from the location specified by this variable When the array variable is smaller than the data write count 0 is written to the remaining area When the array variable is greater than the data write count the larger part is ignored The number of data that can be written depends on the type of PLC Refer to Serial Communication Manual For memory link a variable can be used as a table number BREAD cyclic 007 M01 static PARAM 10 end conf evnt input types id data if id BWRI T endif end evnt OO MO1 and data 1 then E 00 D10 5 PAARAMS 3 4 34 CHAPTER4 INSTRUCTION REFERENCE CHDIR eg a CHDIR Statement E Function The CHDIR statement changes a directory and or a drive E Format CHDIR directory name m Exam
57. E ATN Function E Function The ATN function calculates the inverse tangent for the numerical expression m Format ATN numerical expression m Example of Use ANGLE ATN X Y E Description The ATN function calculates the inverse tangent value for the numerical expression The result must be a value from 7 2 to n 2 The unit is radian E Related Item TAN m Example of Program pi 3 141592 angle atn pi 4 numdsp num000 angle end evnt 4 15 AUTO ee AUTO Statement E Function E Format m Example of Use E Description E Related Item m Example of Program function userfunc a b AUTO c c a b userfunc c 2 end function 4 16 CHAPTER4 INSTRUCTION REFERENCE The AUTO statement declares an auto variable AUTO variable name variable name AUTO VAR XYZ 2 3 MOJI 20 The AUTO statement declares that the variable is an auto variable An auto variable can be declared and referenced in a function only The value of an auto variable stays valid only while the function of that variable is called and executed The value of an auto variable is initialized when the function is called and execution starts A variable name can be specified in a normal variable arrangement variable or character string variable DIM declaration or STRING declaration is not needed to declare an arrangement variable or character variable The auto variable type is one of the new featu
58. E Example of Program cont static name name FREOOO end conf evnt input type id data FREDSP name datas end evnt 4 98 CHAPTER4 INSTRUCTION REFERENCE FSEEK PT FSEEK Function E Function The FSEEK function changes the read write position of a file E Format FSEEK file number reference position offset m Example of Use AAA FSEEK 12 0 0 E Description e The FSEEK function moves the read write position of the file by the value specified by offset starting from reference position e file number specifies the number of the file opened by the FOPEN statement 0 1 and 2 can be specified in reference position When 0 is specified the FSEEK function moves the read write position starting from the beginning of the file When 1 is specified the function moves the read write position starting from the current position When 2 is specified it moves the read write position starting from the end of the file e Specify offset in bytes Specify a positive value in offset when moving the read write position to the end of the file e The read write position obtained as a result of executing the FSEEK function is returned E Related Item FOPEN FCLOSE FPRINT FWRITE FINPUT E Example of Program conf fopen C TEST 2 5 end conf evnt AAAS 12345 fwrite 5 AAAS ABCD fseek 5 0 0 finput 5 VSTR end evnt 4 99 FSUM 8 FSUM Funct
59. E Function The LEFT function returns a character string the specified number of characters starting from the left of the specified character string E Format LEFT character string number of characters LEFT registered character string number number of characters LEFT registered character string name number of characters m Example of Use A LEFT MOJI 5 A LEFT 4 10 A LEFT TOROKU 8 E Description The LEFT function returns a character string the number of bytes specified in number of characters starting from the left of the specified character string e number of characters specifies the number of bytes of the character string to be fetched with a numeric value from 0 to 255 When number of characters is 0 a null character string is returned e character string is a direct character string or a character string variable e registered character string number is the numerical expression indicating the number registered by GCSGP3 e registered character string name is the name of the character string created by GCSGP3 or the D type variable indicating the name of the character string E Related Item MID RIGHTS E Example of Program evnt bS 12345678 aS LEFTS b 3 cS LEFTS no 3 c LEFTS id 4 end evnt 4 133 LEN ee LEN Function E Function E Format E Example of Use E Description E Related Item E Example of Program len len l
60. E Related Item m Example of Program conf end con evnt input numdsp The SHIFT statement shifts the contents of the specified variable left or right SHIFT variable name shift amount SHIFT VARIABLE 1 e The SHIFT statement shifts the contents bit string of the specified variable by the specified amount left or right e is set in the positions of the bits vacated as a result of the shifting e variable name specifies the variable name used to shift the bit string it must be an integer type variable e shift amount specifies how much the bit string in the variable is to be shifted A numeric value from 31 to 31 can be specified in shift amount When the specified shift amount is positive the SHIFT statement shifts the bit string left When it is negative the SHIFT statement shifts the bit string right None t types id datas NUMOOO data shif numdsp end evn t data 1 NUMO00 data t 4 226 CHAPTER 4 INSTRUCTION REFERENCE SIN PT SIN Function E Function The SIN function calculates a sine for the specified numerical expression E Format SIN numerical expression m Example of Use X SIN ANGLE E Description e The SIN function calculates a sine value for the specified numerical expression The unit for the numeric expression is radian E Related Item ATN COS TAN m Example of Program evnt angle 3 141592 3 x SIN angle numdsp num000 x
61. Example of Program cont field 5 global no global mojilS moji2s end field fopen MEMORY 2 5 end conf evnt no 1 mojilS product name moji2S product number FPUT 5 3 fclose 5 end evnt 4 95 FRECOLOR ie FRECOLOR Statement E Function The FRECOLOR statement changes the tiles and colors of the free graph display E Format FRECOLOR cotrol name tile 1 display color 1 background color 1 tile 2 display color 2 background color 2 m Example of Use FRECOLOR FREO000 2 1 4 5 2 1 E Description e The FRECOLOR statement changes the tiles and colors of the free graph display and the background tiles and colors of the entire display tile 1 indicates that the color and tile for which 1 was specified remain unchanged control name is the free graph name or the ID type indicating the free graph name e tile 1 indicates the tiling figure of the tile display section Specify this tiling figure with a numeric value from 0 to 15 e display color 1 is a numeric value indicating the color number of the tile display section Specify this color number with a numeric value from 0 to 15 e background color 1 is a numeric value indicating the color number of the tile background section Specify this color number with a numeric value from 0 to 15 e tile 2 indicates the background tiling figure of the free graph Specify this tiling figure with a numer
62. If you press the switch of the part that transmits numerical data the same value will be displayed in the part that receives data 2 37 2 5 Creating a Part for Using a Timer 2 5 Creating a Part for Using a Timer 2 5 1 Part for counting up The numeric value is incremented timer start operation When per second like 4 5 6 pressed again it stops When the switch is pressed the Create a timer function part pie Sie a a a a i le Si ei Control to use One Number indicator Control NUMO000 and one Switch Control SWT000 Exterior view of part Figure Switch control SWT000 Number indicator control NUMOOO These two controls overlap each other A program of a part that increments a numerical value is given below init local type id data tatic timeid s static flag static number flag s 0 umdsp NUMOO0O 0 end init B conf end conf 2 38 CHAPTER2 EXAMPLES OF PROGRAMMING 2 5 Creating a Part for Using a Timer evnt input type S id data if types 3 and id SWT000 and data 1 then if flags 0 then timeid opentim settim timeid 10 1 starttim timeid flags 1 else if flag 1 then stoptim timeid closetim timeid flag s 0 end if else if type s 4 then number S number numdsp NUM000 number end if end evnt Initialization Block The definitions of the local variables and static variables
63. MCPY copies the contents of the variable group in the specified field to the character string variable e file number specifies the file number defined in the FIELD declaration e When the contents of the variable group or character string variable are copied the size is used whichever is smaller E Related Item FOPEN FIELD FCLOSE FPUT FGET EOF SOF E Example of Program cont field 5 global no global mojilS moji2s end field global buff 50 opensio 1 0 buffs fopen MEMORY 2 5 end conf evnt nos 1 mojilS product name moji2S product number size sof 5 MCPY 5 buff writesiob 1 size buff end evnt 4 147 MEDIACHK ee MEDIACHK Function E Function E Format m Example of Use E Description The MEDIACHK function checks whether a medium exists in the drive and returns the check result MEDIACHK drive name STATUS MEDIACHK E e The return value is as shown below 0 No medium 1 Medium exists E Related Item MEDIASIZE E Example of Program cont global dname 13 global dsel strdsp str mediachk end conf evnt input types id data if data 1 then strdsp dsp str dname dsel num mediachk dnameS dsel if num 1 then strdsp str valid else strdsp str invalid end if end if end evnt 4 148 CHAPTER4 INSTRUCTION REFERENC
64. ON display color of the lamp display e display name is the name of lamp display or the D type variable indicating the lamp display e color number indicates the color displayed when the lamp display is ON Specify this color number with a numeric value from 0 to 15 E Related Item LAMPDSP E Example of Program conf lampdsp buhin gpaph 0 LAMPCOLOR buhin gpaph 7 lampdsp buhin gpaph 1 end conf 4 131 LAMPDSP i 8 LAMPDSP Statement E Function E Format m Example of Use E Description E Related Item m Example of Program evnt input var The LAMPDSP statement indicates whether the lamp display is ON or OFF LAMPDSP control name lamp mode LAMPDSP BUHIN GRAPH 1 The LAMPDSP statement indicates whether the lamp display is ON or OFF e control name is the name of lamp display or the ID type variable indicating the lamp display e lamp mode indicates whether the lamp display is ON or OFF When lamp mode is 0 the lamp display is OFF When 1 the lamp display is ON e display value cannot be changed even if this statement is issued to the control for which operation parameters are set to effective in the control LAMPCOLOR type id data buhin graph LAMPDSP var data end evnt 4 132 CHAPTER 4 INSTRUCTION REFERENCE LEFT pe LEFT Function E Function The LEFT function returns a character string the specified number of characters starting from the
65. Related Item PIPDSP m Example of Program conf pipdsp buhin graph 0 PIPCOLOR buhin graph 1 7 lampdsp buhin graph end conf 4 178 CHAPTER4 INSTRUCTION REFERENCE PIPDSP PT PIPDSP Statement E Function The PIPDSP statement displays data in the pipe display E Format PIPDSP control name pipe mode m Example of Use PIPDSP BUHIN GRAPH 1 E Description The PIPDSP statement sets the pipe display to OFF ON1 or ON2 for data display e control name is the name of the pipe display or the variable indicating the ID of the pipe display pipe mode sets the pipe display to OFF ON1 or ON2 it specifies 0 1 or 2 for OFF ON1 or ON2 e Display cannot be changed even if the PIPDSP statement is issued to the display for which the operation parameters of the control are set to effective E Related Item PIPCOLOR E Example of Program conf pipdsp buhin pip 0 PIPCOLOR buhin pip 1 7 pipdsp buhin pip 1 end conf 4 179 PLTCOLOR ee PLTCOLOR Statement E Function The PLTCOLOR statement changes the colors and background figure of the plot display E Format PLTCOLOR control name plot color tile display color background color m Example of Use PLTCOLOR GRAPH 1 1 2 1 E Description e The PLTCOLOR statement changes the background tile and colors of the plot display 1 indicates that the color and tile for which 1 was specified remain unchanged e control name is the plot display nam
66. Screen on the menu then select Save Input gamen1 in the Name field test screen in the Comment field and 1 in the Registration No field in the Save Screen dialog box then press the Save button Now the screen with the created part is saved 2 10 CHAPTER2 EXAMPLES OF PROGRAMMING 2 1 Creating a Part for Displaying Numerics Then try to download this screen and display it Connect the downloading cable between the OIP and the personal computer on which Screen Creator 5 is running and bring the OIP into the download condition Select Project on the menu and select Download The download dialog box appears Select Build Transmit in the download dialog box When data to be downloaded is created and it is downloaded properly bring the OIP into the user mode A character string 1234 enclosed in a rectangular frame should be displayed on the OIP If an error occurs while creating data check carefully if the input program is correct If an error occurs while downloading data read carefully the description about downloading in the Operation Manual and check the serial port channel baud rate etc 2 1 Creating a Part for Displaying Numerics 2 1 6 Explanation for coded program content 2 12 The following program was used Tne nundsp NUM000 1234 init init conf end conf evnt end evnt The operation program for this part will be explained in detail below 1 init end init Th
67. The BLTSET statement sets data in a belt graph display E Format BLTSET control name zone number display data m Example of Use BLTSET BUHIN GRAPH 2 30 0 E Description e The BLESET statement sets the data to be displayed in the 100 percent bar chart display The speed of executing the PRDSP display statement after setting data in each zone is faster than that of modifying all zone values after executing the BLTDSP statement e control name is the name of the belt graph display or the D type variable e zone number indicates which zone data is to be modified The zone number is integer value data starting at 1 e display data is the numeric data indicating the size of each zone in the 100 percent bar chart E Related Item BLTDSP PRDSP E Example of Program evnt BLTSET buhin gpaph 3 20 1 var buhin graph no 4 value 23 BLTSET var no value prdsp var end evnt 4 32 CHAPTER4 INSTRUCTION REFERENCE BREAD eg BREAD Function E Function The BREAD function reads the contents of the specified device or memory table in blocks E Format BREAD device name data read count array variable to which read data is written BREAD memory table name data read count array variable to which read data is written m Example of use BREAD 00 D0001 10 VARI 2 BREAD 00 MTBL S NUMS VARI X E Description e The BREAD function reads the contents of the specified device or memory table in blocks e T
68. VAL2 function is used to convert the number specified in character string to a numeric value the result becomes integer type STR var VAL 234 numdsp NUMOOO var end conf 4 250 CHAPTER4 INSTRUCTION REFERENCE WRITESIO WRITESIOB WHILE WEND Statement E Function The instructions between the WHILE and WEND statements are executed while the specified conditional expression is true satisfactory E Format WHILE conditional expression WEND E Example of Use WHILE X gt 0 WEND E Description e When the specified conditional expression is true the instructions between the WHILE and WEND statements are executed When it becomes false the instructions following the WEND statement are executed E Related Item IF THEN ELSE m Example of Program conf static var 10 WHILE i lt 10 var i i 5 WEND end conf 4 251 WHILE WEND 8 WRITESIO WRITESIOB Statement E Function E Format m Example of Use E Description E Related Item m Example of Program The WRITESIO and WRITESIOB statements write transmission data to a non procedual communication transmission buffer WRITESIO port number variable name WRITESIOB port number number of bytes variable name WRITESIO 2 moji WRITESIOB 2 20 moji e The WRITESIO statement writes transmission data to a non procedual communication transmission buffer serial port in the text mode The WRITESIOB statemen
69. _PL_SMPMSG is applicable to plot bar graph and line chart displays When messages are issued to the part 1 is returned When no message is issued O is returned _PL_SMPTME reads a sampling time _PL_SMPTME is applicable to plot bar graph and line chart displays A value indicating the sampling time read value 0 5 second is returned _PL_DIRECT reads the display direction of a line chart _PLI_DIRECT is applicable only to line chart displays When line charts are displayed from right to left 0 is returned When they are displayed from left to right 1 is returned _SW_NUMS reads the number of switch elements _SW_NUMS is applicable to switches and selector switches For a switch 1 is always returned For a selector switch the number of elements is returned 4 197 PRMSTAT ee 28 29 30 31 32 33 34 _SW_TYPE Function Range Return value _SW_ONCOLOR Function Range Return value _SW_OFFCOLOR Function Range Return value _SW_BMODE Function Range Return value _SW_RACT Function Range Return value _SW_BZER Function Range Return value _SW_STAT Function Range Return value _SW_TYPE reads a switch type _SW_TYPE is applicable to switches and selector switches For the momentary switch O is returned For the alternate switch 1 is returned For the auto repeat switch 2 is returned For a selector switch 3 is returned _SW_ONCOLO
70. a 86 series boundary by 2 bytes E Related Item MKS MKB MKW MKI MKF MKID CVB CVW CVI CVIF E Example of Program conf end conf evnt org S 1234567 data CVID org 1 end evnt 4 58 CHAPTER 4 INSTRUCTION REFERENCE CVW a CVW Function E Function The CVW function allocates data from any position of a character string variable E Format CVW character string variable name allocation position E Example of Use VAR CVW MOJI 5 E Description e The CVW function allocates data two bytes from the specified allocation position of the specified character variable name The allocated data is regarded as an integer value e allocation position must be an integer or floating point type variable or constant 1 specifies the beginning of the character string variable e A cut out value is converted into a 86 series boundary E Related Item MKS MKB MKW MKI MKF MKID CVB CVI CVF CVID E Example of Program conf end conf evnt orgs 1234567 data CVW org 3 numdsp NUM000 data Displays amp H3433 end evnt 4 59 CYCLIC 8 CYCLIC Statement E Function E Format m Example of Use E Description E Related Item The CYCLIC statement declares that the contents of the specified device or memory table are periodically read CYCLIC device name device name device name number CYCLIC memory table name memory table name memory table name n
71. a file operation function error message was transmitted can receive information such as a type 8 and data error number E Related Item FOPEN FCLOSE FPRINT FWRITE FINPUT m Example of Program coni ONFERR end conf evnt input ty id dat1 end evnt When an error occurs 8 is set in ty and an error code number is set in dat1 4 166 CHAPTER4 INSTRUCTION REFERENCE OPEN eg OPEN Statement E Function The OPEN statement opens displays the specified part E Format OPEN part name mode m Example of Use OPEN BUHIN 1 E Description e The OPEN statement opens displays the closed part on the screen e part name is the name of the part to be opened or the variable indicating the ID of the part to be opened e mode specifies whether to execute the configuration block of the program attached to the part when the part is opened 0 The configuration block is not executed 1 The configuration block is executed E Related Item CLOSE m Example of Program evnt input types id data if pstat BUHIN 3 then OPEN BUHIN O endif end evnt 4 167 OPENCOM ee OPENCOM Statement E Function E Format m Example of Use E Description E Related Item m Example of Program con The OPENCOM statement declares that the program receives data from a serial line OPENCOM logical device name OPENCOM HST e The OPENCOM statement declares that the program r
72. and id SWTOOO then stoptim 3 else if id SWT001 then conttim 3 end if end evnt 4 51 COPY le COPY Statement E Function E Format m Example of use E Description E Related Item E Example of Program evnt input ty if id end evnt The COPY statement makes a hardcopy of a screen COPY color number COPY 5 The COPY statement makes a hard copy of a displayed screen In the Color Number field a color specified on the color palette of Screen Creator 5 is printed black If color palette number 16 is specified in addition to color palette numbers from 0 and 15 colors of even color palette numbers are printed black If 17 is selected the print colors of number 16 are inversed i e colors of odd color palette numbers are printed black If an even color palette number is specified in monochrome printing the print color is the same as in the case where color palette number 2 is selected If an odd color palette number is specified the print color is the same as in the case where color palette number 1 is selected The Color Number can be specified only when Select Color is selected in Screen Print Mode of Printer Setup of System Setup on the OIP system screen id SWT000 then COPY 8 4 52 CHAPTER4 INSTRUCTION REFERENCE COs ee COS Function E Function The COS function calculates a cosine for the specified numerical expression E Format COS numerical express
73. and usage of the request codes that can be used by PRMCTLI are explained below 1 _PD_STAT Function Range Control value 2 _ PD_DSPFMT Function Range Control value 3 _PD_PTPOS Function Range Control value 4 PD_ZSPRS Function Range Control value 5 _PD_FIGMD Function Range Control value _PD_STAT changes the display format video blinking on and off of a control _PD_STAT is applicable to all controls Set one of the following numeric values indicating the display format 0 Normal display 1 Reversal video display 2 Blinking 3 On and off display normal reversal _PD_DSPFMT changes the display format of a control _PD_DSPFMT is applicable to numeric and character displays The control value depends on whether the numeric or character display is used _PD_PTPOS changes the position of a decimal point _PD_PTPOS is applicable only to numeric displays Set a value indicating the position of a decimal point If a negative value is set PRMCTLI forcibly changes it to 0 _PD_ZSPRS sets zero suppression operation _PD_ZSPRS is applicable only to numeric displays When not perform zero suppression set 0 When performing zero suppression set 1 _PD_FIGMD sets whether to match the size of the graphic to be displayed on a graphic display with that of the display _PD_FIGMD is applicable only to graphic displays When not matching the size of the graphic with that of the graphic di
74. are issued to the error display part ERRPTS on global screen Messages of error numbers 2000 to 2999 are issued only to the error display Following the type and issuer ID of an error the error code the number of the screen where the error occurred and the number of the part where the error occurred are issued to the error display If a screen program error occurs 1 is set as the part number If part ERRPTS does not exist in the global screen the error is displayed in the lowest line of the window screen E Related Item ERRSTAT E Example of Program evnt input ty id dat if id swl then if errstat 1 then errctl 0 else errcel I endif endif end evnt 4 75 ERRSTAT 8 ERRSTAT Function E Function The ERRSTAT function reads the error display position E Format ERRSTAT m Example of Use ERRSTATQ E Description e The ERRSTAT function reads the current error display position e When this function is executed any of the following numeric values indicating the display position is returned When 0 is returned the error is displayed below the screen When 1 is returned the error is displayed in the error display E Related Item ERRCTL E Example of Program evnt input ty id dat if id swl then if errstat 1 then errctl 0 else errcetl 1 endif endif end evnt 4 76 CHAPTER4 INSTRUCTION REFERENCE EVENTWR eg EVENTWR Statement E Func
75. as global subroutine variables Local subroutine Subroutines written on screens other than the global screen are called local subroutines Local subroutines can be used only in the program where they are written If the name of a written local subroutine is also contained in the global subroutine the global subroutine is executed when the local subroutine is called It is possible to give a warning indicating that the local subroutine name and global subroutine name are duplicated when creating download data by writing a LOCAL CHECK statement in such a program For details of using the LOCAL CHECK statement see Chapter 4 Instruction Reference 3 15 3 10 User defined Functions 3 10 User defined Functions Screen Creator 5 supports user defined functions Several arguments are input by a caller the user defined functions are executed and return values are sent to the caller 3 10 1 Definition of user defined functions A user defined function is defined in the format as shown below function function name type declaration character argument 1 argument 2 Program of the function end function The block between function and end function is called a function block It is one of the program elements like the initialization block configuration block event block and subroutine block Itis impossible to write a function block in any other block The function name consists of a character string written in the same manne
76. bytes are received a message is transmitted to the part screen e For the text mode when a terminator code is received a message is transmitted to the part screen A terminator code can be specified only by one byte e The port to be set must be opened by the OPENSIO statement in advance E Related Item OPENSIO CLOSESIO WRITESIO WRITWSIOB FLUSH IOCTL E Example of Program conf global buf S 200 opensio 2 1 bufs SETSIO 2 amp HD end conf evnt strdsp STROOO buf closesio 2 end evnt 4 223 SETTIM 8 SETTIM Statement E Function The SETTIM statement sets the limit time of the specified timer E Format SETTIM timer number time limit timer type m Example of Use SETTIM ID 100 0 SETTIM VAR 200 1 E Description e The SETTIM statement determines the operation of the specified timer The timer must be stopped when it is set timer number is the D type variable indicating the number of the timer whose operation is to be set or an integer type value from 0 to 15 e The time specified in time limit starts to be counted when operation of the specified timer is started It is specified in units of 100 milliseconds e timer type specifies the type of timer to be set Timers are classified into two types normal and interval The normal timer stops when the specified time limit is reached once The interval timer restarts counting from 0 when the specified time limit is reached o
77. chart in the line chart display left or right by one point and displays the points When this statement is executed the values of the points purged from the line chart are returned as a result of the shifting control name is the line chart name or the ID type variable indicating the line chart line number is the value indicating which line in the line chart display is to be shifted This line number starts at 1 When shift direction is 1 line chart data is shifted left and above When shift direction is 1 line chart data is shifted right and below display data indicates the data to be displayed in the vacant area produced as a result of the shifting LNEDSP LNECOLOR LNESHIFT2 input types id data if data gt 0 then Ineshift LNEOOO 1 1 QO abc else abc endif end evnt lneshift LNEOQOO 1 1 100 4 140 CHAPTER4 INSTRUCTION REFERENCE LNESHIFT2 eg LNESHIFT2 Statement E Function The LNESHIFT2 statement shifts the display data of a line chart left or right E Format LNESHIFT2 control name line number shift direction display data m Example of Use A LNESHIFT2 LNE000 1 1 30 E Description Different from the LNESHIFT statement the LNESHIFT2 statement shifts line chart data but does not display it To display line chart data execute the PRDSP statement e The LINESHIFT2 statement is a function that shifts each of the points constituting the line cha
78. convert the number specified in character string to a numeric value the result becomes real type e When the VAL2 function is used to convert the number specified in character string to a numeric value the result becomes integer type STR var VAL 234 numdsp NUMOOO var end conf 4 250 CHAPTER4 INSTRUCTION REFERENCE WRITESIO WRITESIOB WHILE WEND Statement E Function The instructions between the WHILE and WEND statements are executed while the specified conditional expression is true satisfactory E Format WHILE conditional expression WEND E Example of Use WHILE X gt 0 WEND E Description e When the specified conditional expression is true the instructions between the WHILE and WEND statements are executed When it becomes false the instructions following the WEND statement are executed E Related Item IF THEN ELSE m Example of Program conf static var 10 WHILE i lt 10 var i i 5 WEND end conf 4 251 WHILE WEND 8 WRITESIO WRITESIOB Statement E Function E Format m Example of Use E Description E Related Item m Example of Program The WRITESIO and WRITESIOB statements write transmission data to a non procedual communication transmission buffer WRITESIO port number variable name WRITESIOB port number number of bytes variable name WRITESIO 2 moji WRITESIOB 2 20 moji e The WRITESIO statement writes transmission d
79. device specified in device name e offset value specifies the distance from the device specified in device name The DEVRD statement reads data from the device corresponding to the specified distance offset value must be an integer or floating point type variable or constant e variable name specifies the variable that stores the read data it must be an integer or floating point type variable e The DEVRD statement is used for the device e g CYCLIC 00 D10 10 where continuous cycle is declared in the CYCLIC or CYCLIC2 statement e If the device from which data is to be read does not exist an error occurs e Be sure to use this command in an event block The value 0 is set in the variable since an initialization block or configuration block is executed before reading device data E Related Item CYCLIC EVENTWR DEVWR E Example of Program conf eyelie O07 DLO 5 Declares that data is read from the device that is 5 end conf gt away from D10 evnt input types idl data Reads and displays the continu if id SWT000 and data 1 then ous device value when a switch for i 0 to 4 is pressedfor the continuous id getid NUMOOO i 1 stage numeric display DEVRD 00 D10 i data numdsp NUM000 data next endif end evnt 4 65 DEVWR le DEVWR Statement E Function E Format m Example of Use E Description E Related Item m Example of Program
80. display section Specify this color number with a numeric value from 0 to 15 e background color is a numeric value indicating the color number of the tile background section Specify this color number with a numeric value from 0 to 15 BLTDSP input type id zone tile BLTCOLOR BLTOOO zone tile 1 1 4 30 CHAPTER4 INSTRUCTION REFERENCE BLTDSP eg BLTDSP Statement E Function The BLTDSP statement displays data on a belt graph display E Format BLTDSP control name zone number display value m Example of Use BLTDSP BLT000 1 30 E Description e The BLTDSP statement displays data in the specified zone of a belt graph display control name is the name of the graph or the D type variable e The value indicating the zone number in the 100 percent bar chart to be displayed is set in zone position The zone position can be specified with a constant or variable The zone position starts at 1 e display value is the numeric data indicating the size of the data to be displayed in the 100 percent bar chart e display value cannot be changed even if this statement is issued to the display for which operation parameters are set to effective in the control E Related Item BLTCOLOR E Example of Program conf static name name BLTOOO end conf evnt input type id zone data BLTDSP BLTOOO zone data end evnt 4 31 BLTSET 8 BLTSET Statement E Function
81. e oler E araa Ee EE 4 151 MKDIR remenen e 4 152 SELECT CASE END SELECT 4 215 MRE eoe sane agate eee eA 4 153 SEND ince ies 4 216 MR Dare er Milt eit foe detent 4 154 SETALARM eon onen inerea 4 217 MRK UD erior ierre erecek eeure erai 4 155 SETBEEP sacs tev encucapingereausneaeeisiamnteatantierparte 4 218 MKS sunsn en es ehhh 4 156 SETBLIGHT sccsserserscenisshixcatsotnacbespssaaweiteage 4 219 MK Wiisish siestihd ea a ns a 4 157 SETA Pisin cttenih enliven ete 4 220 MOVE senate tnor pooier ee a ERA ENA 4 158 SETLNEPLOT osise 4 221 MTRCOL OR nran onera e ihi 4 159 SEISION aeie eS 4 222 MTRDS Pong tii aii ness 4 160 SETIM ie ha cietes eis ble aed EA 4 223 4 1 Instruction References ee SETTIME suar 4 224 SHIFT merer eia 4 225 n a A idles 4 226 STE DIBRI o E cae 4 227 SOB ese da lected n e ease 4 228 GOR oe neat A E aan 4 229 STARTTIM spiced ia aa 4 230 SIATIC aana aa 4 231 STOP E O E eae cals 4 232 STOP TIN seracnrinernn neinna hh 4 233 T a A AAE AA 4 234 STRCOLOR oninaainisai en anin 4 235 SUNUD AA 4 236 STRFORM ossi 4 237 STRING aca ratin n i 4 238 SW BIG enian i annen 4 239 SWMODE sesexiasacarncccste inani 4 240 SWREA Daeron iibri adietan 4 241 VBE Vin ciao Peas nccleststaciesgsetcets 4 242 SWW RITE osiin 4 243 EDP sacasants A A 4 245 TIMES em aa aA EREA 4 246 GUNDA D sss aise EE AEA 4 247 TIMIN T aeiaai A 4 248 WAU IV AUD uihna binuang 4 249 WHILE WEND osiin 4 250 WRITESIO WRITESIOB sccsssseessss
82. e screen ID specifies a screen name or an D type variable E Related Item GETGID E Example of Program evnt input types id data if types 3 then VAR GETGID NO GETGNO VAR 00 D100 NO end if end evnt 4 107 GETID 8 GETID Function E Function E Format m Example of Use E Description E Related Item m Example of Program conf The GETID function obtains the value of the ID separate from the reference ID by offset GETID object indicated by reference ID offset value ID GETID VARID 10 The GETID function obtains the D type value separate from the reference D type value by the specified offset value object indicated by reference ID specifies an D type variable name a screen name a part name a registration character string graphic name or a device name offset value is the integer or real value indicating the offset from the reference ID to the ID to be obtained When 0 is specified in offset value the reference ID value is obtained When 1 is specified in offset value the ID of the first element of a continuous stage type control is obtained GETOFFSET cyclic 007 d0001 30 end conf evnt input ty id dat offset getoffset 00 d0001 id Error processing corresponding to the offset value etc id getid 00 d0001 o0ffset end evnt 4 108 CHAPTER4 INSTRUCTION REFERENCE GETOFFSET es GETOFFSET Function E
83. end evnt 4 227 SLDDSP CE ei SLDDSP Statement E Function The SLDDSP statement displays data in the slide display E Format SLDDSP control name display data m Example of Use SLDDSP BUHIN GRAPH 30 0 E Description e control name is the slide display name or the D type variable indicating the slide display e display data is numeric data indicating the display position of the point graphic to be displayed in the slide display e display value cannot be changed even if this statement is issued to the display for which operation parameters are set to effective in the control E Related Item None m Example of Program evnt input type id data SLDDSP SLD000 data end evnt 4 228 CHAPTER4 INSTRUCTION REFERENCE SOF eg SOF Function E Function The SOF function calculates the size of a field E Format SOF file number m Example of Use AAA SOF file number E Description e file number is the file number defined in the FIELD declaration This size becomes the size of the file to be actually read or written e The size is calculated in bytes E Related Item FOPEN FIELD FCLOSE FPUT FGET EOF E Example of Program cont field 5 global no global mojilS moji2s end field global buff 50 opensio 1 0 buffs fopen C TEST 2 5 end conf evnt nos 1 mojilS product name moji2S product number size SOF 5 mepy
84. functions as global variables In other words the values of backup variables are lost when the OIP is turned off and are initialized to O s when the OIP is turned on again An OIP with backup memory uses the backup memory for backup variables and RAM files MS DOS file systems or memory files Thus the sum of the memory size used for backup variables and the memory size used for RAM files must be less than the total size of the backup memory The memory size used for RAM files is 3 5 Variables specified in RAM File Setup of System Setup on the OIP system screen Backup memory sizes Backup variable operations GC56LC GC55EM GC53LC GC53LM Local variables Auto variables 63KB Can be backed up 63KB Can be backed up Regarded as global variables Regarded as global variables Local variables denote variables defined by local declarations LOCAL and undeclared variables used in portions other than the screen programs on global screens Local declaration is not allowed in the screen programs on global screens Use LOCAL for local declaration as far as possible in Screen Creator 5 though it is possible to use DIM for local declaration of arrangement variables and STRING for local declaration of character string variables for compatibility with K Basic of GCSGP3 Local variables are initialized every time programs are executed Each integer variable or real number variable is initialized to 0 Each character variable o
85. i a 4 180 ENN D PI DAOI AASS 4 131 PMODE rrin enen e eae ot 4 181 LEFT iissiissiieeseiierseriesrerreerrrresrirrerrren 4 132 PRDSP ssssssserssseseresseerrsesserresesssneseerensseseene 4 182 PEN ae a SAA 4 133 PREVJUMP sssssseesesereirsesesrrreesessrreesessereeees 4 183 E IN ANERE 4 134 PRINT 0 ssscesseesesstesstesstesseesseesssesseeseesenins 4 184 EIN PUT errearen arenen nA 4 135 PRMCTL sssssssesesessssssteeteesesesssssstrereesesssssss 4 185 LNECOLOR r A 4 136 PRMSTA Penoiiescon ginei 4 192 ISI E DAS E O ETEA E EE 4 137 PSTAT ai enn ea a a ea 4 202 LNESE T erota r E NAON 4 138 ENESHIF Peneira e a 4 139 RANGE A A 4 203 ENESHIBT 2er ne teneo eerstes 4 140 READTIM hirere ae 4 204 LEOCADIA 4 141 RENAME i cosszischoign ncabies sucaebsSeretoaeasaceesen nice 4 205 TOGA CHEE Kexteiiss cies de raa 4 142 REOPENCO Midis tenetien ieee le 4 206 COE iena terte aAA E ED 4 144 REOPENPARALLEL ossee 4 207 LOG eree eee E 4 145 RESETALARM eeeeerreeerrrreerrereerrere 4 208 RETURN fits lett h nae A 4 209 MP Yoora tetas beaten tn 4 146 RIGHTS 0 esssesssssecstsssessseesssesssiesenseaanseens 4 210 MEDIACHK ooocccccccccccccceccccccececcccccccccesseceses 4 147 RMDIR cenne teas aie 4 211 MEDIASIZE occcccccccccccccccccececccccccccccccsscceeece 4 148 ROTATE erener a T tive 4 212 MIDS tae na E ea ERAR 4 149 RSTAT sssseseseseesesrsssssstreeeesessssssestreeeesessssss 4 213 INi DA A ERA N E E E E IN a E 4 149 RUN seterienusnni iae a ee duten saedes 4 214 MKB
86. if the screen showing the declared part is not being displayed when another screen is being displayed Usually the declared PLC device communicates to obtain data only when the screen showing the declared part is being displayed ADDCYC ADDCYCID conf ADDCYC2 NUMO000 gt Uses 2X2 as a consecutive stage display end conf evnt input types id data Displays data on the corresponding display id1l addcycid NUM000 Indicates the ID of the device being used i getoffset id1 id 1 Indicates the device to be used relative to the first device id1l getid NUMOOO i Obtains the ID of the corresponding display numdsp idl data Displays the ID on the display end evnt 4 12 CHAPTER4 INSTRUCTION REFERENCE ADDCYCID pe ADDCYCID Function E Function E Format m Example of Use E Description E Related Item E Example of Program The ADDCYCID function obtains the ID of the device that was declared in control name and enabled to be read by even part programs ADDCYCID control name ID ADDCYCID NUMO000 e The ADDCYCID function obtains the ID of the device being used by the control enabled to be read by even part programs and returns the ID type To enable this operation however the operation parameters of the control in the part must be set to effective and the PLC device must be set in the associated operation parameter in advance control name m
87. indicates the name of the device to be read device name indicating the read start address e data read count specifies the number of data to be continuously read from the specified device e The data read from the specified device is set in array variable to which read data is written This variable must be a one dimensional array type variable The data read from the specified device is continuously written starting from the location specified by this variable e When the array variable is smaller than the data read count the data that cannot be written to the array is discarded e The number of data that can be read depends on the type of PLC Refer to Serial Communication Manual e For memory link a variable can be used as a table number E Related Item BWRITE E Example of Program cont cyclic 007 M01 static PARAM 10 end conf evnt input types id data if id 00 M01 and data 1 then BREAD 00 D10 5 PAARAMS 3 endif end evnt 4 33 BWRITE 8 BWRITE Function E Function E Format m Example of use E Description E Related Item m Example of Program conf The BWRITE function writes data to the specified device or memory table in blocks BWRITE device name data write count write data variable BWRITE memory table name data write count write data variable BWRITE 00 D0001 10 VAR 1 BWRITE 00 MTBL 20 NUM VAA 1 The BWRITE function writes data to the specif
88. into a 86 series boundary and saved E Related Item MKS MKB MKW MKF MKID CVB CVW CVI CVF CVID m Example of Program conf end conf evnt orgS 1234567 strdsp STROOO org MKI org 2 amp H39404142 strdsp STROO1 org end evnt 4 155 MKID 8 MKID Statement E Function The MKID statement stores data in any position of a character string variable E Format MKID character string variable name storage position ID value E Example of Use MKID MOJI 5 VAR E Description E Related Item m Example of Program conf end conf evnt The MKID statement stores six bytes of ID value in the position specified by storage position starting from the beginning of the specified character string variable name storage position must be a integer or floating point type variable or constant 1 specifies the beginning of the character string variable ID value specifies an overwriting value it must be an D type variable or constant If an integer or constant of non ID type is specified an error occurs This value overwrites the specified character string variable name The value is converted into a 86 series boundary by 2 bytes and then saved MKS MKB MKW MKI MKF CVB CVW CVI CVF CVID input types id data org 1234567 strdsp MKF org strdsp end evnt STR000 org 2 id STR001 org The character string will not be displayed correctly
89. is applicable only to graphic displays When not matching the size of the graphic with that of the graphic display set 0 When matching the size of the graphic with that of the graphic display set 1 4 187 PRMCTL Ee 6 _PD_WSIZ Function Range Control value 7 _PD_PIPSTAT Function Range Control value 8 _PL_FIRST Function Range Control value 9 PL_SMPMSG Function Range Control value 10 _PL_SMPCTL Function Range Control value 11 _PL_SMPTME Function Range Control value _PD_WSIZ changes the dot size or line width of a display _PD_WSIZ is applicable to plot meter and pipe displays For a plot display set the dot size small to large with a numeric value from 0 to 2 For a meter display set the line width narrow to wide with a numeric value from 0 to 2 For a pipe display set the thickness 1 3 5 or 7 with a numeric value from 0 to 3 _PD_PIPSTAT changes the ON or OFF status of a lamp or pipe display _PD_PIPSTAT is applicable to lamp and pipe displays Set the ON and OFF statuses of the lamp and pipe displays as follows _PL_FIRST changes the start registration number of the registration graphic or character string to be displayed _PL_FIRST is applicable to character and graphic displays Set the value you want to use as the start registration number _PL_SMPMSG specifies whether to issue messages to the part on which the control is placed when sampling is p
90. is the numeric data to be displayed in the meter display e display value cannot be changed even if this statement is issued to the display for which operation parameters are set to effective in the primitive E Related Item MTRCOLOR m Example of Program Cont static name name MTROOO end conf evnt input types id data MTRDSP name data end evnt 4 161 NUMCOLOR ee NUMCOLOR Statement E Function E Format m Example of Use E Description E Related Item m Example of Program conf The NUMCOLOR statement changes the colors and background figure of the numeric display NUMCOLOR control name numeric value display color tile display color background color NUMCOLOR GRAPH 1 2 5 2 e The NUMCOLOR statement changes the display and background colors and tile in the numeric display 1 indicates that the color and tile for which 1 was specified remain unchanged e control name is the numeric display name or the D type variable indicating the numeric display e numeric value display color is the numeric value indicating the color number of the numeric value display section Specify this color number with a numeric value from 0 to 15 e tile indicates the tiling figure Specify this tiling figure with a numeric value from 0 to 15 e display color is the numeric value indicating the color number of the tile display section Specify this color number with a numeric value from 0 to 1
91. line are pressed When power is ON the system mode screen is not displayed even if the upper left edge on the screen is pressed e When lock is activated it must be reset by a program Make a program so that it resets lock securely e A mode specified using the INTERLOCK command in a model with a battery backup calendar IC GC56LC or GC55EM is maintained even while the power is off A mode specified using the INTERLOCK command in a model with no calendar IC GC53LC or GC53LM is lost when the power is turned off Therefore a mode must be specified in a program which is always executed when the power is turned on None INTERCLOCK 1 end conf evnt input tp if id end evnt 1id dat sw the interlock 0 4 124 CHAPTER4 INSTRUCTION REFERENCE IOCTL eg IOCTL Statement E Function The IOCTL statement controls the I O device connected to the OIP E Format IOCTL I O type mode m Example of Use IOCTL 0 0 E Description e Write the integer value indicating the I O device to be controlled in l O type Currently the type of I O device that can be controlled are the PLC switch and non procedure transmission buffer e mode is the integer value indicating how the I O device is controlled e When controlling the PLC specify one of the following values indicating how the PLC is controlled in mode The value used to determine the IO type is 0 0 The PLC is write and read enabled 1 The PLC is write inhibited
92. line are specified by COLOR e If this is used in an initialization block or configuration block drawing is executed after executing this block and accordingly lines are not drawn Be sure to use this in an event block E Related Item COLOR E Example of Program conf Color Ly 0 8 end conf evnt dot 100 200 dot 100 300 color 1 Q 0 line 100 200 100 300 end evnt 4 135 LINPUT 8 LINPUT Statement E Function The LINPUT statement reads data from the specified file E Format LINPUT file number character string variable m Example of Use LINPUT 12 STRING E Description E Related Item m Example of Program conf end conf evnt The LINPUT statement reads data from the file specified by file number into the character string defined by character string variable The data between the current file position and carriage return CR or line feed LF is assigned to character string variable CR and LF however are not assigned file number must match the number of the file opened by the FOPEN statement FOPEN FCLOSE FPRINT FWRITE FINPUT topen CITESTI 2 7 5 AAAS 12345 fwrite 5 fseek 5 linput 5 end evnt AAAS ABCD 0 0 VSTRS The file is written as follows 12345 ABCD CR LF When data is read the variables change as follows VSTRS ALZIAS T ABCD 4 136 CHAPTER 4 INSTRUCTION REFERENCE LNECOLOR E LNE
93. m Format ATN numerical expression m Example of Use ANGLE ATN X Y E Description The ATN function calculates the inverse tangent value for the numerical expression The result must be a value from 7 2 to n 2 The unit is radian E Related Item TAN m Example of Program pi 3 141592 angle atn pi 4 numdsp num000 angle end evnt 4 15 AUTO ee AUTO Statement E Function E Format m Example of Use E Description E Related Item m Example of Program function userfunc a b AUTO c c a b userfunc c 2 end function 4 16 CHAPTER4 INSTRUCTION REFERENCE The AUTO statement declares an auto variable AUTO variable name variable name AUTO VAR XYZ 2 3 MOJI 20 The AUTO statement declares that the variable is an auto variable An auto variable can be declared and referenced in a function only The value of an auto variable stays valid only while the function of that variable is called and executed The value of an auto variable is initialized when the function is called and execution starts A variable name can be specified in a normal variable arrangement variable or character string variable DIM declaration or STRING declaration is not needed to declare an arrangement variable or character variable The auto variable type is one of the new features of Screen Creator 5 BACKUP a BACKUP Statement E Function The BACKUP statement declares a backup
94. maximum subscript value DIM ABC 20 XYZ 4 4 3 LOC e The DIM statement defines the variable defined in variable name as an local variable e A local variable can be read and written only in a program where it is declared The compiler gives a warning if an undefined local variable is used Each local variable is initialized every time the block is executed e If a variable has a subscript enclosed in parentheses an arrangement variable is declared e The number of maximum subscript values in parentheses indicates that of array dimensions In arrays of two dimensions or higher subscripts are specified delimited by a comma e maximum subscript value indicates the maximum value of subscript that can be specified The subscript starts at 0 e A variable can be used as an array variable even if it is not declared in the DIM statement In this case the maximum value of the subscript is 10 e When a character variable is declared in an array the element size can be declared e Defining many arrays makes it impossible to display many screens because the OIP work area becomes small e Screen Creator 5 has a new function for declaring local variables other than arrangement variables distinctively e The DIM statement is provided to maintain the compatibility with GCSGP3 Use LOCAL instead of DIM to declare a local variable e When a DIM statement is used to declare an arrangement variable compatibility with GCSGP3 is main
95. moji2s end field global sum fopen MEMORY 2 5 end conf evnt nos 1 mojilS product name moji2S product number FPE 5 7 3 if LOF 5 gt 100 then fclose 5 end if end evnt 4 145 LOG es LOG Function E Function The LOG function calculates the natural logarithm specified in numerical expression E Format LOG numerical expression m Example of Use A LOG B C E Description e numerical expression must be a numeric value greater than 0 E Related Item EXP E Example of Program conf la log 10 lb log a b end conf 4 146 CHAPTER4 INSTRUCTION REFERENCE MCPY be MCPY Statement E Function The MCPY statement copies the contents of a field to a character string variable E Format 1 MCPY file number character string variable 2 MCPY character string variable file number m Example of Use MCPY 5 moji E Description e The MCPY statement copies the contents of the variable group in a field to a character string variable or the contents of a character string variable to the variable group in a field That is the MCPY statement in the first example 1 MCPY copies the contents of the character string variable to the variable group in the field specified by file number The MCPY statement in the second example 2 MCPY copies the contents of the variable group in the specified field to the character string variable e fil
96. more FIELDs are declared in the same file number in one program the last declared FIELD is valid e FIELD END FIELD cannot be written in the global screen program E Related Item FOPEN FCLOSE FPUT FGET E Example of Program cont field 5 global no global mojilS moji2s end field fopen MEMORY 2 5 4 84 CHAPTER4 INSTRUCTION REFERENCE FIELD END FIELD mojilS product name moji2S product number Fh Q bh O n 0 UI end evnt 4 85 FIGCOLOR es FIGCOLOR Statement E Function E Format m Example of Use E Description E Related Item m Example of Program evnt The FIGCOLOR statement changes the tile and colors of the graphic display FIGCOLOR control name tile display color background color FIGCOLOR B000 FIG000 1 2 3 e The FIGCOLOR statement changes the tile and colors of the the graphic display 1 indicates that the color and tile for which 1 was specified remain unchanged e control name is the graphic display name or the ID type variable indicating the graphic display e tile indicates a tiling figure Specify this tiling figure with a numeric value from 0 to 15 e display color is a numeric value indicating the color number of the tile display section Specify this color number with a numeric value from 0 to 15 e background color is a numeric value indicating the color number of the tile backg
97. name character display color tile display color background color STRCOLOR GRAPH 1 2 5 2 e The STRCOLOR statement changes the background tile and colors of the character display 1 indicates that the color and tile for which 1 was specified remain unchanged e control name is the character display name or the ID type variable indicating the character display e character display color indicates the color in which characters are displayed Specify this character display color with a numeric value from 0 to 15 e tile indicates the background tiling figure of the character display Specify this tiling figure with a numeric value from 0 to 15 e display color is the numeric value indicating the color number of the tile display section Specify this color number with a numeric value from 0 to 15 e background color is the numeric value indicating the color number of the tile background section Specify this color number with a numeric value from 0 to 15 STRDSP STRFORM static name name end conf evnt STR00O0 input type id data 3 then STRCOLOR name 2 1 1 1 if types endif end evnt 4 236 CHAPTER4 INSTRUCTION REFERENCE STRDSP es STRDSP Statement E Function The STRDSP statement displays data in the character display E Format STRDSP control name display data m Example of Use STRDSP BUHIN GRAPH ABCDEF E Description e The STRDSP statement displays data in the cha
98. not executed when the SEND command is issued it is executed when the program that issued the SEND command terminates E Related Item RUN PRINT E Example of Program evnt input ty id dat if ty 3 and id SWT000 then print BUHIN1 dat send B0000 endif end evnt 4 217 SETALARM et SETALARM Statement E Function The SETALARM statement sets an alarm time E Format SETALARM hour minute m Example of Use ID SETALARM 13 30 E Description e The SETALARM statement sets an alarm time in the OIP built in clock When the set alarm time is reached the data indicating this effect is transmitted to the set screen or part program Up to 16 alarms can be used e hour specifies the hour s to be set with a numeric value from 0 to 23 e minute specifies the minute s to be set with a numeric value from 0 to 59 e When the SETALARM function is executed the alarm number is returned The alarm number to be returned is an D type variable e This function can be used by the screen or part program being displayed E Related Item RESETALARM E Example of Program conf static alid alid SETALARM 10 0 end conf evnt input type id data if types 3 then resetalarm alid end if end evnt 4 218 CHAPTER4 INSTRUCTION REFERENCE SETBEEP eg SETBEEP Statement E Function E Format m Example of Use E Description E Related Item E Example of Program conf
99. number The zone number can be specified with a constant or variable The zone number starts at 1 e display value is the numeric data indicating the size of the pie chart to be displayed e display value cannot be changed even if this statement is issued to the display for which operation parameters are set to effective in the control CIRCOLOR static name name end con evnt CIR000 input type id zone data CI end evn CIROOO zone data 4 40 CHAPTER4 INSTRUCTION REFERENCE CIRSET eg CIRSET Statement E Function The CIRSET statement sets data in the pie chart display E Format CIRSET control name zone number display data m Example of Use CIRSET BUHIN GRAPH 2 30 0 E Description e The CIRSET statement sets the data to be displayed in the pie chart display The speed of executing the PRDSP display statement after setting data in each zone is faster than that of modifying all zone values after executing the CIRDSP statement e control name is the name of the pie chart display or the D type variable indicating the pie chart display e zone number indicates which zone data is to be modified The zone number is integer value data starting at 1 e display data is the numeric data indicating the size of each zone of the pie chart E Related Item CIRDSP PRDSP E Example of Program evnt CIRSET buhin gpaph 3 20 1 var buhin graph no 4 value 23 CI
100. of Screen Creator 5 DECLARE EXIT FUNCTION FUNCTIONCHECK 4 101 FUNCTION END FUNCTION m Example of Program declare my_add a b wat conr global x y local sum sums my_add x y end conf FUNCTION my_add a b my_add a tb END FUNCTION 4 102 CHAPTER4 INSTRUCTION REFERENCE F WRITE ee FWRITE Statement E Function The FWRITE statement writes data to the specified file E Format FWRITE file number expression expression m Example of Use FWRITE 12 100 ABCD VAR STRING E Description e The FWRITE statement writes the numeric value or character defined in expression to the file specified by file number e A numeric value a character or a numeric or character variable can be specified in expression e When writing two or more expressions to the file delimit them with a comma Add the code indicating carriage return CR or line feed LF to the end of expression description e A numeric expression is converted to a numeric string and written to the specified file When the numeric string is negative a minus sign is inserted before it e When writing a character string enclose it in double quotation marks e file number must match the number of the file opened by the FOPEN statement E Related Item FOPEN FCLOSE FPUT FPRINT E Example of Program cont fopen C TEST 2 5 end conf evnt vars 2 fwrite 5 123 var
101. reference line Range _PD_BSVAL is applicable to bar graph and line chart displays Type Specify 0 base line change 1 change of reference line 1 or 2 change of reference line 2 Control value Set the value to be changed e The types and usage of the request codes that can be used by PRMCTL4 are explained below 1 _PD_PTRN Function _PD_PTRN changes the display color of a control Range _PD_PTRN is applicable to bar graph 100 percent bar chart and pie chart displays Type 1 Specify the number of the bar or zone whose display color is to be changed Type 2 Specify one of the following 0 Figure change 1 Fore color change 2 Back color change Control value Set the number of the display color to be changed with a numeric value from 0 to 15 2 _PD_LNE Function _PD_LNE changes the display color of a line chart Range _PD_LNE is applicable only to line charts Type 1 Specify the number of the line whose display color is to be changed Type 2 Specify one of the following 0 Line type change 1 Line color change Control value Set the number of the display color to be changed with a numeric value from 0 to 15 4 192 CHAPTER4 INSTRUCTION REFERENCE PRMSTAT be PRMSTAT Function E Function E Format E Example of Use E Description E Related Item m Example of Program The PRMSTAT function reads the attributes of the specified primitive return value 1 PRMSTAT1 control name request co
102. statement clears the display of the specified display E Format CLEAR control name m Example of Use CLEAR NUM000 E Description e The CLEAR statement clears the display of the specified display leaving only the background color e When the slide display is specified the CLEAR statement clears the pointer graphic e When the meter display is specified the CLEAR statement clears the needle e When the clock display is specified the CLEAR statement clears nothing control name is the graph name or the ID type variable indicating the graph display name E Related Item NUMDSP STRDSP FIGDSP SLDDSP MTRDSP FREDSP PLTDSP BARDSP BLTDSP CIRDSP LNEDSP E Example of Program evnt input types id data if data 1 then CLEAR NUMOOO end if end evnt 4 42 CHAPTER4 INSTRUCTION REFERENCE CLOSE eg ee CLOSE Statement E Function The CLOSE statement closes the specified part E Format CLOSE part name m Example of Use CLOSE B000 E Description e The CLOSE statement closes the part displayed on the screen The undisplayed status is called the close status e Nothing is performed even if the CLOSE statement is executed for the closed part e The program is started if the closed part receives a message e part name is the name or ID of the part to be closed E Related Item OPEN E Example of Program evnt input type id data if pstat 0 then close endif end evnt 4 43 CLOSECOM 8 C
103. static timid timid OPENTIM settim timid 20 0 starttim timid end conf evnt input type id data if types 3 then tims READTIM timid numdsp NUMO00 tim 100 end if end evnt 4 205 RENAME 8 RENAME Statement E Function The RENAME statement changes a file name or directory name E Format RENAME old file name new file name m Example of Use RENAME A SUBDIR FILE1 FILE2 E Description e A file name can be specified in a full path name including a drive name or in an abbreviated name beginning with a current directory name Example A SUBDIR FILE1 FILE1 e Anew file name must not contain a path name e To change a directory name specify a directory name instead of a file name E Related Item FOPEN KILL MKDIR RMDIR E Example of Program conf global dname 13 pnamel 13 pname2 13 pname3 13 global dsel plsel p2sel p3sel strdsp str rename end conf evnt input types id data if data 1 then paths dnameS dsel pnamel S plsel pname2S p2sel strdsp dsp str paths rename pathS pname3 p3sel end if end evnt 4 206 CHAPTER4 INSTRUCTION REFERENCE REOPENCOM pe REOPENCOM Statement E Function The REOPENCOM statement reopens the temporarily closed serial line E Format REOPENCOM logical device name m Example of Use REOPENCOM HST E Description e The REOPENCOM
104. the decimal point is returned _PD_ZSPRS reads whether to perform zero suppression _PD_ZSPRS is applicable only to numeric displays When zero suppression is not performed 0 is returned When zero suppression is performed 1 is returned _PD_XNUM reads the number of horizontal direction display digits _PD_XNUM is applicable to numeric and character displays The number of that displayed when horizontal direction half size conversion is performed is returned characters can be _PD_YNUM reads the number of vertical direction display digits _PD_YNUM is applicable only to character displays The number of characters that can be displayed in the vertical direction is returned _PD_DIRECT reads the display direction of a character display _PD_DIRECT is applicable only to character displays For horizontal writing O is returned For columnar writing 1 is returned 4 195 PRMSTAT es 14 16 18 19 _PD_PLTNUM Function Range Return value _PD_LNENUM Function Range Return value _PD_ZNNUM Function Range Return value _PD_FIGMD Function Range Return value _PD_WSIZ Function Range Return value _PD_PIPSTAT Function Range Return value _PD_PLTNUM reads the maximum number of plots that can be displayed on the control _PD_PLTNUM is applicable to plot and line chart displays The maximum number of plots that can be displayed is returned _PD
105. the indicator lamp according to the device value Configuration Nothing is processed Event Block input type id data The input instruction reads messages from the switch and the PLC If the message is from the switch type is set to 3 id is set to SWT000 and data is set to switch ON OFF status 1 or 0 If the message is from the PLC type is set to 16 id is set to the device ID station number and device name and data is set to device value if type 3 and id SWTOO and data 1 then else if type S 3 and id SWTO000 and data 0 then else if type 16 and id station number connected device address end if In this portion the message from the switch writes a value in PLC devices and the message from PLC turns on off of the lamp 2 29 2 3 Creating a Part to be Linked to an External Device 2 3 Creating a Part to be Linked to an External Device 2 3 1 Display for host computer if Skate Se eee Se SS a SS Se Se E Se eo ee Se ee ee Se Connection to the host Create the part that displays the value transmitted from the host on the screen Control to use One Number indicator control NUMO000 Exterior view of part Figure Number indicator control NUMO00 A program of a numeral display used for the host computer is given below init local type id data opencom HST end init conf end conf conf ope
106. the operation parameter is executed and the part is opened when the switch is pressed Note Close the part specified for name of part to open on the screen 2 33 2 4 Creating a Part for Controlling Others 2 4 2 Part for sending receiving numerics to from others Transmission of numeric data Reception of numeric data Press here Create a part that transmits numeric data and a part that receives numeric data First create a part that transmits numerical data Control to be use One Number indicator control NUMO000 and one Switch control SWT000 Exterior view of part Figure Switch control SWT000 Number indicator control NUMOO0 These two controls overlap each other A program of a part for sending numerical data is given below init local type id data cont numdsp NUM000 numeric value to be displayed end init conf end conf 2 34 CHAPTER2 EXAMPLES OF PROGRAMMING 2 4 Creating a Part for Controlling Others evnt input type id data if type 3 and id SWTO00 and data 1 then print numeric value to be displayed send _ remote destination part name end if end evnt Initialization Block numdsp NUMOOO numeric value to be displayed The numdsp instruction in the Configuration Block is necessary to display a numerical value from the beginning Configuration Block Nothing is processed Event Block input type id data The input inst
107. the power is off If a model with no calendar IC GC53LC or GC53LM is turned off the date is initialized to January 1 1998 Thursday and the time to 00 00 00 when it is turned on again The date and time are updated while the power is on E Related Item DATE GETTIME SETDATE SETTIME TIMES E Example of Program conf GETDATE yr mt d dd numdsp NUMOOO yr n n umdsp NUMOO1 mt umdsp NUMO0O02 d end conf 4 105 GETGID PT GETGID Function E Function The GETGID function obtains the ID of the local screen currently being displayed E Format GETGID m Example of Use VAR GETGID E Description e The GETGID function obtains the ID of the local screen currently being displayed e This function cannot be used to obtain the ID of a global screen E Related Item GETGNO m Example of Program evnt input types id data if types 3 then VAR GETGID NO GETGNO VAR 00 D100 NO end if end evnt 4 106 CHAPTER 4 INSTRUCTION REFERENCE GETGNO be GETGNO Function E Function The GETGNO function obtains the registration number of the screen currently being displayed E Format GETGNO screen ID m Example of Use NO GETGNO ID E Description e The GETGNO function obtains the registration number of the screen specified in screen ID e screen ID specifies a screen name or an D type variable E Related Item GETGID E Example of Program e
108. the specified numeric value character code m Format CHR character code E Example of Use MOJI CHR amp H30 E Description e The CHR function assigns the character 1 byte character corresponding to the character specified by character code e character code must be an integer from 1 to 255 e As a result of executing this function the character corresponding to character code is returned E Related Item ASC E Example of Program evnt input type S id data mojiS CHRS datas strdsp STROOO moji end evnt 4 37 CINT fe ________e CINT Function E Function E Format m Example of Use E Description E Related Item m Example of Program evnt The CINT function rounds off a real number and converts it to an integer CINT numerical expression A CINT FLOAT e The CINT function rounds off the value indicated by numerical expression and converts it to an integer e The conversion result range becomes the integer range INT input types id data intvar numdsp end evnt CINT data NUM000 intvar 4 38 CHAPTER4 INSTRUCTION REFERENCE CIRCOLOR E CIRCOLOR Statement E Function The CIRCOLOR statement changes the tile and colors of the pie chart display E Format CIRCOLOR control name zone position tile display color background color m Example of Use CIRCOLOR CIRO00 2 1 2 3 E Description e The CIRCOLOR statement changes the tile and colors of the the pie c
109. timer number is the D type variable indicating the number of the timer that stops increment or an integer type variable from 0 to 15 E Example of Program 4 234 conf static timid timid opentim settim timid 20 0 starttim timid end conf evnt input types id data if type 3 and data 1 then tims readtim timid numdsp NUMO00 tim 100 else STOPTIM timid end if end evnt CHAPTER 4 INSTRUCTION REFERENCE The STOPTIM statement stops the increment operation of the specified OPENTIM STARTTIM CONTTIM CLOSETIM SETTIM READTIM STR PT STR Function E Function E Format m Example of Use E Description E Related Item E Example of Program evnt The STR function converts the specified numeric value to a character string STR numerical expression A STR 123 e An integer or floating point type numerical expression can be specified in numerical expression e When the numeric value specified in numerical expression is negative is added to the beginning of the character string VAL input type id data a STRS data strdsp end evnt hyojiki a 4 235 STRCOLOR 8 STRCOLOR Statement E Function E Format m Example of Use E Description E Related Item m Example of Program conf The STRCOLOR statement changes the colors and background figure of the character display STRCOLOR control
110. to effective in the control NUMCOLOR NUMFORM static name NUMOOO t types id data NUMDSP name data 4 163 NUMFORM ei NUMFORM Statement E Function E Format m Example of Use E Description E Related Item E Example of Program evnt The NUMFORM statement changes the display format of the numeric display NUMFORM control name display method decimal point position NUMFORM HYOJIKI 0 0 e The NUMFORM statement changes the display method of the numeric display This statement can also specify a display method and a decimal point display position control name is the numeric display name or the ID type variable indicating the numeric display e display method is the numeric value indicating any of the following seven display methods 0 Floating point display method 4 Binary representation 1 Integer display method 5 Octal representation 2 Fixed point display method 6 Hexadecimal representation 3 Binary fixed point representation e decimal point position specifies where the decimal point is displayed when display method is 2 fixed point display method To display the decimal point in the first position from the right specify 1 To display it in the second position from the right specify 2 e Binary fixed point representation is the method for writing a decimal point in the specified integer data position e Be sure to execute the NUMDSP statement after executing this statem
111. value indicating the color number of the tile background section Specify this color number with a numeric value from 0 to 15 BLTDSP input type id zone tile BLTCOLOR BLTOOO zone tile 1 1 4 30 CHAPTER4 INSTRUCTION REFERENCE BLTDSP eg BLTDSP Statement E Function The BLTDSP statement displays data on a belt graph display E Format BLTDSP control name zone number display value m Example of Use BLTDSP BLT000 1 30 E Description e The BLTDSP statement displays data in the specified zone of a belt graph display control name is the name of the graph or the D type variable e The value indicating the zone number in the 100 percent bar chart to be displayed is set in zone position The zone position can be specified with a constant or variable The zone position starts at 1 e display value is the numeric data indicating the size of the data to be displayed in the 100 percent bar chart e display value cannot be changed even if this statement is issued to the display for which operation parameters are set to effective in the control E Related Item BLTCOLOR E Example of Program conf static name name BLTOOO end conf evnt input type id zone data BLTDSP BLTOOO zone data end evnt 4 31 BLTSET 8 BLTSET Statement E Function The BLTSET statement sets data in a belt graph display E Format BLTSET control name zone number display data
112. variable E Format BACKUP variable name variable name m Example of Use BACKUP VAR XYZ 2 3 MOJI 20 E Description e The BACKUP statement declares a backup variable Besides the characteristics of a global variable a backup variable has a function to retain its value even if the power supply is turned off e A normal variable an array variable or a character string variable can be specified in variable name e In order to declare arrays and character string type no DIM and STRING declarations are required E Related Item AUTO DIM GLOBAL LOCAL STATIC STRING E Example of Program conr BACKUP a x 2 3 moji 40 BARCOLOR fs __e BARCOLOR Statement E Function The BARCOLOR statement changes the bar color and figure of the bar graph display E Format BARCOLOR display name bar number tile 1 display color 1 background color 1 tile 2 display color 2 background color 2 m Example of Use BARCOLOR BARO00 2 3 1 4 5 2 1 E Description e The BARCOLOR statement changes the bar tiles and colors of the bar graph display and the background tiles and colors of the entire display 1 indicates that the color and tile for which 1 was specified remain unchanged e control name is the name of a bar graph or the D type variable indicating the graph e The value indicating the bar number in the bar graph to be changed is set in bar number The bar number can be specified with a constant or variable The bar
113. variable or constant 1 specifies the beginning of the character string variable real value specifies an overwriting value it must be an integer or floating point type variable or constant When specified in real value an integer type variable or constant is converted to a real number This value overwrites the specified character string variable name The value is converted into a 86 series boundary and saved MKS MKB MKW MKI MKID CVB CVW CVI CVF CVID orgS 1234567 strdsp MKF orgS strdsp end evnt STROOO org 27 Les 23 STROO1 org The character string will not be displayed gt correctly 4 154 CHAPTER4 INSTRUCTION REFERENCE MKI pe MKI Statement E Function The MKI statement stores data in any position of a character string variable E Format MKI character string variable name storage position integer value E Example of Use MKI MOJI 5 VAR E Description The MKI statement stores four bytes of integer value in the position specified by storage position starting from the beginning of the specified character string variable name e storage position must be a integer or floating point type variable or constant 1 specifies the beginning of the character string variable e integer value specifies an overwriting value it must be an integer or floating point type variable or constant When specified in integer value a floating point type variable or constant is converte
114. 0 endif end evnt 4 22 CHAPTER4 INSTRUCTION REFERENCE BCD2BIN eg BCD2BIN Function E Function E Format E Example of Use E Description E Related Item E Example of Program conf The BCD2BIN function converts BCD data to binary data BCD2BIN numerical expression BINDATA BCD2BIN BCDDATA The BCD2BIN function converts the entered BCD data to binary data BIN2BCD cyclic 00 D10 end conf evnt input types id data if types data 16 then BCD2BIN data numdsp NUM000 data endif end evnt 4 23 BEEP ls BEEP Statement E Function E Format E Example of Use E Description E Related Item E Example of Program conf SETB evnt The BEEP statement performs buzzer ON OFF control BEEP command value BEEP 1 e The BEEP statement is a command that sounds and stops the buzzer e When command value is 1 the buzzer sounds when 0 the buzzer stops The SETBEEP statement can be used to set the buzzer ON OFF time SETBEEP EEP 50 20 3 end conf input type id data if id BEEF D 1 else BEE endif end evni SWT000 then 4 24 CHAPTER4 INSTRUCTION REFERENCE BIN2BCD PT BIN2BCD Function E Function The BIN2BCD function converts binary data to BCD data E Format BIN2BCD numerical expression E Example of Use BCDDATA BIN2BCD BINDATA
115. 0 OPENTIM2 oiei contests aes 4 171 OPEN TIM 3 nosan cede 4 172 READ TIM citscepiedesoctesseatett ite esti alata telson 4 204 RESETALARM eionnus 4 208 SETALARM wiecccieeieheii ite 4 217 SETTIM i leer ceded teva eb cece NE 4 223 START TEM snein icti 4 230 STOPTIM a sich iii Be toate 4 233 4 7 4 2 Indexes by Functions ee PLC memory link communication Time date GETTIME SETDATE 4 8 CHAPTER4 INSTRUCTION REFERENCE System control Compiler control LOCALCHECK 4 2 Indexes by Functions 4 9 ABS fee ABS Function E Function E Format E Example of Use E Description E Related Item E Example of Program evnt The ABS function calculates an absolute value ABS numerical expression AA ABS 50 AA ABS Var The ABS function calculates the absolute value of the numerical expression numeric constant integer type variable or floating point type variable enclosed in parentheses None input type id data if data lt 0 then data abs data numdsp end evnt num000 datas 4 10 CHAPTER4 INSTRUCTION REFERENCE ADDCYC eg ADDCYC Statement E Function The ADDCYC statement enables even BASIC of a part to read the device declared in control name E Format ADDCYC control name m Example of Use ADDCYC NUMO000 E Description e When a control in a part is used to validate an operation parameter the ADDCYC statement enables even a part program to cyclica
116. 0 then REOPENPARALLEL 3 endif end evnt 4 45 CLOSESIO 8 CLOSESIO Statement E Function E Format E Example of Use E Description E Related Item E Example of Program The CLOSESIO statement closes a non procedual communication port CLOSESIO port number CLOSESIO 2 e The CLOSESIO statement closes the port for stopping non procedual communication e port number specifies a channel for stopping non procedual communication CH1 to CH3 correspond to 1 to 3 respectively e The port to be closed must be opened in advance by the OPENSIO statement to be explained later OPENSIO SETSIO WRITESIO WRITWSIOB FLUSH cont global buf S 200 opensio 2 1 bufs setsio 2 amp HD end conf evnt strdsp STROOO buf CLOSESIO 2 end evnt 4 46 CHAPTER4 INSTRUCTION REFERENCE CLOSETIM eg CLOSETIM Statement E Function E Format m Example of Use E Description E Related Item E Example of Program conr static timid setim timid The CLOSETIM statement stops the user of the specified timer CLOSETIM timer number CLOSETIM TIMID CLOSETIM VAR e The CLOSETIM statement returns the timer allocated by the OPENTIM OPENTIM2 or OPENTIM3 function to the system e The system can use up to 16 timers The timers not to be used must be returned to the system If allocating more than 16 timers is attempted an error occurs e tim
117. 000 data The numdsp instruction displays data specified as a variable data in the number indicator control specified as NUMO00 The variable data in the numdsp instruction has the same value as that of data of the input instruction PLC device This displays the PLC device value on the screen The flow of this program is as follows The PLC device value is observed because the cyclic instruction is used in the Initialization Block If the PLC device value changes a message is issued to this part and the newest PLC device value is displayed on the screen by numdsp instruction Try to change the numerical value of the device used in this program from the PLC You can see the numerical value on the screen changes simultaneously How to make the part easier to use If you want to observe plural PLC devices on one screen you must rewrite and arrange two or more parts accordingly each of which has a different device name This will make you troublesome The Parameter function will make this operation easier cyclic station number num connected device address A character string enclosed in a pair of brackets as shown above is called a template A maximum of 32 half size characters can be written in Since a character string written in brackets is displayed in the template of the corresponding part the part can be used like a standard part A a result you only ha
118. 1 NUMO00 _PD_STAT 2 endif end evnt 4 186 CHAPTER4 INSTRUCTION REFERENCE PRMCTL eg e The types and usage of the request codes that can be used by PRMCTLI are explained below 1 _PD_STAT Function Range Control value 2 _ PD_DSPFMT Function Range Control value 3 _PD_PTPOS Function Range Control value 4 PD_ZSPRS Function Range Control value 5 _PD_FIGMD Function Range Control value _PD_STAT changes the display format video blinking on and off of a control _PD_STAT is applicable to all controls Set one of the following numeric values indicating the display format 0 Normal display 1 Reversal video display 2 Blinking 3 On and off display normal reversal _PD_DSPFMT changes the display format of a control _PD_DSPFMT is applicable to numeric and character displays The control value depends on whether the numeric or character display is used _PD_PTPOS changes the position of a decimal point _PD_PTPOS is applicable only to numeric displays Set a value indicating the position of a decimal point If a negative value is set PRMCTLI forcibly changes it to 0 _PD_ZSPRS sets zero suppression operation _PD_ZSPRS is applicable only to numeric displays When not perform zero suppression set 0 When performing zero suppression set 1 _PD_FIGMD sets whether to match the size of the graphic to be displayed on a graphic display with that of the display _PD_FIGMD
119. 1 area 2 area 3 area 4 m Example of Use RANGE GRAPH 0 0 100 100 E Description e control name is the graph name or the D type variable indicating the graph e The maximum and minimum area values in the control can be set for each display as follows Area 1 Area 2 Area 3 Area 4 Plot display Minimum Maximum Minimum Maximum horizontal horizontal vertical vertical value value value value Bar graph display Minimum Maximum Base value value value Line chart display Minimum Maximum value value Free graph display Minimum Maximum value value Slide display Minimum Maximum value value Meter display Minimum Maximum value value is ignored even if it is specified E Related Item None E Example of Program evnt input types id min max if types 3 then range MTROOO min max 0 0 endif end evnt 4 204 CHAPTER4 INSTRUCTION REFERENCE READTIM eg READTIM Function E Function The READTIM function reads the current value of the specified timer E Format READTIM timer number m Example of Use DD READTIM TNO DD READTIM VAR E Description e The READTIM function reads the current elapse time of the operating timer This time is read in units of 100 milliseconds e timer value is the D type variable indicating the number of the timer to be read or an integer type value from 0 to 15 E Related Item OPENTIM STARTTIM STOPTIM CLOSETIM CONTTIM WRITETIM m Example of Program conf
120. 10 CV IW tsi hott Ale eine ot atheists 4 59 ADDY Ceao eee a assis atte See 4 11 CY CEIGC peeraa A etait 4 60 ADDCY C2 is hitler igesses e a nets 4 12 CYCLIC2 anien eio o iar i esate as 4 62 ADDCYCID enan eet 4 13 ASG nh Teea E a EEEE Sa Ro h 4 14 DATES rre a a AE ees 4 63 ATN a T AE E cate dead 4 15 DECLARE AE AT 4 64 AUTO sh aisevits tisdesghtacaneyn tgtestgnalwbedtasscteventibartte 4 16 DEVRD ici iia eee e E S 4 65 DEV WR aaora eee ain 4 66 BACKUP erorar rena addaranians 4 17 DIM a aerea na Na eie EEr tSt 4 67 BARCOLOR mesoorei ite tineia a 4 18 DIR hetitai T E a cet os 4 69 BARDS P i a an AAAA TAAS 4 20 DINV eretan EEE A eh 4 71 BARSE aaea aer eE NSE he 4 21 DOT MA E NN E EAS 4 72 BARSHIPT cctech nc EREE 4 22 DSPMODE aeree TAE 4 73 BED2BUN osinetan eeinetan 4 23 BEEP D neen e Rs 4 24 BOE AS E ESES 4 74 BIN2Z BED ecis er sates 4 25 ERRE Thera AE EAA AER 4 75 BISET arnon nr A 4 26 ERRSTA Tirena n n ee E teehee 4 76 BLESS Diran ae a E E NE A 4 27 EVENTWR eeaeee iE AEE e 4 77 BEC TE titanate aren anid 4 28 EVNET END EVN Tasicccastecesisecdeisscceecines 4 78 BESTA eisai aan wives 4 29 EXECPRCODE eenia a cen 4 79 BE TCOLORS arnee ei ET EE i 4 30 EXIT FUNCTION e ereternerirusresris eesriie 4 80 BLTDS Pie heii geitene tenis essri iesene 4 31 EXP agaia ee CAA Ra 4 81 BLETSEYF ozi decent eel eee eee 4 32 BREAD oenen EA 4 33 FELOSE etus i 4 82 WRITE eeni eneeier 4 34 POGET ss dana n A a ts 4 83 FIELD a END FIEL Dinrniasecinannn 4 84 CHDIR e arii ea
121. 129 PIPRDS Pesne ieas ah ie ste iets 4 178 PLT COLOR mrii teenoor cer iine 4 179 LAMPCOLOR O 4 130 PETDSP aeea i a 4 180 ENN D PI DAOI AASS 4 131 PMODE rrin enen e eae ot 4 181 LEFT iissiissiieeseiierseriesrerreerrrresrirrerrren 4 132 PRDSP ssssssserssseseresseerrsesserresesssneseerensseseene 4 182 PEN ae a SAA 4 133 PREVJUMP sssssseesesereirsesesrrreesessrreesessereeees 4 183 E IN ANERE 4 134 PRINT 0 ssscesseesesstesstesstesseesseesssesseeseesenins 4 184 EIN PUT errearen arenen nA 4 135 PRMCTL sssssssesesessssssteeteesesesssssstrereesesssssss 4 185 LNECOLOR r A 4 136 PRMSTA Penoiiescon ginei 4 192 ISI E DAS E O ETEA E EE 4 137 PSTAT ai enn ea a a ea 4 202 LNESE T erota r E NAON 4 138 ENESHIF Peneira e a 4 139 RANGE A A 4 203 ENESHIBT 2er ne teneo eerstes 4 140 READTIM hirere ae 4 204 LEOCADIA 4 141 RENAME i cosszischoign ncabies sucaebsSeretoaeasaceesen nice 4 205 TOGA CHEE Kexteiiss cies de raa 4 142 REOPENCO Midis tenetien ieee le 4 206 COE iena terte aAA E ED 4 144 REOPENPARALLEL ossee 4 207 LOG eree eee E 4 145 RESETALARM eeeeerreeerrrreerrereerrere 4 208 RETURN fits lett h nae A 4 209 MP Yoora tetas beaten tn 4 146 RIGHTS 0 esssesssssecstsssessseesssesssiesenseaanseens 4 210 MEDIACHK ooocccccccccccccceccccccececcccccccccesseceses 4 147 RMDIR cenne teas aie 4 211 MEDIASIZE occcccccccccccccccccececccccccccccccsscceeece 4 148 ROTATE erener a T tive 4 212 MIDS tae na E ea ERAR 4 149 RSTAT sssseseseseesesrsssssstreeeesessss
122. 15 e tile 2 indicates the background tiling figure of the free graph Specify this tiling figure with a numeric value from 0 to 15 e display color 2 is a numeric value indicating the color number of the tile display section of the background Specify this color number with a numeric value from 0 to 15 e background color 2 is a numeric value indicating the color number of the tile background section of the background Specify this color number with a numeric value from 0 to 15 E Related Item FREDSP 4 96 CHAPTER4 INSTRUCTION REFERENCE FRECOLOR PT E Example of Program conf static name name FREOOO end conf evnt input types id data if types 3 then FRECOLOR name 2 3 1 4 5 2 endif end evnt 4 97 FREDSP 8 FREDSP Statement E Function The FREDSP statement specifies the value to be displayed in the free graph display E Format FREDSP control name display value m Example of Use FREDSP B000 FRE000 50 E Description e The FREDSP statement specifies the value to be displayed in the free graph control name is the name of the free graph display or the ID type variable indicating the free graph display e display value is the value specifying the filling range in the free graph display e display value cannot be changed even if this statement is issued to the display for which operation parameters are set to effective in the primitive E Related Item FRECOLOR
123. 174 CHAPTER4 INSTRUCTION REFERENCE OUTBIT eg OUTBIT Statement E Function The OUTBIT statement rewrites the specified BIT number of the specified output port E Format OUTBIT port number BIT number write data E Example of Use OUTBIT 0 10 1 E Description e The OUTBIT statement rewrites the specified BIT number of the specified output port e Specify port number and BIT number with an integer value relative to 0 e When write data is 0 the output is set to OFF When 1 the output is set to ON e The lowest order bit number of the parallel IO is O and the next lowest order bit number is 1 That is the BIT number is sequentially incremented e If an unexisting port or BIT number is specified an error occurs E Related Item INP OUT INPBIT OUTBITSTAT OUTSTAT E Example of Program evnt DATA INPBIT 0 3 if data 0 then outbit 0 3 1 endif end evnt 4 175 OUTBITSTAT 8 OUTBITSTAT Function E Function The OUTBITSTAT function reads the specified BIT number of the specified output port E Format OUTBITSTAT port number BIT number m Example of Use DATA OUTBITSTAT 0 10 E Description e The OUTBITSTAT function reads the specified BIT number of the specified output port e Specify port number and BIT number with an integer value relative to 0 e The lowest order bit number of the parallel IO is O and the next lowest order bit number is 1 That is the BIT number is sequentially increme
124. 2 WRITE eeni eneeier 4 34 POGET ss dana n A a ts 4 83 FIELD a END FIEL Dinrniasecinannn 4 84 CHDIR e arii ea ene e EIS aA 4 35 FIGCOLOR ohier a eE E 4 86 CHETIN oeeie EE 4 36 FIGDSP ereiten ieee reae e NACE ATSE 4 87 CHR Sotside tige oea e eSEE 4 37 FIGFORM nenea nanna Aaa 4 88 CIN TRE orn Gees A 4 38 FPINPUT epia a E 4 89 CIRCOLOR eieae ahs ein edt Seton 4 39 PW SH oire eera eranan 4 90 CIRDS Pd e aaen aeeai 4 40 FOREN retener tete Site E ee 4 91 CIRSE Tuar e ea E K OE Aa 4 41 FOR TO NEX Lnonnrenn ae 4 92 CLEAR osien r E ee 4 42 FORMA Torenlaan a paa ai 4 93 CLOSE sku Sa e a ae 4 43 JEI A S NE EEEE techn eit E 4 94 CLOSECOM etetni aret 4 44 PUD EEE E E ETE 4 95 CLOSEPARALLE niiti icduseacaieessseieeborsseatens 4 45 FRECOLOR anneden tate 4 96 CLOSESIO fic fcicteehac i ee n e r aN 4 46 PREDS P siinne eaa T 4 98 CLEOSETIM sitesi dhvesiascephieestvetanttanstechine 4 47 FS EA E E S IE ET E 4 99 COLORS seien inent eiernes antenen r 4 48 FSUM eoni A 4 100 CONF END CONF 4 49 FUNCTION END FUNCTION 4 101 CONS Sai ieee han ae 4 50 FWRI E eoin a a a 4 103 CONTTIM er acces sek heeri ees intrede reana aai 4 51 COPY maeneene e a as 4 52 GETBLIGHT oe an aa a A 4 104 COS eaa a 4 53 GETDATE AS T 4 105 CURDIR ssssesesssssstetreesessssssestrereesesssssseseeees 4 54 CAKE i D A 4 106 CV Balete a aaa eera esn Eo Eae t 4 55 GERTEGNO EE 4 107 CVE aerun e a aT ets Beant 4 56 GBT a D AAA TETA 4 108 CAA E emer ENN E ee eee 4 57 GETOF
125. 45 SWWRITE es __e TAN Function E Function The TAN function calculates a tangent for the specified numerical expression E Format TAN numerical expression m Example of Use X TAN ANGLE E Description e The TAN function calculates a tangent value for the specified numerical expression The unit for the numeric expression is radian E Related Item ATN SIN COS E Example of Program evnt angle 3 141592 3 x TAN angle numdsp num000 x end evnt 4 246 CHAPTER4 INSTRUCTION REFERENCE TAN eg TIME Statement E Function The TIME statement reads the current time E Format TIME m Example of Use A TIME E Description The TIME statement reads the current time with a character string of H M S format e This statement cannot be used to set the current time e Once time is set using the SETTIME command in a model with a battery backup calendar IC GCS56LC or GC55EM time is updated even while the power is off If a model with no calendar IC GC53LC or GC53LM is turned off the date is initialized to 98 01 01 and the time to 00 00 00 when it is turned on again The date and time are updated while the power is on E Related Item DATE GETDATE GETTIME SETDATE SETTIME E Example of Program cont mojiS TIMES strdsp STROOO moji end conf 4 247 TIME fe TIMID Function E Function The TIMID function changes an integer type timer number to an D type timer number E Fo
126. 5 e background color is the numeric value indicating the color number of the tile background section Specify this color number with a numeric value from 0 to 15 NUMDSP NUMFORM static name name end conf evnt NUMO 00 input type id data 3 then NUMCOLOR name 2 1 1 1 if types endif end evnt 4 162 CHAPTER4 INSTRUCTION REFERENCE NUMDSP pe NUMDSP Statement E Function E Format m Example of Use E Description E Related Item E Example of Program conr end con evnt inpu name f end evn The NUMDSP statement displays data in the numeric display NUMDSP control name display data NUMDSP BUHIN GRAPH 30 0 The NUMDSP statement displays data value in the numeric display control name is the numeric display name or the ID type variable indicating the numeric display display data is the numeric data to be displayed in the numeric display Specifying a primitive name in display name when the numeric display is of continuous stage type enables the same data to be displayed for all the elements When setting a value for each element use the GETID function to obtain the control ID and specify this ID in control name display value cannot be changed even if this statement is issued to the display for which operation parameters are set to effective in the control NUMCOLOR NUMFORM static name NUMOOO t types id data NUM
127. ABCD XYZ CR LF 4 103 GETBLIGHT ae GETBLIGHT Statement E Function E Format m Example of Use E Description E Related Item The GETBLIGHT statement reads the time that lasts till the back light is turned off GETBLIGHT variable name GETBLIGHT VAR variable name specifies the variable used to write the time that lasts till the back light is turned off The unit for the read values is minute When 0 is specified the back light is not turned off SETBLIGHT m Example of Program conf GETI LIGHT var var var 2 setblight var end conf 4 104 CHAPTER 4 INSTRUCTION REFERENCE GETDATE eg GETDATE Statement E Function The GETDATE statement obtains the data representing a date E Format GETDATE year read variable month read variable day read variable day of week read variable E Example of Use GETDATE YEAR MONTH DATE DAY E Description e The GETDATE statement writes the current date value to year read variable month read variable day read variable and day of week read variable e Year is the low order two digits of A D Month is a numeric value from 1 to 12 Day is a numeric value from 1 to 31 The day of the week is a numeric value from 0 to 6 Sunday to Saturday e Read variables must be integer type variables e Once date is set using the SETDATE command in a model with a battery backup calendar IC GCS56LC or GCS5EM the date is updated even while
128. AR1 by VAR2 Relational operators are used to compare two numeric values The comparison result is true 1 or false 0 equal to lt gt not equal to lt less than gt greater than lt less than or equal to gt greater than or equal to 3 10 CHAPTER3 CODING RULES is used like VAR1 VAR2 When two values VAR1 and VAR2 are equal the result becomes true lt gt is used like VAR1 lt gt VAR2 When two values VAR1 and VAR2 are not equal the result becomes true lt is used like VAR1 lt VAR2 When VART1 is less than VAR2 the result becomes true gt is used like VAR1 gt VAR2 When VAR 1 is greater than VAR2 the result becomes true lt is used like VAR1 lt VAR2 When VAR1 is less than or equal to VAR2 the result becomes true gt is used like VAR1 gt VAR2 When VAR1 is greater than or equal to VAR2 the result becomes true 3 6 Expressions and Operations Logical operators NOT NOT is used like NOT VAR Logical negation applies to the numerical expression variable or constant following NOT AND AND is used like VAR1 AND VAR2 VAR1 and VAR2 are ANDed for each bit OR OR is used like VAR1 OR VAR2 VAR1 and VAR2 are ORed for each bit XOR XOR is used like VAR1 XOR VAR2 VAR1 and VAR2 are XORed for each bit Logical operators are used to operate two numeric values for each bit For NOT however inversion is applied for each bit Character operat
129. ASIC HST host computer PRN printer BCR bar code reader MCR magnetic card reader TKY ten key pad ICC memory card and SIO serial port can be written as logical device names Logical devices are connected to the OIP e For figures and texts the names assigned to register them can be written as they are e PLC device names are written as 00 D100 and 00 M10 etc 3 4 Constant Declaration Constant Declaration In Screen Creator 5 it is possible to declare constants Declaring constants means giving constant names to constants in frequent use and using such constant names instead of constant values in programs The character constants integer constants and real number constants can be declared It is impossible to declare ID constants Constant declaration allows the user to change the values of constants in programs at a time It also makes programs easy to read Declare a constant as shown below const constant name constant value A constant name is a character string which is created in the same manner as creating a variable name and enclosed in a pair of symbols The constant value is as described in 3 3 above Example const pai 3 1415 When the pai constant is declared as shown above all pai constants in the programs are replaced with the value of 3 1415 Constants can be declared in portions other than the screen operation programs on a global screen If a constant is declared in a screen operation p
130. BCD to the memory table beginning with the address indicated by START 3 25 3 16 File Systems 3 16 File Systems This section describes the features of the file systems and the commands for accessing the file systems In the OIP the backup memory and external memory cards can be used as MS DOS compatible file systems These are called MSDOS file systems Specify a drive name Drive name Description Drive A A part of the backup memory is used as the MS DOS file system Drive E Memory card drive Use a serially connected memory card In addition memory files are available In memory files memory images are read and written from into the system memory To access a memory file use the file name MEMORY File systems or memory files created in the backup memory are also called RAM files Only OIP units with built in backup memory can use RAM files The backup memory stores data in it even when the OIP is turned off A model with no backup memory cannot use file systems or memory files in the backup memory KDPS648CA KDPS640EHA KDP5320CA KDP5320LA None Not available 3 16 1 Precautions for file systems Memory Memory files are managed not in the form of file systems Since the same system memory is used it is impossible to use the drive A and MEMORY simultaneously Precautions for using backup memory for RAM files To use the backup memory for RAM files i e files in drive A or MEMORY files it is necess
131. CDEFG 123456 94 03 21 11 34 TEST2 C 256 93 05 05 12 07 DOWNLOAD OIP lt DIR gt 87 02 14 21 13 KBASIC lt DIR gt 93 12 24 8 25 DATA_007 32 89 10 10 10 42 In this example seven data are created in character strings of 280 bytes in all The label is shown for convenience only The number of data to be created depends on the size of the character string variable As much data as possible is created DIR CHDIR MKDIR RMDIR 4 69 DIM 8 E Example of Program conf obal dname 13 pnamel 13 pname2 13 p2sel tatic list 2000 4 dir g global dsel plsel Ss Ss trdsp str end conf evnt input types id if data 1 then data path dname dsel strdsp dsp str path dir paths strdsp dsp str num lists num000 num numdsp end if end evnt 4 70 CHAPTER 4 INSTRUCTION REFERENCE amp H3F pname1 plsel pname2 p2sel 0 iists DIR eg DINV Statement E Function Inverses the color in a specified screen area E Format DINV upper left X coordinate upper left Y coordinate lower right X coordinate lower right Y coordinate m Example of Use DINV 10 10 30 30 E Description e Inverses the color in a rectangular area having opposite points of specified coordinates e The upper left corner of the panel has the coordinates 0 0 The horizontal direction toward the right corresponds to the X axi
132. COLOR Statement E Function The LNECOLOR statement changes the line colors and figure of the line chart display E Format LNECOLOR control name line number line type line color tile display color background color m Example of Use LNECOLOR LNEO000 1 2 1 4 5 2 E Description e The LNECOLOR statement changes the line colors and figure of the line chart display and the background tile and color of the entire display e control name is the name of a line chart or the D type variable indicating the chart e line number is the integer value indicating the number of the line to be changed The line number starts at 1 e line type is the numeric value indicating the type of the line Specify this line type with a numeric value from 0 to 3 e tile indicates the tiling figure of the bar Specify this tiling figure with a numeric value from 0 to 15 e display color is the numeric value indicating the color number of the tile display section Specify this color number with a numeric value from 0 to 15 e background color is the numeric value indicating the color number of the tile background section Specify this color number with a numeric value from 0 to 15 E Related Item LNEDSP LNESHIFT E Example of Program conf static name name LNEOOO end conf evnt input types id data if types 3 then LNECOLOR name 2 3 1 4 5 2 E endif end evnt 4 137 LNEDSP ie LNEDSP Statement E Func
133. D FCLOSE FPUT FGET EOF E Example of Program cont field 5 global no global mojilS moji2s end field global sum fopen MEMORY 2 5 end conf evnt nos 1 mojilS product name moji2S product number FPE 5 7 3 if LOF 5 gt 100 then fclose 5 end if end evnt 4 145 LOG es LOG Function E Function The LOG function calculates the natural logarithm specified in numerical expression E Format LOG numerical expression m Example of Use A LOG B C E Description e numerical expression must be a numeric value greater than 0 E Related Item EXP E Example of Program conf la log 10 lb log a b end conf 4 146 CHAPTER4 INSTRUCTION REFERENCE MCPY be MCPY Statement E Function The MCPY statement copies the contents of a field to a character string variable E Format 1 MCPY file number character string variable 2 MCPY character string variable file number m Example of Use MCPY 5 moji E Description e The MCPY statement copies the contents of the variable group in a field to a character string variable or the contents of a character string variable to the variable group in a field That is the MCPY statement in the first example 1 MCPY copies the contents of the character string variable to the variable group in the field specified by file number The MCPY statement in the second example 2
134. D FUNCTION FUNCTION ADD A B ADD A B END FUNCTION The FUNCTION END FUNCTION statement declares a function block where the function itself is defined A defined function can be referenced in three ways as shown below according to the position where it is declared Local function Defined in a program other than a global screen program Global function Defined in a global screen program Library function Defined in a library The declared type of a function in the prototype declaration must be the same as the defined type of the function itself Like a variable a function has a return value of a type determined by the type declaration character or A function with no type declaration character is a real number function The return value of a function depends on a value substituted for the function name including the type declaration character Variable declaration is an argument of a function A variable with no argument declaring a variable type is regarded as a real number variable An argument of a function is given when referenced Therefore if a value is changed by substituting it for an argument in the function or the like the variable itself given as the argument by the caller is also changed Type declaration using DECLARE is needed to call a function declared in a function block To exit a function in a function block forcedly use EXIT FUNCTION This is one of the new features
135. DSP name data 4 163 NUMFORM ei NUMFORM Statement E Function E Format m Example of Use E Description E Related Item E Example of Program evnt The NUMFORM statement changes the display format of the numeric display NUMFORM control name display method decimal point position NUMFORM HYOJIKI 0 0 e The NUMFORM statement changes the display method of the numeric display This statement can also specify a display method and a decimal point display position control name is the numeric display name or the ID type variable indicating the numeric display e display method is the numeric value indicating any of the following seven display methods 0 Floating point display method 4 Binary representation 1 Integer display method 5 Octal representation 2 Fixed point display method 6 Hexadecimal representation 3 Binary fixed point representation e decimal point position specifies where the decimal point is displayed when display method is 2 fixed point display method To display the decimal point in the first position from the right specify 1 To display it in the second position from the right specify 2 e Binary fixed point representation is the method for writing a decimal point in the specified integer data position e Be sure to execute the NUMDSP statement after executing this statement Otherwise display may be disordered NUMCOLOR NUMDSP input type id data var buhin game
136. E MEDIASIZE eg N MEDIASIZE Function E Function E Format m Example of Use E Description E Related Item The MEDIASIZE function checks the size of a medium in the drive and returns the number of bytes MEDIASIZE drive name calculation method SIZE MEDIASIZE E 0 e The calculation method is as shown below 0 Full space 1 Free space When the full space is specified the medium size is calculated from the number of all clusters When the free space is specified free clusters are checked and the medium size is calculated from the total number of free clusters MEDIACHK E Example of Program cont global dname 13 global dsel static mode mode 0 strdsp str mediasize numdsp num001 mode end conf evnt input type id data if data 1 then if mode 1 then mode 0 else mode 1 end if numdsp num001 mode strdsp dsp str dnameS dsel num mediasize dnameS dsel mode numdsp num000 num end if end evnt 4 149 MID ee MID Statement E Function E Format m Example of Use E Description E Related Item m Example of Program Pes conr mo jis end conf evnt end evnt pee is The MID statement replaces part of a character string with another character string MID character string variable start position number of characters replacing character string MID x 1 1 A
137. E Description E Related Item The SETDATE statement sets the date of the built in clock SETDATE year month day SETDATE 92 12 1 year is the low order two digits of A D 0 to 99 e month is a numeric value from 1 to 12 e day is a numeric value from 1 to 31 e If an unexisting year month or day is specified an error occurs e The day of the week is automatically set based on preset year month and day e Once date is set using the SETDATE command in a model with a battery backup calendar IC GC56LC or GCS5EM the date is updated even while the power is off If a model with no calendar IC GC53LC or GC53LM is turned off the date is initialized to January 1 1998 Thursday and the time to 00 00 00 when it is turned on again The date and time are updated while the power is on DATE GETDATE GETDATE SETTIME TIME E Example of Program evnt input type id dat if type 3 then y 94 m 12 d 1 setdate y m d endif end evnt 4 221 SETLNEPLOT fee SETLNEPLOT Statement E Function E Format m Example of Use E Description E Related Item E Example of Program evnt input The SETLNEPLOT statement sets the display range of a line chart SETLNEPLOT display start point display end point SETLNEPLOT 10 50 e The SETLNEPLOT statement sets the display range of a line chart Executing LNEDSP LNESHIFT or PRDSP after this display range has been set displays the line char
138. ESET occccccccccccccccccccccccceccceccesceees 4 109 CVID is eee hast eae ee eaber ne 4 58 GETTIMEB co 8 oo oecce eee eh cn hoe 4 110 4 2 CHAPTER4 INSTRUCTION REFERENCE 4 1 Instruction Reference GLOBA D rcino o a O 4 111 GOSUB rer EE E 4 112 NUMCOLOR 0 cecccecseccesceeseescescesessceacens 4 161 GOTO oes il dices san daceaded debe ieceheds sis cagte ss EEA 4 113 NUMD SBiiss crs a ke corte ae 4 162 INUIMIOR Missi this ssdssanasestenuavannasatednceass 4 163 HEX Penina enaa eaen 4 114 OCTO r a A a a aatia 4 164 IFE THEN ELSE erosa onran sss 4 115 ONFERR veiininccesarssaneanararsandieatouecsat S 4 165 INT END INi e nenet 4 116 OPEN foes eta areo E R E EEA 4 166 INP E E AE EET 4 117 OPENCOM cisicieceste thet leaarchathedeeeetslaeteiatadet 4 167 INPB I i scasis dese eee et ies 4 118 OPENPARALLEL cceeccescceceeseeeeeeeeneees 4 168 INPUT ieee a ea a aE EErEE 4 119 OPENSIO niiina aA 4 169 INSTR oreen ie eeen ersan eoero 4 121 OPEN TIM vaene ienee 4 170 NEn a e a e E nen et Bacal 4 122 OPENTIM ra ea erea en a er eek 4 171 INTERLOCK orent 4 123 OPENTIM 3 zerean aes 4 172 JOCTLE inio a E 4 124 OUT ccastds vnctevsvdccacvossnipep ave aduserbennperebosokite 4 173 TOC TE 2 arana a ee ede 4 126 OUTBIT 4 03 deta ide tet ed wen 4 174 TOS TA Ti NE AE 4 127 OUTBITSTA sacectessticeeseteseeesens cee saselvelslests 4 175 OQUTSTAT 33 cosie totaal eek ees 4 176 JUMP A EEE RS 4 128 PIPCOLOR airna ae Ren ai 4 177 Jai D E A ETE eh ENEN 4
139. ET BUHIN GRAPH 2 4 30 0 E Description e The LNESET statement sets the data to be displayed in the line chart display The speed of executing the PRDSP display statement after setting data in two or more points is faster than that of modifying all the line point values after executing the LNEDSP statement e control name is the name of the line chart display or the D type variable indicating the line chart display e line number specifies which line data is to be displayed when two or more lines are displayed in one line chart display This line number is the integer value data starting at 1 e point number specifies which point value on the specified line is to be changed This point number is the integer value data starting at 1 e display data is the numeric data indicating the size of the line chart E Related item LNEDSP PRDSP m Example of Program evnt lneset buhin graph 3 8 20 1 var buhin graph no 4 value 23 point 4 LNESET var no point value prdsp var end evnt 4 139 LNESHIFT ie LNESHIFT Statement E Function The LNESHIFT statement shifts the display data of a line chart left or right E Format LNESHIFT cotrol name line number shift direction display data m Example of Use A LNESHIFT LNEO000 1 1 30 E Description E Related Item m Example of Program evnt The LNESHIFT statement is a function that shifts each of the points constituting the line
140. ETDATE command in a model with a battery backup calendar IC GCS56LC or GCS5EM the date is updated even while the power is off If a model with no calendar IC GC53LC or GC53LM is turned off the date is initialized to January 1 1998 Thursday and the time to 00 00 00 when it is turned on again The date and time are updated while the power is on E Related Item DATE GETTIME SETDATE SETTIME TIMES E Example of Program conf GETDATE yr mt d dd numdsp NUMOOO yr n n umdsp NUMOO1 mt umdsp NUMO0O02 d end conf 4 105 GETGID PT GETGID Function E Function The GETGID function obtains the ID of the local screen currently being displayed E Format GETGID m Example of Use VAR GETGID E Description e The GETGID function obtains the ID of the local screen currently being displayed e This function cannot be used to obtain the ID of a global screen E Related Item GETGNO m Example of Program evnt input types id data if types 3 then VAR GETGID NO GETGNO VAR 00 D100 NO end if end evnt 4 106 CHAPTER 4 INSTRUCTION REFERENCE GETGNO be GETGNO Function E Function The GETGNO function obtains the registration number of the screen currently being displayed E Format GETGNO screen ID m Example of Use NO GETGNO ID E Description e The GETGNO function obtains the registration number of the screen specified in screen ID
141. Example of Use ONOFF BITTEST VARIABLE 10 Description The BITTEST function tests whether the value of the specified bit in the specified variable is 1 or 0 When the value of the specified bit is 1 as a result of the test the function returns 1 When the value is 0 the function returns 0 e variable name specifies the name of the variable where the value of the specified bit is to be tested it must be an integer or floating point type variable e test position specifies where in the variable the specified bit is to be tested with a value from 0 to 31 it must be a variable or constant E Related Item BITSET E Example of Program conf end conf evnt input types id data if bittest data 0 1 then strdsp STROOO bit is ON else strdsp STROOO bit is OFF endif end evnt 4 27 BITSET ei BLCTL Statement E Function The BLCTL statement performs back light ON OFF control E Format BLCTL status E Example of Use BLCTL 1 E Description The BLCTL statement performs back light ON OFF control e status indicates whether to turn on or off the back light with the following numeric values 0 The back light is turned off 1 The back light is turned on E Related Item BLSTAT m Example of Program evnt ret blstat if ret 0 then BLCTL 1 end evnt 4 28 CHAPTER4 INSTRUCTION REFERENCE BLSTAT PT BLSTAT Function E Function The BLSTAT func
142. F evnt input ty id dat end evnt 4 49 CONST se CONST Statement E Function The CONST statement declares a constant E Format CONST constant name constant m Example of Use CONST MAX 10 E Description e The constant name should be enclosed in a pair of marks according to the variable name generation rule e If a constant is declared in a program the constant name is replaced with a declared constant value e The CONST statement cannot be used in a global screen program e Constant declaration is one of the new features of Screen Creator 5 E Related Item E Example of Program conf global L const MAXLENGTH 100 if L gt MAXLENGTH then L MAXLENGTH end if end conf 4 50 CHAPTER 4 INSTRUCTION REFERENCE CONTTIM ee CONTTIM Statement E Function The CONTTIM statement restarts the stopped timer E Format CONTTIM timer number m Example of Use CONTTIM TIMID CONTIM 4 E Description The CONTTIM statement restarts the timer stopped by the STOPTIM instruction The internal counter in the timer is continued from the timer stop status e timer number indicates the number of the timer to be restarted Whether the timer number is an ID or integer type value depends on how the timer is opened See OPENTIM OPENTIM2 and OPENTIM3 E Related Item OPENTIM OPENTIM2 OPENTIM3 STARTTIM STOPTIM CLOSETIM SETTIM READTIM E Example of Program conf
143. FF background color to be used with a numeric value from 0 to 15 19 _SW_ONOFF Function _SW_ONOFF changes the ON OFF status of a switch Executing _SW_ONOFF for the switch for synchronous operation causes an error Range _SW_ONOFF is applicable to switches and selector switches Control value When changing a switch to the OFF status set 0 When changing a switch to the ON status set 1 When changing all selector switches to the OFF status set 0 When changing one of the selector switches to the ON status set the corresponding element number e The types and usage of the request codes that can be used by PRMCTL2 are explained below 1 _PD_DCOLOR Function _PD_COLOR changes the display color of a display Range _PD_DCOLOR is applicable to the ON color specification of numeric character clock plot free graph meter and lamp displays Type Specify one of the following 0 Figure change 1 Fore color change 2 Back color change 3 Display color change Control value Set the number of the display color to be changed with a numeric value from 0 to 15 2 _PD_BCOLOR Function _PD_BCOLOR changes the background color of a control Range _PD_BCOLOR is applicable to numeric character clock plot bar graph line chart and free graph displays Type Specify one of the following 0 Figure change 1 Fore color change 2 Back color change Control value Set the number of the background color to be changed with a numeric v
144. FSET reference ID ID to be specified m Example of Use OFFSET GETOFFSET 00 D0001 ID E Description e The GETOFFSET function calculates the offset indicating how long the specified ID is separate from the reference ID e reference ID specifies the ID type variable screen name part name registration character string graphic name or device name used as the reference offset e D to be specified specifies the D type variable screen name part name registration character string graphic name or device name used to calculate the offset e When the GETOFFSET function applies to the device declared in CYCLIC2 the offset value is a multiple of 2 m Related Item GETID E Example of Program conf cyclic 007 d0001 30 end conf evnt input ty id dat offset GETOFFSET 00 d0001 id Error processing corresponding to the offset value etc id getid 00 d0001 offset end evnt 4 109 GETTIME 8 GETTIME Statement E Function E Format m Example of Use E Description E Related Item m Example of Program conf GETTIME numdsp numdsp numdsp end conf The GETTIME statement obtains the data indicating time GETTIME hour read variable minute read variable second read variable GETTIME HOUR MIN SEC e The GETTIME statement writes the current value time to hour read variable minute read variable and second read variable e Hour is a numeric v
145. Function The GETOFFSET function calculates the offset between the reference ID and specified ID E Format GETOFFSET reference ID ID to be specified m Example of Use OFFSET GETOFFSET 00 D0001 ID E Description e The GETOFFSET function calculates the offset indicating how long the specified ID is separate from the reference ID e reference ID specifies the ID type variable screen name part name registration character string graphic name or device name used as the reference offset e D to be specified specifies the D type variable screen name part name registration character string graphic name or device name used to calculate the offset e When the GETOFFSET function applies to the device declared in CYCLIC2 the offset value is a multiple of 2 m Related Item GETID E Example of Program conf cyclic 007 d0001 30 end conf evnt input ty id dat offset GETOFFSET 00 d0001 id Error processing corresponding to the offset value etc id getid 00 d0001 offset end evnt 4 109 GETTIME 8 GETTIME Statement E Function E Format m Example of Use E Description E Related Item m Example of Program conf GETTIME numdsp numdsp numdsp end conf The GETTIME statement obtains the data indicating time GETTIME hour read variable minute read variable second read variable GETTIME HOUR MIN SEC e The GETTIME statement writes the cur
146. ING eg STRING Statement E Function E Format m Example of Use E Description E Related Item E Example of Program conf end conf The STRING statement specifies the size of the character string variable to be used STRING variable name size variable name size STRING MOJI 50 The STRING statement is used to specify a size of a local character string variable The STRING statement is adopted to maintain the compatibility with GCSGP3 Use LOCAL instead of STRING in Screen Creator 5 The default size of the character string variable is 20 bytes Use the STRING statement to use a variable whose size is greater than 20 bytes The character string variable must be declared before it is used variable name must end with Specify size with an integer value Two or more character string variable can be specified in one line delimited by a comma GLOBAL STATIC BACKUP LOCAL string Xxx 40 string mojiS 50 4 239 SWFIG 8 SWFIG Statement E Function The SWFIG statement sets the graphic to be displayed when the status of the specified switch changes E Format SWFIG switch name display graphic status sub ID m Example of Use SWEHIG SW1 FIG3 0 0 E Description e The SWFIG statement specifies the graphic to be displayed in the specified switch when the switch changes from the ON status to the OFF status Both the unit switch and selector switch can be used When the selecto
147. INSTRUCTION REFERENCE RESETALARM eg RESETALARM Statement E Function The RESETALARM statement resets the specified alarm E Format RESETALARM alarm number m Example of Use RESETALARM NO E Description e alarm number is the number of the alarm set by the SETALARM statement it must be an D type variable e This statement resets the setting for posting an alarm ON to the program when a specified time is reached E Related Item SETALARM E Example of Program conf static alid alid setalarm 10 0 end conf evnt input types id data if types 3 then RESETALARM alid end if end evnt 4 209 RETURN a RETURN Statement E Function The RETURN statement returns control from the subroutine to the original program E Format RETURN m Example of Use RETURN E Description e The RETURN statement returns control to the statement following the statement called by the GOSUB statement E Related Item GOSUB E Example of Program evnt X 10 GOSUB SUB001 numdsp NUMOOO X end evnt SUBOOL X X 3 RETURN 4 210 CHAPTER4 INSTRUCTION REFERENCE RIGHT E a a RIGHT Function E Function E Format m Example of Use E Description E Related Item E Example of Program evnt bs a c c J J 2 vs end evnt The RIGHT function returns a character string the specified number of characters starting from the left of the specified char
148. ION REFERENCE PRMSTAT eg 6 8 _PD_FONT Function Range Return value _PD_XFSZ Function Range Return value _PD_YFSZ Function Range Return value _PD_PTPOS Function Range Return value _PD_ZSPRS Function Range Return value _PD_XNUM Function Range Return value _PD_YNUM Function Range Return value _PD_DIRECT Function Range Return value _PD_FONT reads the type of the font displayed on the control _PD_FONT is applicable to numeric and clock displays For half size character display O is returned For full size character display 1 is returned _PD_XFSZ reads the horizontal direction size of the font displayed on the control _PD_XFSZ is applicable to numeric character and clock displays For 1 magnification 0 is returned For 2 magnifications 1 is returned For 4 magnifications 2 is returned For 8 magnifications 3 is returned For 16 magnifications 4 is returned _PD_YFSZ reads the vertical direction size of the font displayed on the control _PD_YFSZ is applicable to numeric character and clock displays For 1 magnification 0 is returned For 2 magnifications 1 is returned For 4 magnifications 2 is returned For 8 magnifications 3 is returned For 16 magnifications 4 is returned For 32 magnifications 5 is returned _PD_PTPOS reads the position of a decimal point _PD_PTPOS is applicable only to numeric displays The position of
149. IT E Example of Program conf static moji end conf evnt input ty id dat end evnt 4 78 CHAPTER4 INSTRUCTION REFERENCE EXECPRCODE eg EXECPRCODE Statement E Function The EXECPRCODE statement executes primitive data operation E Format EXECPRCODE control name type operation data variable name m Example of Use EXECPRCODE NUMO000 0 20 VAR E Description e When a control in a part is used to validate an operation parameter the EXECPRCODE statement executes data operation set in the part operation parameter specification e type is usually 0 When the specified primitive is the plot display and type is 0 the EXECPRCODE statement executes X data operation When type is 1 the statement executes Y data operation control name must be the control in the local part e operation data specifies the value to be operated it must be an integer or floating point type variable or constant e variable name specifies the variable to which the operation result is to be written it must be an integer or floating point type variable e If no operation code is written in the specified control the value specified in operation data is set in the specified variable E Related Item None m Example of Program conf end conf evnt input type id data EXECPRCODE NUMOOO 0 data datal numdsp NUMOO1 datal end evnt 4 79 EXIT FUNCTION ee EXIT FUNCTION Statement E F
150. Itis possible to make changes in the rectangle shape color etc in this dialog box However no properties are changed in this example Even after a rectangle has been drawn the rectangle drawing mode is still active To cancel this mode click the right mouse button 2 7 2 1 Creating a Part for Displaying Numerics 2 1 4 Saving a created part Select Window on the menu then select Adjust to Object Size in order to reduce the screen size to the current size of the part The part must be displayed all over the OIP screen Since such a part is too large reduce the area to a size enough to accommodate the created numeral display enclosed in the rectangle Look at the screen periphery and you may see that the screen is enclosed in dotted lines These dotted lines indicate the size of the part Each side of the dotted rectangle has a red mark at the center The red mark is a handle for changing the part area Move the mouse pointer to one of the handles The mouse pointer shape changes Then drag the handle to change the area size The following shows an example of reducing the area Then save this part Select Library on the menu then select Save The dialog box shown below opens The Class List field on the left shows the groups of the parts in the library This example assumes that the part is saved in User Parts Thus click on User Parts Input test in the Name field and test part in the Comment field Clic
151. KS MKB MKW MKI MKF MKID CVW CVI CVF CVID m Example of Program conf end conf evnt orgs 1234567 data CVB org 3 numdsp NUM000 data gt Displays 51 amp H33 end evnt 4 55 CVF E CVF Function E Function Format m Example of Use E Description E Related Item m Example of Program conf end conf evnt orgs strdsp m strdsp datas n umdsp end evnt The CVF function allocates data from any position of a character string variable CVF character string variable name allocation position VAR CVF MOJI 5 e The CVF function allocates data four bytes from the specified allocation position of the specified character variable name The allocated data is regarded as a real value e allocation position must be an integer or floating point type variable or constant 1 specifies the beginning of the character string variable e The CVF function returns a real number e A cut out value is converted into a 86 series boundary MKS MKB MKW MKI MKF MKID CVB CVW CVI CVID WNIT2Z 345672 STROOO org Kf orgs 2 1423 STROO1 org The character string will not be displayed correctly CVE org 2 NUM000 data Displays 1 23 4 56 CHAPTER4 INSTRUCTION REFERENCE CVI E CVI Function E Function The CVI function allocates data from any position of a character string variable E Format CVI character string variable n
152. L1 numdsp NUMOOO a end evnt 4 113 INIT END INIT l HEX Function E Function The HEX function converts a decimal character string to a hexadecimal character string E Format HEX numerical expression m Example of Use HEX 123 E Description e The HEX function converts a decimal character string to a hexadecimal character string e When a floating point type is specified in numerical expression the decimal character string numeric value is converted to an integer type then converted to a hexadecimal character string e Specify the decimal character string numeric value within the range from 2147483648 to 2147483647 E Related Item OCT VAL E Example of Program evnt input type id data mojiS HEXS data strdsp STROOO mojiS end evnt 4 114 CHAPTER4 INSTRUCTION REFERENCE IF THEN ELSE pe a IF THEN ELSE Statement E Function E Format m Example of Use E Description E Related Item m Example of Program elseif w I end if end evnt Condition judgment is performed to select the next program to be executed IF conditional expression THEN statement ELSE statement IF conditional expression THEN statement list ELSEIF conditional expression THEN statement list ELSE statement list END IF IF TYPE 1 THEN VALUE 10 e conditional expression is the relational operation expression obtained when the operation result is true ot
153. LOSECOM Statement E Function E Format m Example of Use E Description E Related Item m Example of Program con The CLOSECOM statement temporarily stops the use of a serial line CLOSECOM device name CLOSECOM HST e The CLOSECOM statement is a command that temporarily inhibits a program from receiving data from an external connecting device using the OPENCOM instruction e HST host computer BCR bar code reader or TKY ten key pad can be specified in device name OPENCOM OPENCOM HST end conf evnt input type id data if type 3 and data 1 then CLOS ECOM HST else if type 3 and data 0 then REOP ENCOM HST endif end evnt 4 44 CHAPTER4 INSTRUCTION REFERENCE CLOSEPARALLEL pe CLOSEPARALLEL Statement E Function The CLOSEPARALLEL statement temporarily stops data input from a parallel port E Format CLOSEPARALLEL input bit m Example of Use CLOSEPARALLEL 3 E Description e The CLOSEPARALLEL statement is an instruction that temporarily inhibits a program from receiving data as a message from the parallel port specification bit using the OPENPARALLEL instruction e input bit specifies the bit for inhibiting data reception E Related Item OPENPARALLEL REOPENPARALLEL m Example of Program coni OPENPARALLEL 3 end conf evnt input type id data if type 3 and data 1 then CLOSEPARALLEL 3 else if type 3 and data
154. NCE FORMAT eg FORMAT Statement E Function The FORMAT statement initializes formats the specified file E Format FORMAT file name m Example of Use FORMAT A E Description file name specifies the name of the file to be initialized e A E or MEMORY can be specified as the drive name e When MEMORY is specified in drive name the contents of the file are filled with 0 e Be sure to execute the FORMAT statement when using the file for the first time E Related Item FOPEN FIELD FCLOSE FPUT FGET E Example of Program cont field 5 global no global mojilS moji2 end field global sum FORMAT MEMORY fopen MEMORY 2 5 end conf evnt nos 1 mojilS product name moji2S product number fput 5 7 3 fclose 5 end evnt 4 93 FPRINT ee FPRINT Statement E Function The FPRINT statement writes data to the specified file E Format FPRINT file number expression expression m Example of Use FPRINT 12 100 ABCD VAR STRING E Description The FPRINT statement writes the numeric value variable or character defined in expression to the file specified by file number A numeric value a character or a numeric or character variable can be specified in expression A numeric expression is converted to a numeric string and written to the specified file When the data to be
155. OCTL2 Statement E Function The IOCTL2 statement controls PLC cyclic communication E Format IOCTL2 device name code data m Example of Use IOCTL2 00 D10 0 0 E Description e Executing the IOCTL2 statement executes the cyclic communication specified by device name The cyclic communication to be specified by device name must be declared in the CYCLIC or CYCLIC2 statement in advance e Set 0 in code and data E Related Item None E Example of Program cont cyclic 00 7D10 end conf evnt input ty id dat if id swl then OO7 D11 1 ioctl2 007D10 0 0 endif end evnt 4 127 IOSTAT l IOSTAT Function E Function The IOSTAT function reads the status of the I O device connected to the OIP E Format IOSTAT I O type m Example of Use IOSTAT 0 E Description e Write the integer value indicating the I O device whose status is to be read in O type Currently the type of I O device that can be controlled are the PLC and switch To read the PLC status specify 0 in I O type 0 The PLC is write and read enabled 1 The PLC is write inhibited e To read the switch status specify amp H60 in l O type The number of switches that can be recognized when they are pressed simultaneously is returned 0 to 640 E Related Item IOCTL E Example of Program evnt input ty id dat if id swl then if iostat 0 then ioctl 0 0 else ioctl 0 1 end if endif end evnt 4 128 CHA
156. ON time OFF time sound count SETBEEP 10 5 3 e The SETBEEP statement sets the tone color of the buzzer to be sounded by the BEEP command e ON time specifies the time during which the buzzer continues to sound in units of 100 milliseconds e OFF time specifies the time during which the buzzer continues not to sound in units of 100 milliseconds sound count indicates the number of times the buzzer sounds and does not sound It is impossible to specify 0 e When OFF time is 0 the buzzer continues to sound BEEP SETBEEP 50 20 3 types id data if id BEEF D 1 else endif end evnt BEE SWT000 then 4 219 SETBLIGHT 8 SETBLIGHT Statement E Function The SETBLIGHT statement sets the time that lasts till the back light is turned off E Format SETBLIGHT OFF time m Example of Use SETBLIGHT 20 E Description e OFF time indicates the time that lasts till the back light is turned off it is an integer type variable or a numeric value OFF time is set in minutes When OFF time is 0 the back light is not turned off E Related Item GETBLIGHT E Example of Program cont getblight var var var 2 SETBLIGHT var end conf 4 220 CHAPTER4 INSTRUCTION REFERENCE SETBLIGHT be a SETDATE Statement E Function E Format m Example of Use E Description E Related Item The SETDATE statement sets the date of the built in clock SETDATE year mont
157. P statement jumps to the immediately preceding screen E Format PREVJUMP m Example of Use PREVJUMP E Description e The PREVJUMP statement jumps to the screen displayed before the current screen according to the recorded screen transition path e Up to 30 screens can be recorded The PREJUMP statement cannot jump to a screen before the recorded 30 screens E Related Item JUMP E Example of Program conf end conf evnt input types id data if id SWT000 then PREVJUMP end evnt 4 184 CHAPTER4 INSTRUCTION REFERENCE PRINT eg a PRINT Statement E Function The PRINT statement writes messages E Format PRINT expression expression m Example of Use PRINT 23 ABCD XYZ MOJI E Description e The PRINT statement writes the messages to be output the screen part serial port or paralle port e When two or more messages are written delimit them in commas e Messages are not output when the PRINT statement is executed they are output for the first time when the SEND command is executed e When messages are output to the host computer commas are inserted to delimit data E Related Item INPUT SEND E Example of Program evnt input type id data if types 3 then PRINT ABCD data send BOOO endif end evnt 4 185 PRMCTL 8 PRMCTL Statement E Function The PRMCTL statement changes the attributes of the specified primitive E Format PRMCTLI contr
158. PTER4 INSTRUCTION REFERENCE JUMP eg JUMP Statement E Function The JUMP statement displays the specified screen E Format JUMP screen name m Example of Use JUMP 10 E Description e The JUMP statement displays the screen specified in screen name e screen name is the name of the screen to be displayed or the D type variable indicating the screen to be displayed Alternatively screen name specifies the screen number stored in screen registration e When this statement is executed the subsequently coded program is not executed e If anon extant screen is specified a system error occurs E Related Item None E Example of Program evnt input type id data if type 3 and id SWT000 then JUMP GAMEN end if end evnt 4 129 KILL ei KILL Statement E Function The KILL statement deletes the specified file E Format KILL file name m Example of Use KILL C ABC DOC E Description The KILL statement deletes the file specified by file name A wild card can be specified in file name E Related Item m Example of Program conf end conf KILE SABC t end evnt 4 130 CHAPTER4 INSTRUCTION REFERENCE LAMPCOLOR eg I LAMPCOLOR Statement E Function The LAMPCOLOR statement changes the ON display color of the lamp display E Format LAMPCOLOR display name color number E Example of Use LAMPCOLOR BUHIN GRAPH 5 E Description The LAMPCOLOR statement changes the
159. R reads a switch ON background color _SW_ONCOLOR is applicable to switches and selector switches The number 0 to 15 of the read switch ON background color is returned _SW_OFFCOLOR reads a switch OFF background color _SW_OFFCOLOR is applicable to switches and selector switches The number 1 to 15 of the read switch OFF background color is returned _SW_BMODE reads the switch background color display method _SW_BMODE is applicable to switches and selector switches When the switch background color display method is direct display 0 is returned When the display method is replacement display 1 is returned _SW_RACT reads whether to perform reverse operation when a switch is ON _SW_RACT is applicable to switches and selector switches If reverse operation is performed when a switch is ON 1 is returned If reverse operation is not performed 0 is returned _SW_BZER reads whether to sound the buzzer when a switch is ON _SW_BZER is applicable to switches and selector switches If the buzzer is sounded when a switch is pressed 1 is returned buzzer is not sounded 0 is returned If the _SW_STAT reads the status normal operation input disable halftone of a switch _SW_STAT is applicable to switches and selector switches One of the following numeric values indicating the switch status is returned 0 Normal operation status 1 Input disable status 4 198 CHAPTER4 INSTRUCTION REFERENCE PRMSTAT pe
160. RDSP buhin graph end evnt 4 183 PREVJUMP ee PREVJUMP Statement E Function The PREVJUMP statement jumps to the immediately preceding screen E Format PREVJUMP m Example of Use PREVJUMP E Description e The PREVJUMP statement jumps to the screen displayed before the current screen according to the recorded screen transition path e Up to 30 screens can be recorded The PREJUMP statement cannot jump to a screen before the recorded 30 screens E Related Item JUMP E Example of Program conf end conf evnt input types id data if id SWT000 then PREVJUMP end evnt 4 184 CHAPTER4 INSTRUCTION REFERENCE PRINT eg a PRINT Statement E Function The PRINT statement writes messages E Format PRINT expression expression m Example of Use PRINT 23 ABCD XYZ MOJI E Description e The PRINT statement writes the messages to be output the screen part serial port or paralle port e When two or more messages are written delimit them in commas e Messages are not output when the PRINT statement is executed they are output for the first time when the SEND command is executed e When messages are output to the host computer commas are inserted to delimit data E Related Item INPUT SEND E Example of Program evnt input type id data if types 3 then PRINT ABCD data send BOOO endif end evnt 4 185 PRMCTL 8 PRMCTL Statemen
161. RSET var no value prdsp var end evnt 4 41 CLEAR l CLEAR Statement E Function The CLEAR statement clears the display of the specified display E Format CLEAR control name m Example of Use CLEAR NUM000 E Description e The CLEAR statement clears the display of the specified display leaving only the background color e When the slide display is specified the CLEAR statement clears the pointer graphic e When the meter display is specified the CLEAR statement clears the needle e When the clock display is specified the CLEAR statement clears nothing control name is the graph name or the ID type variable indicating the graph display name E Related Item NUMDSP STRDSP FIGDSP SLDDSP MTRDSP FREDSP PLTDSP BARDSP BLTDSP CIRDSP LNEDSP E Example of Program evnt input types id data if data 1 then CLEAR NUMOOO end if end evnt 4 42 CHAPTER4 INSTRUCTION REFERENCE CLOSE eg ee CLOSE Statement E Function The CLOSE statement closes the specified part E Format CLOSE part name m Example of Use CLOSE B000 E Description e The CLOSE statement closes the part displayed on the screen The undisplayed status is called the close status e Nothing is performed even if the CLOSE statement is executed for the closed part e The program is started if the closed part receives a message e part name is the name or ID of the part to be closed E Related Item OPEN E Example of Program evnt
162. Read of reference line 2 type The number 0 to 3 of the read line type is returned _PD_BSCOLOR reads the color of a base line or a reference line _PD_BSCOLOR is applicable to bar graphs and line charts Specify one of the following 0 Read of base line color 1 Read of reference line 1 color 2 Read of reference line 2 color The number 0 to 15 of the read line color is returned _SW_ONKFIG reads the graphic number displayed when a switch is ON _SW_ONRHIG is applicable to switches and selector switches For a switch specify 1 For a selector switch specify the element number of the switch whose ON graphic is to be changed The element number starts at 1 The read graphic number is returned _SW_OFFFIG reads the graphic number displayed when a switch is OFF _SW_OFFFIG is applicable to switches and selector switches For a switch specify 1 For a selector switch specify the element number of the switch whose OFF graphic is to be changed The element number starts at 1 The read graphic number is returned 4 200 CHAPTER4 INSTRUCTION REFERENCE PRMSTAT eg 8 _SL_ WRITE Function Range Type Return value 9 _PD_PLOTRNG Function Range Type _SL_WRITE reads the switch write value _SL_WRITE is applicable to switches To read the write value when a switch is ON specify 1 write value when a switch is OFF specify 0 The read write value is returned To read the PD PLOTRNG writes the start and en
163. Ream riep Reem and miarsi ki m e ce i Raan and si YO p a et i Then click on the Arrangement and color tab in the dialog box as shown below Try to change the number of digits of values displayed on the number indicator control Change the value in the Length and Interval field into 4 Now the number indicator control has been set Press the Arrangement button Biskaje Banega ard pole Seersiian paramita Bars painit YP S Ff a Length ard ieva A a m p 3a Sni e a e a Pattini ime a Hantar T m 2 4 CHAPTER2 EXAMPLES OF PROGRAMMING 2 1 Creating a Part for Displaying Numerics The dialog box is closed and the mouse cursor changes into the mouse In this condition move the cursor to a window where the control is to be arranged i e part creation window and click the left mouse button The mouse cursor changes into a rectangle frame which shows the size of the number indicator control Click the left mouse button at any position and the number indicator control is arranged at that position Then try to change the size of this number indicator control There are light blue squares on the frame of the control These are called handles When you brings the mouse pointer close to a handle the pointer shape changes In this condition drag the handle and you can change the control size as you like In the example shown below the control is enlarged four times as large as the original cont
164. The BITTEST function tests the specified bit of a variable E Format BITTEST variable name test position E Example of Use ONOFF BITTEST VARIABLE 10 Description The BITTEST function tests whether the value of the specified bit in the specified variable is 1 or 0 When the value of the specified bit is 1 as a result of the test the function returns 1 When the value is 0 the function returns 0 e variable name specifies the name of the variable where the value of the specified bit is to be tested it must be an integer or floating point type variable e test position specifies where in the variable the specified bit is to be tested with a value from 0 to 31 it must be a variable or constant E Related Item BITSET E Example of Program conf end conf evnt input types id data if bittest data 0 1 then strdsp STROOO bit is ON else strdsp STROOO bit is OFF endif end evnt 4 27 BITSET ei BLCTL Statement E Function The BLCTL statement performs back light ON OFF control E Format BLCTL status E Example of Use BLCTL 1 E Description The BLCTL statement performs back light ON OFF control e status indicates whether to turn on or off the back light with the following numeric values 0 The back light is turned off 1 The back light is turned on E Related Item BLSTAT m Example of Program evnt ret blstat if ret 0 then BLCTL 1 en
165. Type of the message issuer 20 ID of the message issuer Logical name TKY Data Characters read from the ten key pad Host computer command communication Type of the message issuer 22 ID of the message issuer Logical name HST Data Data transmitted from the host computer Use the INPUT instruction to read messages into a program Suppose for example that numeric data 10 was transmitted from the program whose screen name is SCREEN and whose part name is PART In this case the INPUT statement that reads messages is written as follows INPUT TYPE ID DATA TYPE Value 2 indicating that messages were transmitted from the part is set in TYPE ID GAME BUHIN indicating the ID of the transmitted part is set in ID DATA Data itself 10 in this case 3 21 3 13 Pro gram Blocks 3 13 Program Blocks An OIP K Basic program consists of THE blocks INITIALIZATION INIT to END INIT configuration CONF to END CONF event EVNT to END EVNT subroutine label name RETURN AND FUNCTION FUNCTION to END FUNCTION This section describes the initialization block configuration block and event block For details of the subroutine block see 3 9 Subroutines above 3 10 User defined functions above For details of the function block see The following shows an example of a program using these blocks declare func at b init static varl 10 global var2 20 end init conf v
166. Unnecessary timers must be returned to the system flag t 0 flag 0 indicates that the flag is set to 0 because the timer stopped When a message is transmitted from the timer the following program is executed else if types 4 then number S number t 1 numdsp NUM000 number end if Each time a message is transmitted from the timer the numerical value to be displayed variable number is incremented by 1 and displayed in the Number indicator control The program ends here The initialization block of this program declares the variable and displays the default value of 0 The event block processes a message from the switch or timer As a result this program alternates two conditions Every time the switch is pressed a displayed value increased by one in one condition or such increase stops in the other condition 2 41 2 6 Editing a Program for a Displayed Part 2 6 Editing a Program for a Displayed Part To edit the program of a part arranged on the screen double click on that part in the screen creation window The Property of arrangement part window opens Select Program in the window The program editor window opens aam a oll aie Display system error ocourred while the Advance intellige Error of tise or data T Ei far ol l balterv ill ae Error of sa communication i sian emors her tan the above error code 400 fo ddi kesk con be set te hide error dimlar han 1 is set far eril s
167. _LNENUM reads the number of bars and lines that can be displayed on the control _PD_LNENUM is applicable to plot and line chart displays The maximum number of bars and lines that can be displayed is returned _PD_ZNNUM reads the number of zones that can be displayed on the control _PD_ZNNUM is applicable to pie chart and 100 percent bar chart displays The number of zones that can be displayed is returned _PD_FIGMD reads whether to match the size of the graphic to be displayed on a graphic display with that of the display _PD_FIGMD is applicable only to graphic displays When matching the size of the graphic with that of the graphic display set 1 When not matching the size of the graphic with that of the graphic display set 1 _PD_WSIZ reads the dot size or line width of a control _PD_WSIZ is applicable to plot meter and pipe displays For a plot display the numeric value 0 to 2 indicating the dot size small to large is returned For a meter display the numeric value 0 to 2 indicating the line width narrow to wide is returned For a pipe display the numeric value 0 to 3 indicating the thickness 1 3 5 or 7 is returned _PD_PIPSTAT reads the ON or OFF status of a lamp or pipe display _PD_PIPSTAT is applicable to lamp and pipe displays Any of the following values indicating the ON or OFF status of the lamp or pipe display is returned 4 196 CHAPTER4 INSTRUCTION REFERENCE PRMSTAT eg 20 21
168. _PTPOS reads the position of a decimal point _PD_PTPOS is applicable only to numeric displays The position of the decimal point is returned _PD_ZSPRS reads whether to perform zero suppression _PD_ZSPRS is applicable only to numeric displays When zero suppression is not performed 0 is returned When zero suppression is performed 1 is returned _PD_XNUM reads the number of horizontal direction display digits _PD_XNUM is applicable to numeric and character displays The number of that displayed when horizontal direction half size conversion is performed is returned characters can be _PD_YNUM reads the number of vertical direction display digits _PD_YNUM is applicable only to character displays The number of characters that can be displayed in the vertical direction is returned _PD_DIRECT reads the display direction of a character display _PD_DIRECT is applicable only to character displays For horizontal writing O is returned For columnar writing 1 is returned 4 195 PRMSTAT es 14 16 18 19 _PD_PLTNUM Function Range Return value _PD_LNENUM Function Range Return value _PD_ZNNUM Function Range Return value _PD_FIGMD Function Range Return value _PD_WSIZ Function Range Return value _PD_PIPSTAT Function Range Return value _PD_PLTNUM reads the maximum number of plots that can be displayed on the control _PD_PLTNUM is ap
169. a single switch 1 when ON 0 when OFF Data multi switches Switch number 1 when ON 0 when OFF Data selector switch Switch number The switch number of a selector switch indicates the number of an activated switch when the number is 1 or more If it is 0 it indicates that all switches are deactivated Timers Type of the message issuer 4 ID of the message issuer ID of the timer opened by OPENTIM Data 1 fixed Alarms Type of the message issuer 5 ID of the message issuer ID of the timer opened by SETALARM Data 1 fixed 3 20 CHAPTER3 CODING RULES 3 12 Message Format PIO Type of the message issuer 6 ID of the message issuer ID representing the parallel port Data First Bit number matching the condition set by OPENPARALLEL Second Bit status 1 ON 0 OFF Third PIO channel number 0 to 3 Non procedual communication Type of the message issuer 7 ID of the message issuer Data First Port number Second Status Third Number of received bytes Sampling Type of the message issuer 9 ID of the message issuer ID of the primitive that is performing sampling Data Sampled value PLC and memory link Type of the message issuer 16 ID of the message issuer Device name or memory table name Data Device value or memory table value Bar codes Type of the message issuer 18 ID of the message issuer Logical name BCR Data Character string read from bar code reader Ten key pad
170. a function block where the function itself is defined A defined function can be referenced in three ways as shown below according to the position where it is declared Local function Defined in a program other than a global screen program Global function Defined in a global screen program Library function Defined in a library The declared type of a function in the prototype declaration must be the same as the defined type of the function itself Like a variable a function has a return value of a type determined by the type declaration character or A function with no type declaration character is a real number function The return value of a function depends on a value substituted for the function name including the type declaration character Variable declaration is an argument of a function A variable with no argument declaring a variable type is regarded as a real number variable An argument of a function is given when referenced Therefore if a value is changed by substituting it for an argument in the function or the like the variable itself given as the argument by the caller is also changed Type declaration using DECLARE is needed to call a function declared in a function block To exit a function in a function block forcedly use EXIT FUNCTION This is one of the new features of Screen Creator 5 DECLARE EXIT FUNCTION FUNCTIONCHECK 4 101 FUNCTION END FUNCTION m Exampl
171. a telson 4 204 RESETALARM eionnus 4 208 SETALARM wiecccieeieheii ite 4 217 SETTIM i leer ceded teva eb cece NE 4 223 START TEM snein icti 4 230 STOPTIM a sich iii Be toate 4 233 4 7 4 2 Indexes by Functions ee PLC memory link communication Time date GETTIME SETDATE 4 8 CHAPTER4 INSTRUCTION REFERENCE System control Compiler control LOCALCHECK 4 2 Indexes by Functions 4 9 ABS fee ABS Function E Function E Format E Example of Use E Description E Related Item E Example of Program evnt The ABS function calculates an absolute value ABS numerical expression AA ABS 50 AA ABS Var The ABS function calculates the absolute value of the numerical expression numeric constant integer type variable or floating point type variable enclosed in parentheses None input type id data if data lt 0 then data abs data numdsp end evnt num000 datas 4 10 CHAPTER4 INSTRUCTION REFERENCE ADDCYC eg ADDCYC Statement E Function The ADDCYC statement enables even BASIC of a part to read the device declared in control name E Format ADDCYC control name m Example of Use ADDCYC NUMO000 E Description e When a control in a part is used to validate an operation parameter the ADDCYC statement enables even a part program to cyclically communicate with the PLC device memory table set in the part operation parameter specification e The num
172. acter string RIGHTS character string number of characters RIGHTS registered character string number number of characters RIGHTS registered character string name number of characters A RIGHTS MOJI 5 A RIGHTS 4 10 A RIGHTS TOROKU 8 The RIGHTS function returns a character string the specified number of characters bytes starting from the right of the specified character string number of characters specifies the number of bytes of the character string to be fetched with a numeric value from 0 to 255 When number of characters is 0 a null character string is returned character string is a direct character string or a character string variable registered character string number is the numerical expression indicating the number registered by Screen Creator registered character string name is the name of the character string created by Screen Creator or the D type variable indicating the name of the character string MID LEFT 12345678 IGHT b 3 IGHTS no 3 IGHTS id 4 4 211 RMDIR ae RMDIR Statement E Function The RMDIR statement deletes a directory E Format RMDIR directory name m Example of Use RMDIR TEST E Description e The RMDIR statement is an instruction for deleting a subdirectory e Specify the directory to be deleted with a character string constant or variable e The directory to be deleted can be specified in directory name together with a drive n
173. ad 2 Back color read The values indicating the read figure and color number are returned 4 201 PRMSTAT es 2 _PD_LNE Function _PD_LNE reads the display color of a line chart Range _PD_LNE is applicable to line charts Type 1 Specify the number of the line whose display color is to be changed Type 2 Specify one of the following 0 Line type read 1 Line color read Return value The values indicating the read line type and color are returned 4 202 CHAPTER4 INSTRUCTION REFERENCE PSTAT be PSTAT Function E Function The PSTAT function reads the status of the specified part E Format PSTAT part name m Example of Use MODE PSTAT BUHIN E Description e The PSTAT function reads the status of the part specified in part name e part name is the name of the part whose status is to be read or the D type variable indicating the part e The value indicating the mode of the part can be obtained by executing this function The following numeric values indicate modes 1 Switch input disable status 2 Half tone status 3 Close status E Related Item PMODE E Example of Program evnt input type id data if PSTAT BUHIN 0 then pmode BUHIN 1 endif end evnt 4 203 RANGE E RANGE Statement E Function The RANGE function modifies the area s of the control for which the maximum and minimum display data values were specified E Format RANGE control name area
174. aeeeeseeeeeeeaeeeseneeeeessneeeeeaas 2 12 2 1 7 Modifying a created paft mumier eninin aa eaaa a atian ia nane aaar 2 15 Creating a Part to be Linked to a PLC Device oo eee eeceeeeeeeneeeeeeeteeeeeaeeteaeeeeeeeesaeeeeeessaeeeieeenieeeneeeeaees 2 20 2 2 1 N rm ral displaySsnnssene n a ss ee ei ee ek 2 20 2 2 2 lndicator lAMpS iste sie weer e ees Seeks cee eis eects Gace nine elven teed 2 24 2 2 O SWITCHES aiseria aeo a ea sae a eer teen eSa eea teases rte Alan ttre 2 26 2 2 4 Ndicator SWINE Siea aa a a rara aa aaae a AAE aaa ceavasaecabes O Aa van OE EE aa EaR EE AEE ae 2 28 Creating a Part to be Linked to an External Device 0 0 2 eeeeeeceeeeeeeeneeeeeeeteeeeeaeeteaeeeeeeeseaeseeeesieesneeeeaees 2 30 2 3 1 Display for host comp teT seietan a a le a r ce 2 30 Contents 2 4 Creating a Part for Controlling Others ceceeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeseeeeeaeeesaeeesaeeseaeeseaeeseeeesaeeseaeeeneeenas 2 32 2 4 1 Part for calling others from touch Panel eee eeseeeeeeseeeeeenneeeeeeeeeeeeenaeeeeeeaeeeeesaaeeesesaeeeenenaeeneaaes 2 32 2 4 2 Part for sending receiving numerics to from others eeeeeeeeeneeeeeeneeeeeeneeeeeeeaeeeeeeaeeeeeeneeeeeaes 2 34 2 5 Creating a Partfor Usinga TME isea a e ea a a aA aa a a eE a eaa 2 38 2 5 1 P rt tor COUNTING Up nne e a ai its a a a ees et 2 38 2 6 Editing a Program for a Displayed Part ee eeeeeeeeeneeeeeeeeeeeseneeeeeeeaeeeeeenaeeeeseaeeeeeenaeeeeneaaeeesneeeenen
175. ained below 1 _PD_NUMS Function Range Return value 1 2 _PD_ROTATE Function Range Return value 1 3 _PD_STAT Function Range Return value 4 _PD_DSPFMT Function Range Return value 1 5 _PD_DATFMT Function Range Return value _PD_NUMS reads the number of control elements _PD_NUMS is applicable to all display controls The value indicating the display format is set When the display format is not continuous stage type 1 is always set _PD_ROTATEE reads the rotation direction of a control _PD_ROTATE is applicable to all display controls For O degree 0 is returned For 90 degrees 1 is returned For 180 degrees 2 is returned For 270 degrees 3 is returned For pie chart meter lamp and pipe displays 0 is always returned _PD_STAT reads the display format normal reverse video display blinking on and off display of a control _PD_STAT is applicable to all controls One of the following values is returned 0 Normal display 1 Reverse video display 2 Blinking 3 On and off display _PD_DSPFMT reads the display format of a control _PD_DSPFMT is applicable to numeric and character controls The value to be returned depends on whether the numeric or character display is used _PD_DATFMT reads the display data format _PD_DATFMT is applicable to all controls except for clock displays For a real number 0 is returned For an integer 1 is returned For an unsigned integer 2 i
176. al variables are initialized only once Integer and floating point type global variables are initialized to 0 Character and ID type global variables are placed in the status in which nothing is written A global variable is declared as follows GLOBAL VAR When this declaration is made in two or more programs they reference the same variable Variables defined in the static declaration Static variables can be referenced only in the declared program When the OIP is started static variables are initialized only once Integer and floating point type static variables are are initialized to O Character and D type static variables are placed in the status in which nothing is written A static variable is declared as follows STATIC VAR Backup variables have almost the same characteristics as global variables except that their contents are retained even if the OIP power is turned off Backup variables are not initialized even if the power is turned on again However a backup variable which hasn t been initialized is initialized to 0 when new screen data is down loaded A backup variable is declared as follows BACKUP VAR When this declaration is made in two or more programs they reference the same variable Backup variables can be used for only OIP units with built in backup memory The backup memory stores data in it even when the OIP is turned off If backup variables are used for an OIP with no backup memory they cause the same
177. ally reads the contents of the declared PLC device through communication If the previously read contents do not match the contents read by this statement change of contents a messages is transmitted to the declaring operation program This statement never operates during execution of the operation program because it makes a declaration e This declaration must be made before the device is used in the program e Communication occurs when data is read from the device example A 00 D0001 for which CYCLIC is not declared e To declare CYCLIC for the memory table the table number must be specified with an integer value e In the cyclic operation of the memory table a message is issued when data is written from the host computer or operation program to the memory table This message is issued even if the contents do not change e Specifying number following device name or memory table name enables CYCLIC to be continuously declared e When the screen is switched a message is issued to all the parts for which CYCLIC is declared INPUT 4 60 CHAPTER4 INSTRUCTION REFERENCE CYCLIC eg E Example of Program conf cyclic O0O d0O1l 00 d4 3 cyclic O00 7mtb1 20 00 mtb1 100 end conf evnt input ty id dat if id 00 mtb1 20 then numdsp num dat end if end evnt 4 61 CYCLIC2 8 CYCLIC2 Statement E Function E Format m Example of Use E Description E Related Item E Exam
178. alue from 0 to 15 3 _PD_PIPCOLOR Function _PD_PIPCOLOR changes the internal color of a pipe or lamp display Range _PD_PIPCOLOR is applicable to pipe and lamp displays Type Specify one of the following 0 Change of OFF display color valid for pipe and lamp displays 1 Change of ON1 display color valid for pipe and lamp displays 2 Change of ON2 display color valid for pipe displays Control value Set the number of the internal color to be changed with a numeric value from 0 to 15 4 190 CHAPTER4 INSTRUCTION REFERENCE PRMCTL eg 4 _PD_BSLNE Function Range Type Control value 5 _PD_BSCOLOR Function Range Type Control value 6 _SW_ONFIG Function Range Type Control value 7 _SW_OFFFIG Function Range Type Control value _PD_BSLNE changes the type of a base line or a reference line _PD_BSLNE is applicable to bar graphs and line charts Specify one of the following 0 Change of base line type 1 Change of reference line 1 type 2 Change of reference line 2 type Set the number of the line type to be changed with a numeric value from 0 to 3 _PD_BSCOLOR changes the color of a base line or a reference line _PD_BSCOLAOR is applicable to bar graphs and line charts Specify one of the following 0 Change of base line color 1 Change of reference line 1 color 2 Change of reference line 2 color Set the number of the line color to be changed with a numeric value from 0 to 15
179. alue from 0 to 23 Minute is a numeric value from 0 to 59 Second is a numeric value from 0 to 59 e Read variables must be integer type variables e Once date is set using the SETDATE command in a model with a battery backup calendar IC GCS56LC or GCS5EM the date is updated even while the power is off If a model with no calendar IC GCS53LC or GC53LM is turned off the date is initialized to January 1 1998 Thursday and the time to 00 00 00 when it is turned on again The date and time are updated while the power is on DATE GETDATE SETDATE SETTIME TIME H M S NUMO000 H NUM001 M NUM002 S 4 110 CHAPTER 4 INSTRUCTION REFERENCE GLOBAL eg ls GLOBAL Statement E Function The GLOBAL statement declares that global variables are to be used E Format GLOBAL variable name variable name m Example of Use GLOBAL VAR XYZ 2 3 MOJI 20 E Description e The GLOBAL statement declares that global variables are to be used Global variables can be read and written from all programs Global variables must be declared before they are used in a program These variables are initialized once when the power supply is turned on The values of global variables used after the power supply has been turned on are retained e A normal variable an array variable or a character string variable can be written in variable name e When an array or character variable is declared the DIM and STRING statements need not be dec
180. am cont field 5 global no global mojilS moji2s end field fopen MEMORY 2 5 end conf FGET 5 3 numdsp NUMOOO no strdsp STROOO mojil strdsp STROO1 moji2s end evnt 4 83 FIELD END FIELD ee FIELD END FIELD Statement E Function FIELD END FIELD sets a file read write unit E Format FIELD file number variable list variable list END FIELD m Example of Use FIELD 5 global abcd xyz static dddd 10 10 backup moji END FIELD E Description FIELD END FIELD declares the unit for reading the file by the FGET statement or that for writing the file by the FPUT statement e file number specifies the number of the file onto or into which the variable group in the field is to be written or read This file number must match the number of the file opened by the FOPEN statement it is a value from 1 to 16 e The variable list that can be written between FIELD and END FIELD must be the GLOBAL STATIC or BACKUP variable The method for declaring variable lists is the same as that for declaring the GLOBAL STATIC and BACKUP variables The FIELD declared in the program where the FOPEN statement was executed is the default read write unit e When a file is read or written by a part that differs from the part opened by the FOPEN statement the FIELD declared in that part is used If this FIELD is not declared the default FIELD is used If two or
181. ame E Related Item MKDIR CHDIR m Example of Program RMDIR C TEST end evnt 4 212 CHAPTER4 INSTRUCTION REFERENCE ROTATE eg ROTATE Statement E Function The ROTATE function rotates the figure displayed in the graphic display E Format ROTATE control name angle of rotation m Example of Use ROTATE FIG000 2 E Description e control name is the graphic display name or the ID type variable indicating the graphic display e angle of rotation specifies the angle of rotation with one of the following numeric values 0 Rotation of 0 degree 1 Rotation of 90 degrees 2 Rotation of 180 degrees 3 Rotation of 270 degrees E Related Item FIGDSP m Example of Program evnt input ty id fig ROTATE FIGOOO figs end evnt 4 213 RSTAT 8 RSTAT Function E Function E Format m Example of Use E Description E Related Item m Example of Program The RSTAT function checks the status of registered objects RSTAT registration name type option VAR RSTAT GAMENI 0 1 Of registered objects the RSTAT function obtains the number of the object that is number specified by option away from the specified registration name A variable or constant representing a screen name registration character string name or registration graphic name can be specified in registration name Specify 0 in type When option is a positive value the RSTAT function checks the regis
182. ame allocation position E Example of Use VAR CVI MOJI 5 E Description e The CVI function allocates data four bytes from the specified allocation position of the specified character variable name The allocated data is regarded as an integer value e allocation position must be an integer or floating point type variable or constant 1 specifies the beginning of the character string variable e A cut out value is converted into a 86 series boundary E Related Item MKS MKB MKW MKI MKF MKID CVB CVW CVF CVID E Example of Program conf end conf evnt orgs 1234567 data CVI org 3 numdsp NUM000 data Displays amp H36353433 end evnt 4 57 CVID es CVID Function E Function The CVID function allocates data from any position of a character string variable E Format CVID character string variable name allocation position E Example of Use VAR CVID MOJI 5 E Description e The CVID function allocates data six bytes from the specified allocation position of the specified character variable name The allocated data is regarded as an ID value e allocation position must be an integer or floating point type variable or constant 1 specifies the beginning of the character string variable e The CVID function returns an D type value e A cut out value is converted into a 86 series boundary by 2 bytes E Related Item MKS MKB MKW MKI MKF MKID CVB CVW CVI CVIF E Exam
183. amp H30 E Description e The CHR function assigns the character 1 byte character corresponding to the character specified by character code e character code must be an integer from 1 to 255 e As a result of executing this function the character corresponding to character code is returned E Related Item ASC E Example of Program evnt input type S id data mojiS CHRS datas strdsp STROOO moji end evnt 4 37 CINT fe ________e CINT Function E Function E Format m Example of Use E Description E Related Item m Example of Program evnt The CINT function rounds off a real number and converts it to an integer CINT numerical expression A CINT FLOAT e The CINT function rounds off the value indicated by numerical expression and converts it to an integer e The conversion result range becomes the integer range INT input types id data intvar numdsp end evnt CINT data NUM000 intvar 4 38 CHAPTER4 INSTRUCTION REFERENCE CIRCOLOR E CIRCOLOR Statement E Function The CIRCOLOR statement changes the tile and colors of the pie chart display E Format CIRCOLOR control name zone position tile display color background color m Example of Use CIRCOLOR CIRO00 2 1 2 3 E Description e The CIRCOLOR statement changes the tile and colors of the the pie chart display 1 indicates that the color and tile for which 1 was specified remain unchanged e control name
184. ample of Use See Example of Program below E Description e The SELECT CASE statement executes the CASE statement list satisfying the specified conditional expression e When CASE CASE ELSE and END SELECT appear after the statements satisfying the specified condition have been executed the SELECT CASE statement executes the statement following END SELECT e Condition judgment can be performed up to 50 times E Related Item IF THEN ELSE m Example of Program evnt input ty id dat select case dat case 1 gt When dat is 1 aaa 1 case 2 3 gt When dat is 2 or 3 aaa 2 case 4 to 10 gt When dat is 4 to 10 aaa 3 case else gt When dat is another value aaa 4 end select end evnt 4 216 CHAPTER4 INSTRUCTION REFERENCE SEND PT SEND Statement E Function The SEND statement sends data to the specified screen part or logical connecting device E Format SEND send destination name m Example of Use SEND BUHIN E Description e The SEND statement sends the data written by the PRINT statement to the specified send destination e send destination name is the name of the screen or part to which data is to be sent the D type variable indicating the name or one of the following logical connecting devices HST Host computer PRN Printer e The screen or part script that received data is not executed when the SEND command is issued it is executed when the program that issued the SEND command ter
185. ange 2 Back color change Control value Set the number of the background color to be changed with a numeric value from 0 to 15 3 _PD_PIPCOLOR Function _PD_PIPCOLOR changes the internal color of a pipe or lamp display Range _PD_PIPCOLOR is applicable to pipe and lamp displays Type Specify one of the following 0 Change of OFF display color valid for pipe and lamp displays 1 Change of ON1 display color valid for pipe and lamp displays 2 Change of ON2 display color valid for pipe displays Control value Set the number of the internal color to be changed with a numeric value from 0 to 15 4 190 CHAPTER4 INSTRUCTION REFERENCE PRMCTL eg 4 _PD_BSLNE Function Range Type Control value 5 _PD_BSCOLOR Function Range Type Control value 6 _SW_ONFIG Function Range Type Control value 7 _SW_OFFFIG Function Range Type Control value _PD_BSLNE changes the type of a base line or a reference line _PD_BSLNE is applicable to bar graphs and line charts Specify one of the following 0 Change of base line type 1 Change of reference line 1 type 2 Change of reference line 2 type Set the number of the line type to be changed with a numeric value from 0 to 3 _PD_BSCOLOR changes the color of a base line or a reference line _PD_BSCOLAOR is applicable to bar graphs and line charts Specify one of the following 0 Change of base line color 1 Change of reference line 1 color 2 Ch
186. ange of reference line 2 color Set the number of the line color to be changed with a numeric value from 0 to 15 _SW_ONKFIG changes a switch ON display graphic _SW_ONKHIG is applicable to switches and selector switches For a switch specify 1 For a selector switch specify the element number of the switch whose ON graphic is to be changed The element number starts at 1 Specify the registration graphic number displayed when a switch is ON _SW_OFFFIG changes a switch OFF display graphic _SW_OFFFIG is applicable to switches and selector switches For a switch specify 1 For a selector switch specify the element number of the switch whose OFF graphic is to be changed The element number starts at 1 Specify the registration graphic number displayed when a switch is OFF 4 191 PRMCTL l e The types and usage of the request codes that can be used by PRMCTL3 are explained below 1 _PD_RANGE Function _PD_RANGE sets the display range of a display Range _PD_RANGE is applicable to bar graph line chart free graph slide meter and plot displays Type When the plot display is used specify O Xmin change 1 Xmax change 2 Ymin change or 3 Ymax change When the bar graph line chart free graph slide or meter display is used specify 2 minimum change or 3 maximum change Control value Set the value display range to be changed 2 _PD_BSVAL Function _PD_BSVAL changes the setting value of a base or
187. aph name or the D type variable indicating the graph e The maximum and minimum area values in the control can be set for each display as follows Area 1 Area 2 Area 3 Area 4 Plot display Minimum Maximum Minimum Maximum horizontal horizontal vertical vertical value value value value Bar graph display Minimum Maximum Base value value value Line chart display Minimum Maximum value value Free graph display Minimum Maximum value value Slide display Minimum Maximum value value Meter display Minimum Maximum value value is ignored even if it is specified E Related Item None E Example of Program evnt input types id min max if types 3 then range MTROOO min max 0 0 endif end evnt 4 204 CHAPTER4 INSTRUCTION REFERENCE READTIM eg READTIM Function E Function The READTIM function reads the current value of the specified timer E Format READTIM timer number m Example of Use DD READTIM TNO DD READTIM VAR E Description e The READTIM function reads the current elapse time of the operating timer This time is read in units of 100 milliseconds e timer value is the D type variable indicating the number of the timer to be read or an integer type value from 0 to 15 E Related Item OPENTIM STARTTIM STOPTIM CLOSETIM CONTTIM WRITETIM m Example of Program conf static timid timid OPENTIM settim timid 20 0 starttim timid end conf
188. ar number display value m Example of Use BARDSP BARO00 1 30 E Description e The BARDSP statement displays bar data in the bar graph display e control name is the name of a bar graph or the D type variable indicating the graph e The value indicating the bar number in the bar graph to be displayed is setin bar number The bar number starts at 1 e display value is the numeric data indicating the size of the bar graph e display value cannot be changed even if this statement is issued to the display for which operation parameters are set to effective in the control E Related Item BARCOLOR BARSHIFT E Example of Program conf static name name BAROOO end conf evnt input types id data bardsp name 2 data end evnt 4 20 CHAPTER4 INSTRUCTION REFERENCE BARSET pe BARSET Statement E Function The BARSET statement sets data in the bar graph display E Format BARSET control name bar number display data m Example of Use BARSET BUHIN GRAPH 2 30 0 E Description e The BARSET statement sets the data to be displayed in the bar graph display The speed of executing the PRDSP display statement after setting data in each bar is faster than that of modifying all bar values after executing the BARDSP statement e control name is the name of the bar graph display name or the ID type variable indicating the bar graph display e bar number indicates which bar data is to be modified when two or more bar
189. ar2 30 end conf evnt input type id data if type 3 then varl func data var2 endif end evnt SUB1 RETURN function func a b end function Initialization block INIT END INIT Function type declaration Initialization block Configuration block Event block Subroution block Function block e An initialization block written in a screen or part program is executed only once when the configuration block or event block of that program is executed for the first time An initialization block is used to declare or initialize variables needed in a configuration block or event block Configuration block CONF END CONF e The configuration block where screens and parts are written is executed only once when a screen is displayed This block is not executed while a screen is being displayed It is executed only once again when another screen is redisplayed e The configuration block for global screens and parts is executed only once when the system is started e The configuration block is used to write processing such as initialization e Only the closed part s configuration block is not executed even if a screen is displayed it is executed when a part is opened 3 22 CHAPTER3 CODING RULES See OPEN Instruction 3 13 Program Blocks Event block EVNT END EVNT e The event block is a program block that starts its operation when a message is re
190. are written tic timeid n c Q static flag static number You can use the static instruction to retain the contents of variables during a program execution In this example these instructions are used to retain the value of the timer ID the timer ON OFF flag and the display value Some static instructions can also be written as a group The list of parameters also can be chained delimiting each parameter by a comma in this case Example static timeid flag number flag s 0 The statement flag 0 initializes the flag variable which indicates the timer ON OFF state numdsp NUM000 0 The numdsp instruction displays 0 first at starting Configuration Block Nothing is processed Event Block input type id data 2 39 2 5 Creating a Part for Using a Timer The input instruction reads messages from the Switch control and the timer if types 3 and id else if type 4 then end if SWTOOO and data 1 then lt When the switch is pressed lt When messages from the timer are read An operation to be performed when the switch is pressed and an operation to be performed when a message is received from a timer are described after then received from the timer each transmitted every second A message is time the displayed value is counted A message is If the switch is pressed the following program is executed
191. ariable declaration in user defined functions and referencing external variables 0 3 17 il Contents 3 1 Progrant Operations srisiecscec ks E E A cede de Neveaee pec adteh seeatabepente AN 3 18 3 12 Message Formatering arnie feietel chet davidonees Suet eddie etna ee ead ee ee 3 20 3 13Program BlOCKS s scz c2ece ciaeis ccugdecsanpeace Qesnaaes aceedspuscegiesnieas AEEA 3 22 3 14 Devices and COMMUNICATION 00 eee eeeeceteeeeeeeteeeeeeeeeeeaeeesaeeseaeeeeaeeseaeeeeaeeseaeeseaeeseaeeseaeeseaeeseeeeeneeeneeteaees 3 24 S 15 Memory Tables EE cil aisle sah sineshastacespuscaceniaadaesaaesasassaneadascesenaskstesnniaceevansisagiseepeagesstsdaecstaased 3 25 3 15 1 Describing memory table nnani a ein steed ge ieee dene ties 3 25 3 15 2 Reading and writing One CleMent ceeeeceeeeeeeeeeeeeneeeeeeeeeeeeeaeeeeaeeeeaeeseaeeseaeeteeeeeaeeteeessaeeenees 3 25 3 15 3 Reading and writing two or More elements eee eeeeeeeeeneeeeeeeeeeeeenaeeeeeeaaeeeeeeaeeeeeeaeeeenenaeeeeeas 3 25 S16 a ee ee File Systems3 26 3 16 1 Precautions for file systems eccccceeeceeeeeeeeeeeneeceeeeseneeeesensesengeneeesseeeesnseeeeseneneeseneenensenseneneees 3 26 3216 2 Specifying acfile cicc ss ive seceeties ae is cota nahn a cee Mat eae ibe ieee 3 27 CHAPTER 4 INSTRUCTION REFERENCE ccceseeeeeeeees 401 4 1 INStFUCTION RETEFEN CO vi vcssicidicviveds a a a Oe 4 2 4 2 Indexes by FUNCUONS 2 ccie eet i e a a a a e
192. art The program of this part ends here This program sends a message containing a display value to the remote destination part specified in the operation parameter when the switch is pressed In the next place create a part that receives numerical data Control to use One Number indicator control NUMO000 Exterior view of part Figure Number indicator control NUMOOO A program of a part that receives numerical data is given below Init local type id data end init conf end conf evnt input type S id data if type s 2 then numdsp NUM000 data end if 2 36 CHAPTER2 EXAMPLES OF PROGRAMMING 2 4 Creating a Part for Controlling Others end evnt Initialization Block Nothing is processed except that this block defines local variables Configuration Block Nothing is processed Event Block input type s id data The input instruction reads messages from the specified part if type s 2 then numdsp NUM000 data end if The condition type 2 means receiving of a message from the part The message is set in data and displayed by the numdsp instruction The program of this part ends here When another part sends numerical data to this part this program displays the numerical data Next try to paste two parts on the screen and use them actually The operation parameter destination part name must coincide with the name of the part to receive the data
193. ary to specify the capacity to be assigned to the RAM files on the system mode screen of the OIP Use RAM File Setup of System Setup on the system screen A model with backup memory uses the backup memory for backup variables and RAM files Therefore the sum of the memory size used for backup variables and the memory size used for RAM files must be less than the total size of the built in backup memory Making backup Data in drive A and memory file is backed up and stored even after the power is turned off However the backup data is cleared to zero if the memory size is changed on the system mode screen Formatting files Before using a file system it is necessary to format the file Use the K Basic FORMAT command to format a file Formatting memory card drive The OIP s memory card drive creates files in the MS DOScompatible format and data in the memory card can be read and written by the MS DOS system running on a personal computer etc However make a directory so that the sum of a file path name and a file name does not exceed 128 characters 3 26 CHAPTER3 CODING RULES 3 16 File Systems The OIP s memory card drive does not support long file names which are supported by Windows 95 etc Be careful not to give long names to files which are to be used on Windows 95 etc 3 16 2 Specifying a file The character A or E followed by a colon indicates a drive Example A E To show a directory type or as shown
194. ata FREDSP name datas end evnt 4 98 CHAPTER4 INSTRUCTION REFERENCE FSEEK PT FSEEK Function E Function The FSEEK function changes the read write position of a file E Format FSEEK file number reference position offset m Example of Use AAA FSEEK 12 0 0 E Description e The FSEEK function moves the read write position of the file by the value specified by offset starting from reference position e file number specifies the number of the file opened by the FOPEN statement 0 1 and 2 can be specified in reference position When 0 is specified the FSEEK function moves the read write position starting from the beginning of the file When 1 is specified the function moves the read write position starting from the current position When 2 is specified it moves the read write position starting from the end of the file e Specify offset in bytes Specify a positive value in offset when moving the read write position to the end of the file e The read write position obtained as a result of executing the FSEEK function is returned E Related Item FOPEN FCLOSE FPRINT FWRITE FINPUT E Example of Program conf fopen C TEST 2 5 end conf evnt AAAS 12345 fwrite 5 AAAS ABCD fseek 5 0 0 finput 5 VSTR end evnt 4 99 FSUM 8 FSUM Function E Function E Format m Example of Use E Description E Related Item The FSUM function calculate
195. ata 1 then end if Condition type 3 following if means a message from a Switch control id SWT000 means the ID of the Switch control data 1 means that the switch is ON Inserting and between these three conditions enables the instruction of the next line executed if all the conditions are satisfied If the if statement consists only of type 3 and id SWT000 this condition is satisfied twice when the switch is pressed and when it is released In this example the operation is restricted to be executed only when the switch is pressed after data 1 is added Pressing the switch Releasing the switch generates an event generates an event N T Presshere Releae Contents of message Contents of message input type id data input type id data 3 SWTO000 1 3 SWTO000 0 Note If the switch type is set to Momentary it generates two messages when it is pressed and when it is released 2 18 CHAPTER2 EXAMPLES OF PROGRAMMING 2 1 Creating a Part for Displaying Numerics These programs are so modified to execute the numdsp instruction and display 5678 on the number indicator control when the if statement is satisfied The part is almost completed now Save the programs in the same manner as described in 2 1 2 Also save the part as described in 2 1 4 Though a warning message is given since the part test has already been registered overwrite it to replace the old part wit
196. ata to a non procedual communication transmission buffer serial port in the text mode The WRITESIOB statement writes transmission data to the same buffer serial port in the binary mode e port number specifies the channel CH1 to CH3 to which transmission data is to be written with a numeric value from 1 to 3 e Of the transmission data written to the variable specified by variable name number of bytes specifies the number of bytes to be transmitted valid when the binary mode is used e variable name specifies the name of the variable to which transmission data is written e In the text mode the written data is transmitted till the code Oh indicating the end of the character string is detected That is data from 1 to OFFh can be transmitted No terminator code is automatically inserted into the end of data e Inthe binary mode all data 0 to OFFh can be transmitted e The port to which transmission data is to be written must be opened by the OPENSIO statement in advance OPENSIO CLOSESIO WRITESIO WRITWSIOB SETSIO conf global buf S 200 opensio 2 1 bufs setsio 2 amp HD end conf evnt sendbufS ABCDEFG WRITES IO 2 sendbuf closesio 2 end evnt 4 252 CHAPTER4 INSTRU CTION REFERENCE WRITESIO WRITESIOB 4 253 CHAPTER 4 INSTRUCTION REFERENCE 4 1 4 1 Instruction References es 4 1 Instruction Reference ABS si cuec nein Bet noth ie en See 4
197. ated part Press this display section The numeric value changes Modify the created part so that a numerical value may change when the display section is pressed 1234 gt 5678 See ee ee ee en ee ee ee ne ee a ee ee ee ne a ee ne ee ee ee ee ee eee First read test which has been created above Select Library select Open then select Parts The Open Parts dialog box appears Select User Parts and open test db Aden ean ncaa nth a ds eed 3 3 In this example try to add a switch control to this part in order to use the touch panel Select Create on the menu select Control then select Switch The switch control setting dialog box is displayed Press the OK Arrange button since the default setting is not changed in this example The mouse cursor changes into the mouse Click on the part editor window of the part test The mouse cursor changes into a square switch control Put this in the upper left of the part area Since the switch control is a switch of the touch panel 20 dots x 20 dots it moves in 20 dot steps Note This switch is a momentary switch It is turned on when you press it and turned off when you release the finger 2 15 2 1 Creating a Part for Displaying Numerics Then try to change the size of the switch control To change the size drag a handle around the switch control with the mouse Drag the lower right handle of the switch control since the area should be
198. ates the thickness of the line dot size indicates the size of the dot Specify both the line thickness and dot size with a numeric value from 0 to 2 E Related Item LINE DOT E Example of Program conf cotor Ty Oy 3 end conf evnt dot 100 200 dot 100 300 Color Te go Oh 7 10 line 100 200 100 300 end evnt 4 48 CHAPTER4 INSTRUCTION REFERENCE CONF END CONF eg CONF END CONF Statement E Function The CONF END CONF statements declare the configuration block area E Format CONF END CONF m Example of Use CONF static VAR END CONF E Description e The configuration block written in a screen and a part is executed only once when the screen is displayed This block is not executed when the screen is being displayed It is executed once again when the screen is redisplayed after another screen has been displayed e The configuration block for global screens and parts is executed only once when the system is started e Initialization blocks INIT are used to write processing such as initialization e Only the configuration block for closed parts is not executed even if a screen is displayed This configuration block is executed when a part is opened See OPEN Instruction E Related Item EVNT END EVNT INIT END INIT E Example of Program CONF static mojis END CONF evnt input ty id dat end evnt 4 49 CONST se CONST Statement E Function The CONST stat
199. bar data in the bar graph display e control name is the name of a bar graph or the D type variable indicating the graph e The value indicating the bar number in the bar graph to be displayed is setin bar number The bar number starts at 1 e display value is the numeric data indicating the size of the bar graph e display value cannot be changed even if this statement is issued to the display for which operation parameters are set to effective in the control E Related Item BARCOLOR BARSHIFT E Example of Program conf static name name BAROOO end conf evnt input types id data bardsp name 2 data end evnt 4 20 CHAPTER4 INSTRUCTION REFERENCE BARSET pe BARSET Statement E Function The BARSET statement sets data in the bar graph display E Format BARSET control name bar number display data m Example of Use BARSET BUHIN GRAPH 2 30 0 E Description e The BARSET statement sets the data to be displayed in the bar graph display The speed of executing the PRDSP display statement after setting data in each bar is faster than that of modifying all bar values after executing the BARDSP statement e control name is the name of the bar graph display name or the ID type variable indicating the bar graph display e bar number indicates which bar data is to be modified when two or more bars are displayed in one bar graph display The bar number is integer value data starting at 1 display data is t
200. be transmitted and received In this mode the end codes of texts are also set and used The end codes are used to judge the data to be received E Related Item CLOSESIO SETSIO WRITESIO WRITWSIOB FLUSH IOCTL m Example of Program conf global buf S 200 pos buf OPENSIO 2 setsio 2 end conf evnt amp HD strdsp STROOO buf closesio 2 end evnt 4 170 CHAPTER4 INSTRUCTION REFERENCE OPENTIM es OPENTIM Function E Function The OPENTIM function allocates timer resources E Format OPENTIM m Example of Use VAR OPENTIM E Description e The OPENTIM function allocates the resources necessary to use a timer e The OPENTIM function must be an D type variable because it returns the ID of the timer to be used e The allocated ID can be used to set the timer e The system can use up to 16 timers The timers not to be used must be returned to the system See CLOSETIM e The OPENTIM function can be used by the screen or part program being displayed If this function is executed on an undisplayed rear screen an error occurs e The allocated timer is not deallocated even if one screen changes to another If the timer is being used by the event type a message is also issued to the rear screen E Related Item CLOSETIM STARTTIM STOPTIM CONTTIM WRITETIM READTIM m Example of Program conf static timid timid OPENTIM settim timid 20 0
201. below Example A ABC A ABC DEF Each file name consists of a file name in eight characters and an extension in three characters ASCII codes and Kanji codes can be used Example ABCDE DOC 3 27 3 16 File Systems 3 17 Notes Note the following points when writing K Basic Color and tiling numbers In K Basic numeric values 0 to 15 are used to change the display colors and tile figures of graphs and displays These numbers are assigned like 0 1 2 starting at the left of the pallet color displayed by the tool and tile figures Note 1 on screen transition When one OIP screen is switched to another the momentary switch is forcibly turned OFF if itis ON This is done irrespective of the mode Input Enabled Input Disabled or Half Tone of the switch When the OFF message is issued the BASIC program is also activated Note 2 on screen transition When the screen for cyclic communication is displayed messages are issued from all the devices that are performing cyclic communication if a message is issued to a part of the undisplayed screen the program is executed in background If an attempt is made to execute an unexecutable instruction in background however an error occurs If an infinite loop is created in a program switching and communication cannot be performed Parts on which switches are installed can be moved only in grid units 3 28 CHAPTER3 CODING RULES CHAPTER 4 INSTRUCTION REFERENCE
202. ber of devices must match that of devices to be used by the control The devices placed in consecutive stages are used only the number of elements control name must be the primitive in the local part e If the specified control is not using the PLC device memory table an error occurs e When the control is specified in a numeric display in a doubleword the ADDCYC statement also reads it in a doubleword E Related Item CYCLIC CYCLIC2 ADDCYCID E Example of Program conf ADDCYC NUMOO00 gt Uses 2X2 as a consecutive stage display end conf evnt input types id data Displays data on the corresponding display id1l addcycid NUM000 Indicates the ID of the device being used i getoffset idl id 1 Indicates the device to be used relative to the first device id1l getid NUMOOO i Obtains the ID of the corresponding display numdsp idl data Displays the ID on the display end evnt ADDCYC2 ee ADDCYC2 Statement E Function E Format m Example of Use E Description E Related Item m Example of Program The ADDCYC2 statement enables even BASIC of a part to read the device declared in primitive name ADDCYC72 primitive name ADDCYC2 NUMO000 e The ADDCYC2 statement is almost equivalent to the ADDCYC statement e The only difference between these two statements is that the PLC device declared in the ADDCYC2 statement can communicate to obtain data even
203. cal variable It regards such a variable as a global variable in a global screen program 2 If global and local variable names or subroutine names are duplicate In this case such variables or subroutines are regarded as global variables or subroutines 3 If two or more global local and or library function names are duplicate In this case the priority is given to a library function if any If no library functions are used the functions are regarded as global functions e The warning level is set to 0 unless the LOCALCHECK statement is written e The warning level is changed from the position where the LOCALCHECK statement is written in the program e The LOCALCHECK statement is one of the new features of Screen Creator 5 E Related Item BACKUP DECLARE DIM FUNCTION GLOBAL LOCAL 4 143 LOCALCHECK ee E Example of Program conf local newvar3 newvarl S no warning LOCALCHECK 1 newvar2 warning is given newvar3 no warning end conf 4 144 CHAPTER4 INSTRUCTION REFERENCE LOF eg LOF Function E Function The LOF function calculates the size of the specified file E Format LOF file number m Example of Use AAA LOF file number E Description e file number specifies the number of the file whose size is to be calculated This file number must match the number of the file opened by the FOPEN statement e The size of the specified file is calculated in bytes E Related Item FOPEN FIEL
204. cal variable names or subroutine names are duplicate In this case such variables or subroutines are regarded as global variables or subroutines 3 If two or more global local and or library function names are duplicate In this case the priority is given to a library function if any If no library functions are used the functions are regarded as global functions e The warning level is set to 0 unless the LOCALCHECK statement is written e The warning level is changed from the position where the LOCALCHECK statement is written in the program e The LOCALCHECK statement is one of the new features of Screen Creator 5 E Related Item BACKUP DECLARE DIM FUNCTION GLOBAL LOCAL 4 143 LOCALCHECK ee E Example of Program conf local newvar3 newvarl S no warning LOCALCHECK 1 newvar2 warning is given newvar3 no warning end conf 4 144 CHAPTER4 INSTRUCTION REFERENCE LOF eg LOF Function E Function The LOF function calculates the size of the specified file E Format LOF file number m Example of Use AAA LOF file number E Description e file number specifies the number of the file whose size is to be calculated This file number must match the number of the file opened by the FOPEN statement e The size of the specified file is calculated in bytes E Related Item FOPEN FIELD FCLOSE FPUT FGET EOF E Example of Program cont field 5 global no global mojilS
205. cating the color number of the tile display section Specify this color number with a numeric value from 0 to 15 e background color is the numeric value indicating the color number of the tile background section Specify this color number with a numeric value from 0 to 15 NUMDSP NUMFORM static name name end conf evnt NUMO 00 input type id data 3 then NUMCOLOR name 2 1 1 1 if types endif end evnt 4 162 CHAPTER4 INSTRUCTION REFERENCE NUMDSP pe NUMDSP Statement E Function E Format m Example of Use E Description E Related Item E Example of Program conr end con evnt inpu name f end evn The NUMDSP statement displays data in the numeric display NUMDSP control name display data NUMDSP BUHIN GRAPH 30 0 The NUMDSP statement displays data value in the numeric display control name is the numeric display name or the ID type variable indicating the numeric display display data is the numeric data to be displayed in the numeric display Specifying a primitive name in display name when the numeric display is of continuous stage type enables the same data to be displayed for all the elements When setting a value for each element use the GETID function to obtain the control ID and specify this ID in control name display value cannot be changed even if this statement is issued to the display for which operation parameters are set
206. ceived The contents to be executed when a switch is pressed are written in this block The event block cannot be written in the global screen program Note A configuration block is not executed if a message is sent to a screen not displayed and an event block is executed by the timer or a host command Thus initialization written in the configuration block is not executed Write necessary initialization in an initialization block 3 23 3 14 Devices and Communication 3 14 Devices and Communication To reference and modify PLC devices device names are written in K Basic as follows A station number and a device name are delimited by VAR 00 D100 The contents of the device whose device name is D100 and whose station number is 00 are read 00 D200 40 40 is written into the device whose device name is D200 and whose station number is 00 Communication is used to read and write the contents of a device Screen Creator 5 provides the following two communication methods Cyclic communication e The OIP always communicates with the PLC to read the contents of the device to be used A message is issued when the contents of the device to be used are modified e Cyclic communication can be performed even if a K Basic program is not executed e Cyclic communication is enabled by declaring CYCLIC e Cyclic write is inapplicable Event communication e Event communication is performed when the contents of a device are read
207. closes the specified file FCLOSE file number FCLOSE 5 The FCLOSE statement closes the file specified by file number e file number must match the number of the file opened by the FOPEN statement to be explained later If another file number is specified an error occurs Specify file number directly with a numeric value from 1 to 16 FOPEN FIELD FPUT FGET cont field 5 global no global mojilS moji2s end field fopen MEMORY 2 5 end conf FCLOSE 5 end evnt CHAPTER 4 INSTRUCTION REFERENCE FGET PT FGET Statement E Function The FGET statement reads data from the specified file E Format FGET file number record number m Example of Use FGET 5 3 E Description e The FGET statement reads the contents of the specified record record number in the specified file file number into the variable group declared by FIELD END FIELD e file number specifies the number of the file to be read This file number must match the number of the file opened by the FOPEN statement e record number specifies which record in the file is to be read first In this case the variable group included in FIELD declared in file number is used as one unit record number is 1 when data is read from the beginning of the file E Related Item FOPEN FIELD FCLOSE FPUT m Example of Program cont field 5 global no global mojilS moji2s end field fopen MEMORY 2
208. ctric Industry Panadac 7000 Standard components centered on the parts used for middle size systems GC53 in the GC5x Series have drastically been added viii CHAPTER 1 INTRODUCTION l 1 What is an Operation Program 1 1 What is an Operation Program You must code an operation program to display data such as numerical values and characters in a part or to make a switch operate when you press it on the touch panel A dedicated language K Basic is used to code the specific operation of each part Programe Bie TaD Winde Prop Held cosa e ese a SEE l TE saj zi d a Diselay svetem error occurred shile the Advance Intelligent Parel is Error of time or data Error of low battery waltaze Error of ral communication System errors other than the above Cerror code 4100 to 4699 S000s are bask can be set to hide error disela Men I is set for operat ian i emt string st mum 100 string messet 5 din me h i 50 HeC OH hhi CH El CH erii Parity Error chrblahidh arti har Bie Ferrar hrti iei 1 2 CHAPTER INTRODUCTION 1 2 Objects to be Described in Operation Programs 1 2 Objects to be Described in Operation Programs _ 1 2 1 Operation programs for parts You can code an operation program individually for each part 1 2 2 Operation programs for screens You can also code an operation program for each screen just like for a part Screen Operat
209. d 0 Normal status 1 Input disable status 2 Half tone status E Related Item None E Example of Program evnt input type id data if type 3 then SWMODE SW2 1 SWMODE var 2 end if end evnt 4 241 SWREAD ee SWREAD Function E Function The SWREAD function reads the status of the specified switch E Format SWREAD switch name m Example of Use STATE SWREAD SW1 E Description The SWREAD function reads the status ON or OFF of the specified switch e switch name is the name assigned to the switch or the D type variable indicating the name e The CONF and part CONF block of the global screen cannot be used in the switch primitive where operation parameters are valid e The SWREAD statement cannot read the synchronous switch status of an undisplayed screen e As a result of executing this function the status of normal switches is indicated by the following numeric values 0 OFF status 1 ON status e As a result of executing this function the status of selector switches is indicated by the following numeric values 0 All selector switches are OFF Other values Numbers of the sub switches that are ON The sub switch number in the upper left end is 1 The sub switch numbers increase in the right direction They decrease in the downward direction E Related Item SWWRITE m Example of Program evnt input type id data id SW2 state SWREAD ID if state 0 then Swwrite id 1
210. d Item m Example of Program The EOF function checks whether the end of the file was reached EOF file number AAA EOF file number e file number specifies the number of the file for which whether the end of the file was reached is to be checked This file number must match the number of the file opened by the FOPEN statement e Return value 1 indicates that the end of the file was reached Return value 0 indicates that the end of the file is not reached FOPEN FIELD FCLOSE FPUT FGET cont field 5 global no global mojilS moji2s end field global sum fopen C TEST 2 5 end conf evnt while EOF 5 0 fget 5 i numdsp NUM000 no S S wend fclose end evnt trdsp STROOO mojil trdsp STROO1 moji2 5 4 74 CHAPTER 4 INSTRUCTION REFERENCE ERRCTL PT ERRCTL Statement E Function The ERRCTL statement controls the error number display position E Format ERRCTL mode m Example of Use ERRCTL 0 E Description e The ERRCTL statement controls the error number display position e The error display position conforms with the value specified in mode When mode is 0 An error number is displayed below a screen When mode is 1 A message is issued to the error display When mode is 1 messages of error numbers 4000 to 4499 and 5000 to 5999 are issued to the error display part ERRPTS on global screen Messages of error numbers 2000 to 2999 ar
211. d and the entire range display status is set e Line charts for which Blink or On and Off is specified are displayed within the entire range e When different ranges are set for two or more line charts within 100 milliseconds the last set range corresponds to the first line chart to be displayed All other line charts are displayed LNEDSP LNESHIFT PRDSP type id data SETLN EP LOT 2 07 30 lneshift lnegraph 1 1 40 end evnt 4 222 CHAPTER4 INSTRUCTION REFERENCE SETSIO eg SETSIO Statement E Function The SETSIO statement sets a non protocol communication reception method E Format SETSIO port number value m Example of Use SETSIO 2 amp HD E Description e The SETSIO statement sets the condition for issuing messages to BASIC of the part screen when data is received in the non procedual communication mode e port number specifies the port for which the non procedual communication mode is to be set e When the port specified in port number is in the binary mode value specifies the number of data to be received in bytes 0 cannot be specified When the port is in the text mode value specifies a terminator code 1 to OFFh of the received data e For the binary mode specify the number of bytes to be received from the connecting device When the specified number of bytes are received a message is transmitted to the part screen e For the text mode when a terminator code
212. d by the CLOSECOM statement to receive data again e logical device name specifies any of the following external connecting devices HST Host computer BCR Bar code reader TKY Ten key pad E Related Item OPENCOM CLOSECOM E Example of Program conf OPENCOM HST end conf evnt input type id data if type 3 and data 1 then CLOSECOM HST else if type 3 and data 0 then REOPENCOM HST endif end evnt 4 207 REOPENPARALLEL 8 REOPENPARALLEL Statement E Function E Format m Example of Use E Description E Related Item E Example of Program conf The REOPENPARALLEL statement permits data re reception from the temporarily closed parallel port REOPENPARALLEL input bit REOPENPARALLEL 3 e The REOPENPARALLEL statement permits the script whose data reception from the parallel port was temporarily inhibited by the CLOSEPARALLEL statement to re receive data e input bit is the bit for restarting data reception This input bit is the same as the bit specified by the CLOSEPARALLEL statement OPENPARALLEL CLOSEPARALLEL OPENPARALLEL 3 end conf evnt input type id data if type 3 and data S 1 then CLOS EPARALLEL 3 else if type 3 and data 0 then REOP ENPARALLEL 3 endif end evnt 4 208 CHAPTER4 INSTRUCTION REFERENCE RESETALARM eg RESETALARM Statement E Function The RESETALARM statement resets t
213. d eit iret 4 5 iij How This Manual Is Organized How This Manual Is Organized This manual Chapter 1 through 4 includes structures of data to be displayed on the OIP and operations in detail for you to use the OIP Chapter 1 Fundamentals in Creating Screens Outlines general ideas and organizations of data to be displayed on the OIP You should read through this chapter before referencing the other chapters Chapter 2 Installation for Screen Creator 5 Covers the environment in operation and installation of Screen Creator 5 Chapter 3 Basic Operations for Screen Creator 5 Describes each function name of Screen Creator 5 and operations for the keyboard and mouse Chapter 4 Menu Reference Thoroughly discusses each menu of Screen Creator 5 You are recommended to reference the following manuals for using Screen Creator 5 Vol 1 Screen Creator 5 Manual Introduction Introduces fundamental operations of Screen Creator 5 Vol 2 Screen Creator 5 Manual Operations Describes operations of Screen Creator 5 in details Vol 3 Screen Creator 5 Manual PLC External Equipment Connection Covers the communications procedures with a host computer and connections to peripheral devices Vol 4 Screen Creator 5 Manual Standard Component Catalog You can get to know the standard components and their functions the maker offers Vol 5 Screen Creator 5 Manual Control Reference Describes what are controls and how to use controls for creating components
214. d evnt 4 28 CHAPTER4 INSTRUCTION REFERENCE BLSTAT PT BLSTAT Function E Function The BLSTAT function reads the back light status E Format BLSTAT 0 m Example of Use E Description The BLSTAT function reads the current back light status ON OFF The return values of this function are as follows 0 The back light is off 1 The back light is on Related Item BLCTL m Example of Program conf ret BLSTAT if ret 0 then blctl 1 end conf 4 29 BLTCOLOR fe BLTCOLOR Statement E Function E Format m Example of Use E Description E Related Item E Example of Program evnt end evnt The BLTCOLOR statement changes the tile and color of a belt graph display BLTCOLOR control name zone position tile display color background color BLTCOLOR BLT000 2 1 2 3 e The BLTCOLOR statement changes the tile and color of the specified zone of a belt graph display 1 indicates that the color and tile for which 1 was specified remain unchanged e control name is the bar graph name or the D type variable indicating the bar graph e The value indicating the zone number to be changed is set in zone position The zone position can be specified with a constant or variable The zone position starts at 1 e tile indicates the tiling figure of the zone Specify this tiling figure with a numeric value from 0 to 15 e display color is a numeric value indicating the color number of the tile
215. d number is 1 when data is written to the beginning of the file E Related Item FOPEN FIELD FCLOSE FGET E Example of Program cont field 5 global no global mojilS moji2s end field fopen MEMORY 2 5 end conf evnt no 1 mojilS product name moji2S product number FPUT 5 3 fclose 5 end evnt 4 95 FRECOLOR ie FRECOLOR Statement E Function The FRECOLOR statement changes the tiles and colors of the free graph display E Format FRECOLOR cotrol name tile 1 display color 1 background color 1 tile 2 display color 2 background color 2 m Example of Use FRECOLOR FREO000 2 1 4 5 2 1 E Description e The FRECOLOR statement changes the tiles and colors of the free graph display and the background tiles and colors of the entire display tile 1 indicates that the color and tile for which 1 was specified remain unchanged control name is the free graph name or the ID type indicating the free graph name e tile 1 indicates the tiling figure of the tile display section Specify this tiling figure with a numeric value from 0 to 15 e display color 1 is a numeric value indicating the color number of the tile display section Specify this color number with a numeric value from 0 to 15 e background color 1 is a numeric value indicating the color number of the tile background section Specify this color number with a numeric value from 0 to
216. d points of displaying a line chart PD PLOTRNG is applicable to line charts Specify one of the following 0 Indicates reading of the display start point 1 Indicates reading of the display end point e The types and usage of the request codes that can be used by PRSTAT3 are explained below 1 _PD_RANGE Function Range Type Return value 2 _PD_BSVAL Function Range Type Return value _PD_RANGE reads the display range of a control _PD_RANGE is applicable to bar graph line chart free graph slide meter and plot displays When reading Xmin specify 0 When reading Xmax specify 1 When reading Ymin specify 2 When reading Ymax specify 3 A value indicating the display range is returned _PD_BSVAL reads the setting value of a base or reference line _PD_BSVAL is applicable to bar graph and line chart displays When changing a base line specify 0 When changing reference line 1 specify 1 When changing reference line 2 specify 2 A value indicating the display range is returned e The types and usage of the request codes that can be used by PRMSTAT4 are explained below 1 _PD_PTRN Function Range Type 1 Type 2 Return value _PD_PTRN reads the display color of a control _PD_PTRN is applicable to bar graph 100 percent bar chart and pie chart displays Specify the number of the bar or zone whose display color is to be changed Specify one of the following 0 Figure read 1 Fore color re
217. d to an integer This value overwrites the specified character string variable name e The value is converted into a 86 series boundary and saved E Related Item MKS MKB MKW MKF MKID CVB CVW CVI CVF CVID m Example of Program conf end conf evnt orgS 1234567 strdsp STROOO org MKI org 2 amp H39404142 strdsp STROO1 org end evnt 4 155 MKID 8 MKID Statement E Function The MKID statement stores data in any position of a character string variable E Format MKID character string variable name storage position ID value E Example of Use MKID MOJI 5 VAR E Description E Related Item m Example of Program conf end conf evnt The MKID statement stores six bytes of ID value in the position specified by storage position starting from the beginning of the specified character string variable name storage position must be a integer or floating point type variable or constant 1 specifies the beginning of the character string variable ID value specifies an overwriting value it must be an D type variable or constant If an integer or constant of non ID type is specified an error occurs This value overwrites the specified character string variable name The value is converted into a 86 series boundary by 2 bytes and then saved MKS MKB MKW MKI MKF CVB CVW CVI CVF CVID input types id data org 1234567 strdsp MKF org strdsp end evn
218. de return value 1 PRMSTAT 2 control name request code type 1 return value 2 PRMSTAT3 control name request code type 1 return value 1 PRMSTAT4 control name request code type 1 type 2 VAL PRMSTAT1 NUMO000 _PD_STAT VAL PRMSTAT2 NUMO000 _PD_DCOLOR 3 VALF PRMSTATS3 LNE000 _PD_RANGE 0 VAL PRMSTAT4 BAR000 _PD_PTRN 1 0 e The PRMSTAT function reads the attributes of the specified primitive This function is classified into four types PPRMSTAT1 PRMSTAT2 PRMSTATS3 and PRMSTAT4 control name is the constant indicating the primitive to be read or the D type variable indicating the ID of the control e request code specifies the attributes to be read The types of request codes are shown on the next and subsequent pages e type 1 and type 2 depend on the request code to be specified e return value 1 is the return value of the function corresponding to the specified request code it must be an integer type constant or variable e return value 2 is the return value of the function corresponding to the specified request code it must be a floating point constant or variable PRMCTL1 PRMCTL2 PRMCTL3 PRMCTL4 PRMSTAT1 PRMSTAT2 PRMSTAT3 PRMSTAT4 conf end conf evnt status prmstatl NUMO00 _PD_STAT if status 0 then PRMCTL1 NUMO00 _PD_STAT 2 endif end evnt 4 193 PRMSTAT es e The types and usage of the request codes that can be used by PRMSTAT1 are expl
219. display for which operation parameters are set to effective in the control PLTCOLOR E Example of Program conr static name name PLTOOO end conf evnt input types id x y if types 3 then PLTDSP name x y endif end evnt 4 181 PMODE es PMODE Statement E Function E Format E Example of Use E Description E Related Item E Example of Program evnt The PMODE statement changes the status of the specified part PMODE part name mode PMODE BUHIN 3 e part name is the name of the part whose status is to be modified or the D type variable indicating the part e mode indicates the status to be modified 0 Normal status 1 Switch input disable status 2 Half tone status PSTAT input types id data if pstat BUHIN 0 then PMODE BUHIN 1 endif end evnt 4 182 CHAPTER4 INSTRUCTION REFERENCE PRDSP eg PRDSP Statement E Function The PRDSP statement redisplays the specified control E Format PRDSP control name E Example of Use PRDSP BUHIN PRIM E Description e control name is the name of the control to be redisplayed or the ID type variable indicating the control E Related Item BARSET CIRSET BLTSET LNESET E Example of Program evnt lneset buhin graph 3 8 20 1 lneset buhin graph 3 8 20 1 PRDSP buhin graph end evnt 4 183 PREVJUMP ee PREVJUMP Statement E Function The PREVJUM
220. e 2 3 1 4 5 2 E endif end evnt 4 137 LNEDSP ie LNEDSP Statement E Function E Format m Example of Use E Description E Related Item m Example of Program COnE name end evnt con The LNEDSP statement displays data in the line chart display LNEDSP control name line number point number display data LNEDSP BUHIN GRAPH 2 2 30 0 e The LNEDSP statement displays line data in the line chart display e control name is the name of a line chart or the ID type variable indicating the chart e line number is the value indicating the line number in the line chart to be displayed The line number starts at 1 e point number specifies the data point to be changed in the line chart it is the integer type value starting at 1 The maximum point value depends on what line chart is placed e display value is the numeric data indicating the size of the specified line chart point e display value cannot be changed even if this statement is issued to the display for which operation parameters are set to effective in the control LNECOLOR LNESHIFT static name LNE000 input type id data lnedsp name 2 2 data end evn 4 138 CHAPTER4 INSTRUCTION REFERENCE LNESET pe LNESET Statement E Function The LNESET statement sets data in the line chart display E Format LNESET control name line number point number display data m Example of Use LNES
221. e 1 3 _PD_STAT Function Range Return value 4 _PD_DSPFMT Function Range Return value 1 5 _PD_DATFMT Function Range Return value _PD_NUMS reads the number of control elements _PD_NUMS is applicable to all display controls The value indicating the display format is set When the display format is not continuous stage type 1 is always set _PD_ROTATEE reads the rotation direction of a control _PD_ROTATE is applicable to all display controls For O degree 0 is returned For 90 degrees 1 is returned For 180 degrees 2 is returned For 270 degrees 3 is returned For pie chart meter lamp and pipe displays 0 is always returned _PD_STAT reads the display format normal reverse video display blinking on and off display of a control _PD_STAT is applicable to all controls One of the following values is returned 0 Normal display 1 Reverse video display 2 Blinking 3 On and off display _PD_DSPFMT reads the display format of a control _PD_DSPFMT is applicable to numeric and character controls The value to be returned depends on whether the numeric or character display is used _PD_DATFMT reads the display data format _PD_DATFMT is applicable to all controls except for clock displays For a real number 0 is returned For an integer 1 is returned For an unsigned integer 2 is returned For a BCD 3 is returned For the lamp primitive 2 is always returned 4 194 CHAPTER4 INSTRUCT
222. e change 1 change of reference line 1 or 2 change of reference line 2 Control value Set the value to be changed e The types and usage of the request codes that can be used by PRMCTL4 are explained below 1 _PD_PTRN Function _PD_PTRN changes the display color of a control Range _PD_PTRN is applicable to bar graph 100 percent bar chart and pie chart displays Type 1 Specify the number of the bar or zone whose display color is to be changed Type 2 Specify one of the following 0 Figure change 1 Fore color change 2 Back color change Control value Set the number of the display color to be changed with a numeric value from 0 to 15 2 _PD_LNE Function _PD_LNE changes the display color of a line chart Range _PD_LNE is applicable only to line charts Type 1 Specify the number of the line whose display color is to be changed Type 2 Specify one of the following 0 Line type change 1 Line color change Control value Set the number of the display color to be changed with a numeric value from 0 to 15 4 192 CHAPTER4 INSTRUCTION REFERENCE PRMSTAT be PRMSTAT Function E Function E Format E Example of Use E Description E Related Item m Example of Program The PRMSTAT function reads the attributes of the specified primitive return value 1 PRMSTAT1 control name request code return value 1 PRMSTAT 2 control name request code type 1 return value 2 PRMSTAT3 control name r
223. e color read 2 Back color read 3 Display color read The number 0 to 15 of the read display color is returned _PD_BCOLOR reads the background color of a control _PD_BCOLOR is applicable to numeric character clock plot bar graph line chart and free graph displays Specify one of the following 0 Figure read 1 Fore color read 2 Back color read The number 0 to 15 of the read background color is returned 4 199 PRMSTAT es 3 _PD_PIPCOLOR Function Range Type Return value 4 _PD_BSLNE Function Range Type Return value 5 _PD_BSCOLOR Function Range Type Return value 6 _SW_ONFIG Function Range Type Return value 7 _SW_OFFFIG Function Range Type Return value _PD_PIPCOLOR reads the internal color of a pipe or lamp display _PD_PIPCOLOR is applicable to pipe and lamp displays Specify one of the following 0 Read of OFF display color valid for pipe and lamp displays 1 Read of ON1 display color valid for pipe and lamp displays 2 Read of ON2 display color valid for pipe displays The number 0 to 15 of the read internal color is returned _PD_BSLNE reads the type of a base line or a reference line _PD_BSLNE is applicable to bar graphs and line charts Specify one of the following 0 Read of base line type 1 Read of reference line 1 type 2 Read of reference line 2 type The number 0 to 3 of the read line type is returned _PD_BSCOLOR reads the co
224. e issued only to the error display Following the type and issuer ID of an error the error code the number of the screen where the error occurred and the number of the part where the error occurred are issued to the error display If a screen program error occurs 1 is set as the part number If part ERRPTS does not exist in the global screen the error is displayed in the lowest line of the window screen E Related Item ERRSTAT E Example of Program evnt input ty id dat if id swl then if errstat 1 then errctl 0 else errcel I endif endif end evnt 4 75 ERRSTAT 8 ERRSTAT Function E Function The ERRSTAT function reads the error display position E Format ERRSTAT m Example of Use ERRSTATQ E Description e The ERRSTAT function reads the current error display position e When this function is executed any of the following numeric values indicating the display position is returned When 0 is returned the error is displayed below the screen When 1 is returned the error is displayed in the error display E Related Item ERRCTL E Example of Program evnt input ty id dat if id swl then if errstat 1 then errctl 0 else errcetl 1 endif endif end evnt 4 76 CHAPTER4 INSTRUCTION REFERENCE EVENTWR eg EVENTWR Statement E Function The EVENTWR statement declares the device s to which data is to be written E Format EVENTWR device name
225. e number specifies the file number defined in the FIELD declaration e When the contents of the variable group or character string variable are copied the size is used whichever is smaller E Related Item FOPEN FIELD FCLOSE FPUT FGET EOF SOF E Example of Program cont field 5 global no global mojilS moji2s end field global buff 50 opensio 1 0 buffs fopen MEMORY 2 5 end conf evnt nos 1 mojilS product name moji2S product number size sof 5 MCPY 5 buff writesiob 1 size buff end evnt 4 147 MEDIACHK ee MEDIACHK Function E Function E Format m Example of Use E Description The MEDIACHK function checks whether a medium exists in the drive and returns the check result MEDIACHK drive name STATUS MEDIACHK E e The return value is as shown below 0 No medium 1 Medium exists E Related Item MEDIASIZE E Example of Program cont global dname 13 global dsel strdsp str mediachk end conf evnt input types id data if data 1 then strdsp dsp str dname dsel num mediachk dnameS dsel if num 1 then strdsp str valid else strdsp str invalid end if end if end evnt 4 148 CHAPTER4 INSTRUCTION REFERENCE MEDIASIZE eg N MEDIASIZE Function E Function E Format m Example of Use E Description E R
226. e objects in descending order of their numbers If there is no object that is number specified by option away from the specified registration name the RSTAT function returns 1 GETGID GETGNO cont end conf evnt id getgid no RSTAT id 0 1 Checks the next registered screen if no lt gt 1 then jump no number end evnt 4 214 CHAPTER4 INSTRUCTION REFERENCE RUN eg arr RUN Statement E Function The RUN statement runs the specified program E Format RUN execution part screen m Example of Use RUN BUHIN E Description e The RUN statement issues a message to the part screen specified in execution part screen and runs the part screen program The message to be issued contains the message type and ID It however does not contain the issued data e The program to which a command was issued is not run when the RUN command is issued it is run when the program that issued the RUN command terminates e execution part screen is a screen name a part name or an D type variable E Related Item INPUT PRINT SEND E Example of Program evnt input ty id fig if ty 3 and id SWT000 then RUN BOOO endif end evnt 4 215 SELECT CASE END SELECT SELECT CASE END SELECT Statement E Function The statements satisfying the specified condition are executed E Format SELECT CASE CASE statement list CASE statement list CASE ELSE statement list END SELECT E Ex
227. e of Program declare my_add a b wat conr global x y local sum sums my_add x y end conf FUNCTION my_add a b my_add a tb END FUNCTION 4 102 CHAPTER4 INSTRUCTION REFERENCE F WRITE ee FWRITE Statement E Function The FWRITE statement writes data to the specified file E Format FWRITE file number expression expression m Example of Use FWRITE 12 100 ABCD VAR STRING E Description e The FWRITE statement writes the numeric value or character defined in expression to the file specified by file number e A numeric value a character or a numeric or character variable can be specified in expression e When writing two or more expressions to the file delimit them with a comma Add the code indicating carriage return CR or line feed LF to the end of expression description e A numeric expression is converted to a numeric string and written to the specified file When the numeric string is negative a minus sign is inserted before it e When writing a character string enclose it in double quotation marks e file number must match the number of the file opened by the FOPEN statement E Related Item FOPEN FCLOSE FPUT FPRINT E Example of Program cont fopen C TEST 2 5 end conf evnt vars 2 fwrite 5 123 var ABCD XYZ end evnt Data is written to the specified file as follows 123 2
228. e or the D type variable indicating the plot display e plot color indicates the display color of a dot Specify this plot color with a numeric value from 0 to 15 e tile indicates the background tiling figure of the graph e Specify this tiling figure with a numeric value from 0 to 15 e display color is the numeric value indicating the color number of the tile display section Specify this color number with a numeric value from 0 to 15 e background color is the numeric value indicating the color number of the tile background section Specify this color number with a numeric value from 0 to 15 E Related Item PLTDSP E Example of Program conf static name name PLTOOO end conf evnt input types id data if types 3 then PLTCOLOR name 2 3 1 4 endif end evnt 4 180 CHAPTER4 INSTRUCTION REFERENCE PLTDSP pe PLTDSP Statement E Function E Format E Example of Use E Description E Related Item The PLTDSP statement displays data in the plot display PLTDSP control name display coordinate X display coordinate Y PLTDSP BUHIN GRAPH 15 30 e The PLTDSP statement displays data in the plot display e display name is the plot display name or the D type variable indicating the plot display e display coordinate X and display coordinate Y are the numeric data indicating the coordinates to be displayed in the plot display e display value cannot be changed even if this statement is issued to the
229. e sender that transmitted data is set in the first variable name The value indicating the ID of the sender is set in the second variable name which is followed by data Screen Optional Item written in the PRINT statement Item written in the PRINT statement Switch single 1 1 when ON 0 when OFF Switch multi Switch number 1 when ON 0 when OFF Selector switch __ Number of activated switch _ eara o or OFF 0 status eo nasi status Parallel port BIT number BIT value or channel number satisfying the condition Non procedual The port number status and number of received bytes are set in this order Sampling 9 Conwol __ Sampled data_ _ M device value reader _ Magneticcard 19 o i y Ten keypad_ 20 Code of pressed key Memory cara 21 J o o E Host 22 Optional data to be determined by the user 4 119 INPUT 4 120 CHAPTER4 INSTRUCTION REFERENCE INPUT be bytes written to the reception buffer For the text mode a terminator code is also read When the status is 1 or 1 the number of received data is read The numbers of multi switches and selector switches are counted as 1 2 3 and so forth from the upper left switch When all switches are counted in the X direction the switches on the lower Y line are counted in the same way They are integers E Related Item PRINT CYCLIC OPENPARALLEL OPENCOM OPENSIO E Example of Program c
230. e status is transmitted to the part program on which the switch is placed e switch name is the name assigned to the switch or the D type variable indicating the name For multi switches it is necessary to set switch numbers in the offset and to get switch IDs using the GETID command e status indicates that the normal switches are in any of the following statuses 0 OFF status 1 ON status e status indicates that the selector switches are in any of the following statuses 0 All selector switches are OFF Other values Numbers of the sub switches that are ON The sub switch number in the upper left end is 1 The sub switch numbers increase in the right direction They decrease in the downward direction The numbers of multi switches and selector switches are counted as 1 2 3 and so forth from the upper left switch When all switches are counted in the X direction the switches on the lower Y line are counted in the same way They are integers e When this statement is executed a message is issued as a switch is pressed e Executing the SWWRITE statement for the switch where synchronous operation is valid causes an error e The SWWRITE statement is invalid for the switch of the momentary type E Related Item GETID SWREAD 4 244 CHAPTER4 INSTRUCTION REFERENCE m Example of Program evnt input type id data id SW2 state swread ID if state 0 then SWWRITE id 1 endif end evnt 4 2
231. e used must be returned to the system If allocating more than 16 timers is attempted an error occurs e timer number indicates the number of the timer to be stopped and returned to the system Whether the timer number is an ID or integer type value depends on how the timer is opened See OPENTIM OPENTIM2 and OPENTIM3 OPENTIM OPENTIM2 OPENTIM3 STARTTIM STOPTIM CONTTIM SETTIM READTIM timid opentim 20 O starttim timid end conf evnt input type lse i if type id 3 and id data SWT000 then stoptim timid f id SWTOO1 then closetim timid end if end evnt 4 47 COLOR 8 COLOR Statement E Function The COLOR statement sets the color type and size of a straight line or a dot E Format COLOR display color line type line thickness or dot size m Example of Use COLOR 1 0 2 E Description e The COLOR statement sets the colors types and sizes of a straight line and a dot The values specified in the LINE and DOT statements have priority over those to be specified in this statement e display color indicates the display color of the straight line or dot Specify this display color with a numeric value from 0 to 15 The specified display color becomes the color pallet number of the tool e line type indicates the type of line to be drawn for example solid line and dotted line Specify this line type with a numeric value fro
232. eceives data from the specified external connecting device When the host computer transmits data this statement need not be declared e logical device name specifies any of the following external connecting devices HST Host computer BCR Bar code reader TKY Ten key pad CLOSE COM REOPENCOM OPENCOM HST end conf evnt input types id data if type 3 and data 1 then CLOS ECOM HST else if type 3 and data 0 then REOP ENCOM HST endif end evnt 4 168 CHAPTER 4 INSTRUCTION REFERENCE OPENPARALLEL eg OPENPARALLEL Statement E Function E Format m Example of Use E Description E Related Item E Example of Progra coni OPEN end conf evnt The OPENPARALLEL statement declares that the program receives data from a parallel port OPENPARALLEL input bit mode OPENPARALLEL 3 1 The OPENPARALLEL statement declares that the program receives data when the bit for specifying a parallel input port changes input bit indicates the bit used to transmit data when the value changes Specify this input bit with a numeric value from 0 to 15 mode specifies the time when data is transmitted The time when data is transmitted depends on how the bit changes 1 Data is transmitted when the bit goes High 2 Data is transmitted when the bit goes Low 3 Data is transmitted when the bit goes High or Low CLOSEPARALLEL REOPENPARALLEL m PARALLI in
233. ecuted the values of the points purged from the line chart are returned as a result of the shifting control name is the line chart name or the ID type variable indicating the line chart line number is the value indicating which line in the line chart display is to be shifted This line number starts at 1 When shift direction is 1 line chart data is shifted left and above When shift direction is 1 line chart data is shifted right and below display data indicates the data to be displayed in the vacant area produced as a result of the shifting LNEDSP LNECOLOR LNESHIFT2 input types id data if data gt 0 then Ineshift LNEOOO 1 1 QO abc else abc endif end evnt lneshift LNEOQOO 1 1 100 4 140 CHAPTER4 INSTRUCTION REFERENCE LNESHIFT2 eg LNESHIFT2 Statement E Function The LNESHIFT2 statement shifts the display data of a line chart left or right E Format LNESHIFT2 control name line number shift direction display data m Example of Use A LNESHIFT2 LNE000 1 1 30 E Description Different from the LNESHIFT statement the LNESHIFT2 statement shifts line chart data but does not display it To display line chart data execute the PRDSP statement e The LINESHIFT2 statement is a function that shifts each of the points constituting the line chart in the line chart display left or right by one point e When this statement is executed the values of the
234. eeeeee 4 251 4 4 CHAPTER4 INSTRUCTION REFERENCE 4 2 Indexes by Functions i 4 2 Indexes by Functions Control structure Arithmetic operation Variable declaration MID Function MID Statement 4 2 Indexes by Functions ees Type conversion BCD2BIN BIN2BCD GETGID GETGNO Numeric displays NUMCOLOR NUMDSP STRCOLOR STRDSP 4 6 CHAPTER4 INSTRUCTION REFERENCE Graphic displays FIGCOLOR FIGDSP FIGFORM ROTATE BARCOLOR BARDSP BARSET BARSHIFT Line chart displays LNECOLOR LNEDSP LNESET LNESHIFT LNESHIFT2 BLTCOLOR BLTDSP Pie chart displays CIRCOLOR CIRDSP CIRSET 4 2 Indexes by Functions pe ee Free graph displays MTRCOLOR MTRDSP LAMPCOLOR LAMPDSP PIPCOLOR PIPDSP 1 Serial control CLOSEC OM acrescer esinin inea 4 44 CLOSES On erna oe hooi i adie 4 46 FLUSH osedise canine tans einan 4 90 OPENCOM a usleiden tiaras 4 167 OPENSIO siiin aisha sie aba edt 4 169 REOPENCOM bisetescctsscoaietiateiectssadecatbedescies 4 206 SEVSIO ertora ien et ti 4 222 WRITES O g 03 008 Cases estes ieee 4 251 OUTBIT OUTBITSTAT OUTSTAT REOPENPARALLEL CHE TIM siieteieia cnn ictesn ied cians 4 36 CEOSE TIM sasevsiscrcotieecacabsiecctesttetee tht siestiys 4 47 CONTTIM ane e eraan a 4 51 OPENTIM senshi ence neieee 4 170 OPENTIM2 oiei contests aes 4 171 OPEN TIM 3 nosan cede 4 172 READ TIM citscepiedesoctesseatett ite esti alat
235. eeeena 2 42 CHAPTER 3 CODING RULEG ccceteeseseeseeeeeeeeeeees OTT S21 Usable characters isodon ea devices ate ole as aren ae te eed ae ohare ate 3 2 3 27 Special Characters netoa ea ee SE Be ae 3 3 B23 GOMSTANIS a a a aaa eles a aai 3 4 3 4 Constant Declarationis cc cin ines einai ei eee ieee E ed a ead 3 5 3 5 Variables perte tar eae ta n ee an weaned en ed nee eats eaters emcee ee 3 6 3 5 1 Classification of vara De Sie nae a a a A aa aa aE a A ar ae ao aia a eiae 3 6 3 5 2 Types of Variable Sinin aea e ee ee ein eis ee 3 7 3 5 3 Checking variable types and variable interpretation in compilation sseesseeseeeeeeeeeeeeeeeeeeee 3 8 SoM _ Initializing Variables a a tn i ae ates 3 9 3 6 Expressions and Operations iicai2 anes dain seine eet are iain ee cdedn eesldienee 3 10 37 TYPE CONVESSO sp eeraa ess ita a eee ces daaa aa case esas coed eter ede ed 3 13 3 87 Labels nengen a r ed GE ee ee ee 3 14 3 9 SUDPOUTINGS aaae Nori o e aa N i a 3 15 3 10 User defined FUNCtIONS s orrea ii e e E E EEE E a N Ea aE 3 16 3 10 1 Definition of user defined functions 00 0 eee ee eeeeeeeeeneeeeeeeaeeeteeaeeeeteneeeeeeeaeeesesaaeeesenaeeeeneeeeenaees 3 16 3 10 2 Definition positions of user defined functions and ranges of referencCing cceeseeeeeeneeeeeees 3 17 3 10 3 How to call user defined FUNCTIONS 0 eee eeeeeeeeseeeeteneeeeeeeaeeeeesaeeeeseaeeeeeeeaeeesesaaeeesenaeeeeneaterenaees 3 17 3 10 4 V
236. effective and the PLC device must be set in the associated operation parameter in advance control name must be the primitive in the local part e If the specified primitive is not using the PLC device memory table an error occurs ADDCYC ADDCYC2 conf addcyc NUMOOO0 end conf evnt input type id data id1l ADDCYCID NUMOOO i getoffset id1l id 1 device idl getid NUM000 i numdsp idl data end evnt gt Uses 2X2 as a consecutive stage display Displays data on the corresponding display Indicates the ID of the device being used Indicates the device to be used relative to the first Obtains the ID of the corresponding display gt Displays the ID on the display 4 13 ASC a l ASC Function E Function The ASC function specifies the first 1 byte character code of a character string E Format ASC character string m Example of Use AA ASC AABCD AA ASC MOJI E Description e The ASC function specifies the first character code of the character expression character string constant or variable enclosed in parentheses with a decimal number e The ASC function specifies only the initial 1 byte code of a character expression which begins with a Kanji character E Related Item CHR m Example of Program evnt input type id datas num ASC data numdsp NUM000 num end evnt 4 14 CHAPTER4 INSTRUCTION REFERENCE ATN
237. eiaai A 4 248 WAU IV AUD uihna binuang 4 249 WHILE WEND osiin 4 250 WRITESIO WRITESIOB sccsssseesssseeeeee 4 251 4 4 CHAPTER4 INSTRUCTION REFERENCE 4 2 Indexes by Functions i 4 2 Indexes by Functions Control structure Arithmetic operation Variable declaration MID Function MID Statement 4 2 Indexes by Functions ees Type conversion BCD2BIN BIN2BCD GETGID GETGNO Numeric displays NUMCOLOR NUMDSP STRCOLOR STRDSP 4 6 CHAPTER4 INSTRUCTION REFERENCE Graphic displays FIGCOLOR FIGDSP FIGFORM ROTATE BARCOLOR BARDSP BARSET BARSHIFT Line chart displays LNECOLOR LNEDSP LNESET LNESHIFT LNESHIFT2 BLTCOLOR BLTDSP Pie chart displays CIRCOLOR CIRDSP CIRSET 4 2 Indexes by Functions pe ee Free graph displays MTRCOLOR MTRDSP LAMPCOLOR LAMPDSP PIPCOLOR PIPDSP 1 Serial control CLOSEC OM acrescer esinin inea 4 44 CLOSES On erna oe hooi i adie 4 46 FLUSH osedise canine tans einan 4 90 OPENCOM a usleiden tiaras 4 167 OPENSIO siiin aisha sie aba edt 4 169 REOPENCOM bisetescctsscoaietiateiectssadecatbedescies 4 206 SEVSIO ertora ien et ti 4 222 WRITES O g 03 008 Cases estes ieee 4 251 OUTBIT OUTBITSTAT OUTSTAT REOPENPARALLEL CHE TIM siieteieia cnn ictesn ied cians 4 36 CEOSE TIM sasevsiscrcotieecacabsiecctesttetee tht siestiys 4 47 CONTTIM ane e eraan a 4 51 OPENTIM senshi ence neieee 4 17
238. elated Item The MEDIASIZE function checks the size of a medium in the drive and returns the number of bytes MEDIASIZE drive name calculation method SIZE MEDIASIZE E 0 e The calculation method is as shown below 0 Full space 1 Free space When the full space is specified the medium size is calculated from the number of all clusters When the free space is specified free clusters are checked and the medium size is calculated from the total number of free clusters MEDIACHK E Example of Program cont global dname 13 global dsel static mode mode 0 strdsp str mediasize numdsp num001 mode end conf evnt input type id data if data 1 then if mode 1 then mode 0 else mode 1 end if numdsp num001 mode strdsp dsp str dnameS dsel num mediasize dnameS dsel mode numdsp num000 num end if end evnt 4 149 MID ee MID Statement E Function E Format m Example of Use E Description E Related Item m Example of Program Pes conr mo jis end conf evnt end evnt pee is The MID statement replaces part of a character string with another character string MID character string variable start position number of characters replacing character string MID x 1 1 A The MID statement replaces the character string specified in character string variable with the character s
239. elligent Panel PLC Stands for programmable controller It is also called a sequence controller Link unit A link unit is a communication equipment which connects this equipment and the PLC The nomenclature of the communication equipment is different from each manufacture and the equipment is called a link unit in general Device A device is such equipment that an input output relay internal relay timer counter or resister in the PLC vi Notice Notice We have used our best efforts in preparing this manual We make no warranties with respect to the accuracy or completeness of the contents of this manual and purpose We shall not be liable any loss of profit or any other commercial damages applying this manual directly and indirectly 1 2 3 4 5 6 All rights reserved No part of this book may be reproduced in any form or by any means without permission n in writing from Koyo Ltd Contents of this manual shall be subject to change without notice While every precaution has been taken in the preparation of this manual if the reader notice any errors or has any advice on the contents of this manual please contact our customer support in Sales Division of koyo Ltd We shall have no liability to any loss or damage caused or alleged to be caused directly or indirectly by the statements contained in this manual or by the computer software and hardware products described in it Koyo Ltd may have patens or pe
240. em GETDATE GETTIME SETDATE SETTIME TIMES E Example of Program cont moji DATES strdsp STROOO moji end conf 4 63 DECLARE fee DECLARE Statement E Function The DECLARE statement declares a function E Format DECLARE function name type declaration character variable declaration variable declaration m Example of Use DECLARE ADD A B E Description e The DECLARE statement declares a type of a function used in a program Such declaration is called prototype declaration e A function itself is declared in one of the three manners as shown below Local function Defined in a program other than a global screen program Global function Defined in a global screen program Library function Defined in a library e The declared type of a function in the prototype declaration must be the same as the type of the function itself e This is one of the new features of Screen Creator 5 E Related Item FUNCTION FUNCTIONCHECK E Example of Program DECLARE my_add a b conf global x y local sum sums my_add x y end conf 4 64 CHAPTER4 INSTRUCTION REFERENCE DEVRD eg DEVRD Statement E Function The DEVRD statement reads the contents of the specified device E Format DEVRD device name offset value variable name m Example of Use DEVRD 00 D10 10 VALUE E Description e The DEVRD statement reads data from the device that is offset value away from the
241. ement declares a constant E Format CONST constant name constant m Example of Use CONST MAX 10 E Description e The constant name should be enclosed in a pair of marks according to the variable name generation rule e If a constant is declared in a program the constant name is replaced with a declared constant value e The CONST statement cannot be used in a global screen program e Constant declaration is one of the new features of Screen Creator 5 E Related Item E Example of Program conf global L const MAXLENGTH 100 if L gt MAXLENGTH then L MAXLENGTH end if end conf 4 50 CHAPTER 4 INSTRUCTION REFERENCE CONTTIM ee CONTTIM Statement E Function The CONTTIM statement restarts the stopped timer E Format CONTTIM timer number m Example of Use CONTTIM TIMID CONTIM 4 E Description The CONTTIM statement restarts the timer stopped by the STOPTIM instruction The internal counter in the timer is continued from the timer stop status e timer number indicates the number of the timer to be restarted Whether the timer number is an ID or integer type value depends on how the timer is opened See OPENTIM OPENTIM2 and OPENTIM3 E Related Item OPENTIM OPENTIM2 OPENTIM3 STARTTIM STOPTIM CLOSETIM SETTIM READTIM E Example of Program conf static timid opentim2 3 settim 3 20 0 starttim 3 end conf evnt input type id data if type 3
242. en le end conf The LEN function returns the length of the specified character string in a number of bytes LEN character string LEN registered character string number LEN registered character string name A LEN B A LEN MOJI The LEN function returns the length of the character string specified by character string registered character string number or registered character string name in a number of bytes character string is a direct character string or a character string variable registered character string number is the numerical expression indicating the number registered by GCSGP3 registered character string name is the name of the character string created by GCSGP3 or the ID type variable indicating the name of the character string None bS abcdefg toroku 4 134 CHAPTER 4 INSTRUCTION REFERENCE LINE eoe A LINE Statement E Function The LINE statement draws a straight line on a screen E Format LINE X1 Y1 X2 Y2 m Example of Use LINE 20 30 100 200 E Description The LINE statement draws a straight line between the specified two coordinates X1 Y1 and X2 Y2 e X1 and X2 must be a numeric value from 0 to 639 Y1 and Y2 must be a numeric value from 0 to 399 GC55EM or 0 to 479 GCS6LC e A straight line is directly displayed as the background of a screen When a part is opened or closed in the area where a straight line was displayed or when a primitive is displayed the st
243. en regardless of the ladder circuit interlock Output may be used to drive motors and the like so avoid using direct output because it is dangerous AN CAUTION Use and store the OIP in the environment described in the specifications regarding vibration shock temperature humidity etc Do not use the OIP where it is subjected to inflammable or explosive gas or steam Before turning on the power be sure that the power voltage rating of the OIP and the voltage rating power supply match Using a mistaken power supply can damage the unit Do not disassemble or modify the OIP Doing so can cause malfunctions and lead to other problems The OIP touch panel is made of glass Striking it with hard objects or pressing hard on it may break the glass Do not push down on the OIP touch panel with mechanical pencils screwdrivers or other sharp objects Doing so can damage the touch panel or cause malfunctions Notations Used In This Manual Notations Used In This Manual This manual uses the following symbol marks for you to use this system comfortably Describes a peril that may cause operator s death or serious injury in WARNING neglecting the WARNING item s Describes a peril that may cause bodily injury or serious device damage in Caution neglecting the CAUTION items s Describes general note s in use Note Explanations and supplements Glossaries used in this manual are as follows OIP Stands for Advanced Int
244. ene e EIS aA 4 35 FIGCOLOR ohier a eE E 4 86 CHETIN oeeie EE 4 36 FIGDSP ereiten ieee reae e NACE ATSE 4 87 CHR Sotside tige oea e eSEE 4 37 FIGFORM nenea nanna Aaa 4 88 CIN TRE orn Gees A 4 38 FPINPUT epia a E 4 89 CIRCOLOR eieae ahs ein edt Seton 4 39 PW SH oire eera eranan 4 90 CIRDS Pd e aaen aeeai 4 40 FOREN retener tete Site E ee 4 91 CIRSE Tuar e ea E K OE Aa 4 41 FOR TO NEX Lnonnrenn ae 4 92 CLEAR osien r E ee 4 42 FORMA Torenlaan a paa ai 4 93 CLOSE sku Sa e a ae 4 43 JEI A S NE EEEE techn eit E 4 94 CLOSECOM etetni aret 4 44 PUD EEE E E ETE 4 95 CLOSEPARALLE niiti icduseacaieessseieeborsseatens 4 45 FRECOLOR anneden tate 4 96 CLOSESIO fic fcicteehac i ee n e r aN 4 46 PREDS P siinne eaa T 4 98 CLEOSETIM sitesi dhvesiascephieestvetanttanstechine 4 47 FS EA E E S IE ET E 4 99 COLORS seien inent eiernes antenen r 4 48 FSUM eoni A 4 100 CONF END CONF 4 49 FUNCTION END FUNCTION 4 101 CONS Sai ieee han ae 4 50 FWRI E eoin a a a 4 103 CONTTIM er acces sek heeri ees intrede reana aai 4 51 COPY maeneene e a as 4 52 GETBLIGHT oe an aa a A 4 104 COS eaa a 4 53 GETDATE AS T 4 105 CURDIR ssssesesssssstetreesessssssestrereesesssssseseeees 4 54 CAKE i D A 4 106 CV Balete a aaa eera esn Eo Eae t 4 55 GERTEGNO EE 4 107 CVE aerun e a aT ets Beant 4 56 GBT a D AAA TETA 4 108 CAA E emer ENN E ee eee 4 57 GETOFESET occccccccccccccccccccccccceccceccesceees 4 109 CVID is eee hast eae ee eaber ne 4 58 GETTIMEB co 8 oo
245. ent Otherwise display may be disordered NUMCOLOR NUMDSP input type id data var buhin gamen NUMFORM var data 2 numdsp end evnt var 30 1 4 164 CHAPTER 4 INSTRUCTION REFERENCE OCT E OCT Function E Function E Format m Example of Use E Description E Related Item E Example of Program evnt The OCT function converts a decimal character string to an octal character string OCT numerical expression OCT 134 The OCT function converts a decimal character string to an octal character string e When a floating point type is specified in numerical expression the decimal character string numeric value is converted to an integer type then converted to an octal character string e Specify the decimal character string numeric value within the range from 2147483648 to 2147483647 HEX VAL input type id data mo jis strdsp end evnt OCTS data STROOO mojis 4 165 OCT fe ONFERR Statement E Function The ONFERR statement specifies the destination to which error messages are to be transmitted E Format ONFERR destination m Example of Use ONFERR BO00 E Description e The ONFERR statement specifies the destination to which file operation function error messages are to be transmitted e destination is a screen or part name or the D type variable indicating the screen or part name e When data is received by INPUT the screen or part to which
246. ent need not be declared e logical device name specifies any of the following external connecting devices HST Host computer BCR Bar code reader TKY Ten key pad CLOSE COM REOPENCOM OPENCOM HST end conf evnt input types id data if type 3 and data 1 then CLOS ECOM HST else if type 3 and data 0 then REOP ENCOM HST endif end evnt 4 168 CHAPTER 4 INSTRUCTION REFERENCE OPENPARALLEL eg OPENPARALLEL Statement E Function E Format m Example of Use E Description E Related Item E Example of Progra coni OPEN end conf evnt The OPENPARALLEL statement declares that the program receives data from a parallel port OPENPARALLEL input bit mode OPENPARALLEL 3 1 The OPENPARALLEL statement declares that the program receives data when the bit for specifying a parallel input port changes input bit indicates the bit used to transmit data when the value changes Specify this input bit with a numeric value from 0 to 15 mode specifies the time when data is transmitted The time when data is transmitted depends on how the bit changes 1 Data is transmitted when the bit goes High 2 Data is transmitted when the bit goes Low 3 Data is transmitted when the bit goes High or Low CLOSEPARALLEL REOPENPARALLEL m PARALLI input CI if type t types EL 3 id data 3 and data 1 then OSEPARALLEL 3
247. equest code type 1 return value 1 PRMSTAT4 control name request code type 1 type 2 VAL PRMSTAT1 NUMO000 _PD_STAT VAL PRMSTAT2 NUMO000 _PD_DCOLOR 3 VALF PRMSTATS3 LNE000 _PD_RANGE 0 VAL PRMSTAT4 BAR000 _PD_PTRN 1 0 e The PRMSTAT function reads the attributes of the specified primitive This function is classified into four types PPRMSTAT1 PRMSTAT2 PRMSTATS3 and PRMSTAT4 control name is the constant indicating the primitive to be read or the D type variable indicating the ID of the control e request code specifies the attributes to be read The types of request codes are shown on the next and subsequent pages e type 1 and type 2 depend on the request code to be specified e return value 1 is the return value of the function corresponding to the specified request code it must be an integer type constant or variable e return value 2 is the return value of the function corresponding to the specified request code it must be a floating point constant or variable PRMCTL1 PRMCTL2 PRMCTL3 PRMCTL4 PRMSTAT1 PRMSTAT2 PRMSTAT3 PRMSTAT4 conf end conf evnt status prmstatl NUMO00 _PD_STAT if status 0 then PRMCTL1 NUMO00 _PD_STAT 2 endif end evnt 4 193 PRMSTAT es e The types and usage of the request codes that can be used by PRMSTAT1 are explained below 1 _PD_NUMS Function Range Return value 1 2 _PD_ROTATE Function Range Return valu
248. er number indicates the number of the timer to be stopped and returned to the system Whether the timer number is an ID or integer type value depends on how the timer is opened See OPENTIM OPENTIM2 and OPENTIM3 OPENTIM OPENTIM2 OPENTIM3 STARTTIM STOPTIM CONTTIM SETTIM READTIM timid opentim 20 O starttim timid end conf evnt input type lse i if type id 3 and id data SWT000 then stoptim timid f id SWTOO1 then closetim timid end if end evnt 4 47 COLOR 8 COLOR Statement E Function The COLOR statement sets the color type and size of a straight line or a dot E Format COLOR display color line type line thickness or dot size m Example of Use COLOR 1 0 2 E Description e The COLOR statement sets the colors types and sizes of a straight line and a dot The values specified in the LINE and DOT statements have priority over those to be specified in this statement e display color indicates the display color of the straight line or dot Specify this display color with a numeric value from 0 to 15 The specified display color becomes the color pallet number of the tool e line type indicates the type of line to be drawn for example solid line and dotted line Specify this line type with a numeric value from 0 to 3 For the types of line see Plotting to Straight Line of the tool e line thickness indic
249. er of the panel has the coordinates 0 0 The horizontal direction toward the right corresponds to the X axis and the vertical direction toward below corresponds to the Y axis e Color is inversed as shown below In color display the palette values 0 to 15 are inversed In other words 0 is changed into 15 1 is changed into 14 7 is changed into 8 and so forth In monochrome display activated color is changed into deactivated color deactivated color is changed into activated color and transparent color is changed into activated color e If this is used in an initialization block or configuration block drawing is executed after executing this block and accordingly color is not inversed Be sure to use this in an event block E Related Item None E Example of Program evnt input ty id dat if ty 3 and id SWT000 then DINV 0 0 639 399 endif end evnt 4 71 DOT 8 DOT Statement E Function E Format m Example of Use E Description E Related Item m Example of Program conf color 1 end conf evnt The DOT statement displays dots on a screen DOT X1 Y1 DOT 20 300 The DOT statement displays a dot in the specified coordinate X1 Y1 X1 must be a numeric value from 0 to 639 Y1 must be a numeric value from 0 to 399 GC55EM or 0 to 479 GC56LC Dots are directly displayed as the background of a screen When a part is opened or closed in the area where dots are di
250. erformed by the control _PL_SMPMSG is applicable to plot bar graph and line chart displays When issuing messages to the part set 1 When not issuing messages set 0 _PL_SMPCTL controls sampling Stop start and reset _PL_SMPCTL is applicable to plot bar graph and line chart displays Stop stops sampling Start starts sampling from the stop status Reset clears display and starts sampling from the beginning 0 Sampling is stopped 1 Sampling is started 2 Sampling is reset _PL_SMPTME changes a sampling time _PL_SMPTME is applicable to plot bar graph and line chart displays Set a value indicating the sampling time setting value 0 5 second When the sampling time is changed sampling is started after it has been reset see _PL_SMPCLT 4 188 CHAPTER4 INSTRUCTION REFERENCE PRMCTL eg 12 PL_DIRECT Function Range Control value 13 _SW_RACT Function Range Control value 14 SW_BZER Function Range Control value 15 _SW_STAT Function Range Control value 16 _SW_BMODE Function Range Control value 17 _SW_ONCOLOR Function Range Control value _PL_DIRECT changes the display direction of a line chart _PLI_DIRECT is applicable only to line chart displays When changing the display direction of the line chart from right to left set 0 When changing the display direction from left to right set 1 This direction change is meaningl
251. erical expression E Format TAN numerical expression m Example of Use X TAN ANGLE E Description e The TAN function calculates a tangent value for the specified numerical expression The unit for the numeric expression is radian E Related Item ATN SIN COS E Example of Program evnt angle 3 141592 3 x TAN angle numdsp num000 x end evnt 4 246 CHAPTER4 INSTRUCTION REFERENCE TAN eg TIME Statement E Function The TIME statement reads the current time E Format TIME m Example of Use A TIME E Description The TIME statement reads the current time with a character string of H M S format e This statement cannot be used to set the current time e Once time is set using the SETTIME command in a model with a battery backup calendar IC GCS56LC or GC55EM time is updated even while the power is off If a model with no calendar IC GC53LC or GC53LM is turned off the date is initialized to 98 01 01 and the time to 00 00 00 when it is turned on again The date and time are updated while the power is on E Related Item DATE GETDATE GETTIME SETDATE SETTIME E Example of Program cont mojiS TIMES strdsp STROOO moji end conf 4 247 TIME fe TIMID Function E Function The TIMID function changes an integer type timer number to an D type timer number E Format TIMID number m Example of Use AA TIMID VAR E Description e number is the timer number integer
252. es change as follows VSTRS ALZIAS T ABCD 4 136 CHAPTER 4 INSTRUCTION REFERENCE LNECOLOR E LNECOLOR Statement E Function The LNECOLOR statement changes the line colors and figure of the line chart display E Format LNECOLOR control name line number line type line color tile display color background color m Example of Use LNECOLOR LNEO000 1 2 1 4 5 2 E Description e The LNECOLOR statement changes the line colors and figure of the line chart display and the background tile and color of the entire display e control name is the name of a line chart or the D type variable indicating the chart e line number is the integer value indicating the number of the line to be changed The line number starts at 1 e line type is the numeric value indicating the type of the line Specify this line type with a numeric value from 0 to 3 e tile indicates the tiling figure of the bar Specify this tiling figure with a numeric value from 0 to 15 e display color is the numeric value indicating the color number of the tile display section Specify this color number with a numeric value from 0 to 15 e background color is the numeric value indicating the color number of the tile background section Specify this color number with a numeric value from 0 to 15 E Related Item LNEDSP LNESHIFT E Example of Program conf static name name LNEOOO end conf evnt input types id data if types 3 then LNECOLOR nam
253. ese two statements is that the PLC device declared in the ADDCYC2 statement can communicate to obtain data even if the screen showing the declared part is not being displayed when another screen is being displayed Usually the declared PLC device communicates to obtain data only when the screen showing the declared part is being displayed ADDCYC ADDCYCID conf ADDCYC2 NUMO000 gt Uses 2X2 as a consecutive stage display end conf evnt input types id data Displays data on the corresponding display id1l addcycid NUM000 Indicates the ID of the device being used i getoffset id1 id 1 Indicates the device to be used relative to the first device id1l getid NUMOOO i Obtains the ID of the corresponding display numdsp idl data Displays the ID on the display end evnt 4 12 CHAPTER4 INSTRUCTION REFERENCE ADDCYCID pe ADDCYCID Function E Function E Format m Example of Use E Description E Related Item E Example of Program The ADDCYCID function obtains the ID of the device that was declared in control name and enabled to be read by even part programs ADDCYCID control name ID ADDCYCID NUMO000 e The ADDCYCID function obtains the ID of the device being used by the control enabled to be read by even part programs and returns the ID type To enable this operation however the operation parameters of the control in the part must be set to
254. ess if sampling is not performed When the display direction is changed sampling is started after it has been reset see _PL_SMPCLT _SW_RACT sets whether to perform reverse operation when a switch is ON _SW_RACT is applicable to switches and selector switches To perform reverse operation when a switch is ON set 1 Not to perform reverse operation set 0 _SW_BZER sets whether to sound the buzzer when a switch is ON _SW_BZER is applicable to switches and selector switches To sound the buzzer when a switch is pressed set 1 Not to sound the buzzer set 0 _SW_STAT changes the status disable halftone of a switch _SW_STAT is applicable to switches and selector switches Set one of the following numeric values indicating the switch status 0 Normal operation status 1 Input disable status 2 Halftone status normal operation input _SW_BMODE changes the switch background color display method _SW_BMODE is applicable to switches and selector switches When changing the switch background color display method to direct display set 0 When changing the display method to replacement display set 1 _SW_ONCOLOR sets a switch ON background color _SW_ONCOLAOR is applicable to switches and selector switches Set the number of the switch ON background color to be used with a numeric value from 0 to 15 4 189 PRMCTL E l 18 _SW_OFFCOLOR Function _SW_OFFCOLOR sets a switch OFF background color Ran
255. executing the above 100000000 is set in VAR 3 13 3 8 Labels 3 8 Labels Labels indicate a program jump destination and a subroutine name etc Labels are assigned names like variables labels is given below evnt input ty id dat if dat 1 then goto LABEL1 gosub SUBNAM GI GI SUBNAME dat retur 10 n 3 14 CHAPTER3 CODING RULES They are delimited by a colon An example of a program that use 3 9 Subroutines Subroutines Subroutines are written as a subroutine block outside the event block Description of a subroutine begins with a label name and ends with RETURN No K BASIC command can be written in the line where a label name is written Two or more subroutines can be written in one program conf Description of configuration block gosub SUB1 end conf evnt Description of event block gosub SUB10 end evnt SUB1 Subroutine body RETURN SUB10 Subroutine body RETURN Subroutines are classified into two types local and global Global subroutine Global subroutines are the subroutines written on the global screen Global subroutines can be called from all screen and part programs Variables to be used by global subroutines are global and static variables When a global subroutine is called from a screen local screen other than the global screen only the variables for which global or static was declared on that screen can be used
256. expanded to the lower right By the way the part was created above without taking the switch size into consideration and the size of the enlarged switch may not fit the size of the part In such a case drag the lower right of the part editor window to enlarge the window sufficiently Then enlarge the switch to a size enough to cover the part Then expand the part area identically to the switch size As a result the number indicator control shifts from the center of the part area Select and move it to a proper position In addition drag the handle to enlarge the rectangular outer frame so that it shows the switch area The part shown below is now created Then select Edit on the menu and select Edit Part Programs in order to edit the programs The program editor window opens Add programs to the initialization block and event block as shown below 2 16 CHAPTER2 EXAMPLES OF PROGRAMMING 2 1 Creating a Part for Displaying Numerics init local type id data Line to be numdsp NUM000 1234 added end init cont end conf evnt input type S id data if types 3 and id SWT000 and data 1 then numdsp NUM000 5678 Mine 1o08 added end if end evnt Try to explain where the program has modified The program added to the initialized block is a statement of declaring the variable used in the Event Block The input statement added in the Event Block enables to receive messages from the Switch control You can kn
257. f the lamp or pipe display is returned 4 196 CHAPTER4 INSTRUCTION REFERENCE PRMSTAT eg 20 21 22 23 24 25 26 27 _PL_NUMS Function Range Return value _PL_FIRST Function Range Return value _PL_DVTYP Function Range Return value _PL_ENDI Function Range Return value _PL_SMPMSG Function Range Return value _PL_SMPTME Function Range Return value _PL_DIRECT Function Range Return value _SW_NUMS Function Range Return value _PL_NUMS reads the number of devices being used _PL_NUMS is applicable to all controls except for clock displays The number of devices being used is returned When a doubleword is specified for a numeric display the number of devices is doubled _PL_FIRST reads the start registration number of the registration graphic or character string to be displayed _PL_FIRST is applicable to character and graphic displays The start registration number to be displayed is returned _PL_DVTYP reads the type of the device being used by the control _PL_DVTYP is applicable only to numeric displays For a doubleword 0 is returned For a single word 1 is returned _PL_ENDI reads the doubleword display method _PL_ENDI is applicable only to numeric displays When doublewords are displayed from downward to upward 0 is returned When doublewords are displayed from upward to downward 1 is returned _PL_SMPMSG reads
258. ge _SW_OFFCOLAOR is applicable to switches and selector switches Control value Set the number of the switch OFF background color to be used with a numeric value from 0 to 15 19 _SW_ONOFF Function _SW_ONOFF changes the ON OFF status of a switch Executing _SW_ONOFF for the switch for synchronous operation causes an error Range _SW_ONOFF is applicable to switches and selector switches Control value When changing a switch to the OFF status set 0 When changing a switch to the ON status set 1 When changing all selector switches to the OFF status set 0 When changing one of the selector switches to the ON status set the corresponding element number e The types and usage of the request codes that can be used by PRMCTL2 are explained below 1 _PD_DCOLOR Function _PD_COLOR changes the display color of a display Range _PD_DCOLOR is applicable to the ON color specification of numeric character clock plot free graph meter and lamp displays Type Specify one of the following 0 Figure change 1 Fore color change 2 Back color change 3 Display color change Control value Set the number of the display color to be changed with a numeric value from 0 to 15 2 _PD_BCOLOR Function _PD_BCOLOR changes the background color of a control Range _PD_BCOLOR is applicable to numeric character clock plot bar graph line chart and free graph displays Type Specify one of the following 0 Figure change 1 Fore color ch
259. graph to be changed is set in bar number The bar number can be specified with a constant or variable The bar number starts at 1 e tile 1 indicates the tiling figure of the bar Specify this tiling figure with a numeric value from 0 to 15 e display color 1 is a numeric value indicating the color number of the tile display section Specify this color number with a numeric value from 0 to 15 e background color 1 is a numeric value indicating the color number of the tile background section Specify this color number with a numeric value from 0 to 15 e tile 2 indicates the background tiling figure of the bar graph Specify this tiling figure with a numeric value from 0 to 15 e display color 2 is a numeric value indicating the color number of the tile display section of the background Specify this color number with a numeric value from 0 to 15 e background color 2 is a numeric value indicating the color number of the tile background section of the background Specify this color number with a numeric value from 0 to 15 E Related Item BARDSP BARSHIFT 4 18 CHAPTER4 INSTRUCTION REFERENCE BARCOLOR PT m Example of Program conf static name name BAROOO end conf evnt input types id data if types 3 then barcolor name 2 2 3 1 4 5 2 end if end evnt BARDSP pee BARDSP Statement E Function The BARDSP statement displays data in the bar graph display E Format BARDSP control name b
260. h day SETDATE 92 12 1 year is the low order two digits of A D 0 to 99 e month is a numeric value from 1 to 12 e day is a numeric value from 1 to 31 e If an unexisting year month or day is specified an error occurs e The day of the week is automatically set based on preset year month and day e Once date is set using the SETDATE command in a model with a battery backup calendar IC GC56LC or GCS5EM the date is updated even while the power is off If a model with no calendar IC GC53LC or GC53LM is turned off the date is initialized to January 1 1998 Thursday and the time to 00 00 00 when it is turned on again The date and time are updated while the power is on DATE GETDATE GETDATE SETTIME TIME E Example of Program evnt input type id dat if type 3 then y 94 m 12 d 1 setdate y m d endif end evnt 4 221 SETLNEPLOT fee SETLNEPLOT Statement E Function E Format m Example of Use E Description E Related Item E Example of Program evnt input The SETLNEPLOT statement sets the display range of a line chart SETLNEPLOT display start point display end point SETLNEPLOT 10 50 e The SETLNEPLOT statement sets the display range of a line chart Executing LNEDSP LNESHIFT or PRDSP after this display range has been set displays the line chart within the set range e After LNEDSP LNESHIFT or PRDSP has been executed the set display range is release
261. h the new part Now use this part actually Open gamen1 created above again and replace the old part with the new test To replace the old part click on it select Edit on the menu then select Delete From now on arrange the new part create the screen data and download it to the OIP in the same manner as described in 2 1 5 When the screen appears 1234 must be displayed on the screen as previously Press a point inside the frame and you can see that 1234 changes into 5678 In_K Basic an input statement is used to receive messages and if and end if statements used to judge various messages and execute operations For how to receive messages of other events see the examples introduced in subsequent chapters 2 19 2 2 Creating a Part to be Linked to a PLC Device 2 2 Creating a Part to be Linked to a PLC Device All the programs in this examples are for Mitsubishi PLCs If you use a PLC of other maker change the station number and device name of those programs and select the PLC type to be used in setting a connecting device setting 2 2 1 Numeral displays Display of D10 value Control to use One Number indicator control NUMO000 Exterior view of the part Figure Number indicator control NUMO000 2 20 CHAPTER2 EXAMPLES OF PROGRAMMING 2 2 Creating a Part to be Linked to a PLC Device An example of the program is given below inie local type id data cyclic 00 D10 end
262. hart display 1 indicates that the color and tile for which 1 was specified remain unchanged e control name is the pie chart name or the ID type variable indicating the pie chart e The value indicating the number of the zone in the pie chart to be changed is set in Zone position The zone position starts at 1 e tile indicates the tiling figure of the zone Specify this tiling figure with a numeric value from 0 to 15 e display color is a numeric value indicating the color number of the tile display section Specify this color number with a numeric value from 0 to 15 e background color is a numeric value indicating the color number of the tile background section Specify this color number with a numeric value from 0 to 15 E Related Item CIRDSP E Example of Program evnt input type id zone tile CIRCOLOR CIROOO zone tile 1 end evnt 4 39 CIRDSP 8 CIRDSP Statement E Function E Format m Example of Use E Description E Related Item E Example of Program conf The CIRDSP statement displays data in the zone where the pie chart display was specified CIRDSP control name zone number display value CIRDSP CIRO00 1 30 e The CIRDSP statement displays data in the zone where the pie chart display was specified control name is the pie chart name or the D type variable indicating the pie chart e The value indicating the zone number in the pie chart to be displayed is set in Zone
263. he numeric data indicating the size of the bar graph E Related Item BARDSP PRDSP E Example of Program evnt BARSET buhin gpaph 3 20 1 var buhin graph no 4 value 23 barset var no value prdsp var end evnt 4 21 BARSHIFT ge BARSHIFT Function E Function The BARSHIFT function shifts bar graph data left or right and displays it E Format DATA BARSHIFT control name shift direction display data m Example of Use DATA BARSHIFT BARO00 1 30 E Description e When two or more bars are being displayed in one bar graph display the BARSHIFT statement shifts the bars constituting the graph left or right by one bar and displays the bars e When the BARSHIFT function is executed the values of the bars purged from the graph are returned as a result of the shifting e The variable indicating the graph name or ID is set in control name e When shift direction is 1 bar graph data is shifted left and above When shift direction is 1 bar graph data is shifted right and below e display data indicates the data to be displayed in the vacant area produced as a result of the shifting E Related Item BARDSP BARCOLOR E Example of Program evnt input type id data if data gt 0 then abc barshift BAR000 1 0 else abc barshift BAR000 1 100 endif end evnt 4 22 CHAPTER4 INSTRUCTION REFERENCE BCD2BIN eg BCD2BIN Function E Funct
264. he specified character string variable name MKS MKW MKI MKF MKID CVB CVW CVI CVF CVID orgS 1234567 strdsp MKB orgS strdsp end evnt STROOO orgs 2 amp H39 STROO1 org 4 152 CHAPTER4 INSTRUCTION REFERENCE MKDIR eg r MKDIR Statement E Function The MKDIR statement creates a directory E Format MKDIR directory name m Example of Use MKDIR TEST E Description e The MKDIR statement is an instruction for creating a subdirectory e Specify the directory to be created with a character string constant or variable e The directory to be created can be specified in directory name together with a drive name E Related Item RMDIR CHDIR DIR m Example of Program conf end conf evnt MKDIR C TEST end evnt 4 153 MKF 8 MKF Statement E Function The MKF statement stores data in any position of a character string variable E Format MKF character string variable name storage position real value E Example of Use MKF MOJI 5 VAR E Description E Related Item m Example of Program conf end conf evnt The MKF statement stores fours bytes of real value in the position specified by storage position starting from the beginning of the specified character string variable name storage position must be a integer or floating point type variable or constant 1 specifies the beginning of the character string variable real value specifies an over
265. he specified alarm E Format RESETALARM alarm number m Example of Use RESETALARM NO E Description e alarm number is the number of the alarm set by the SETALARM statement it must be an D type variable e This statement resets the setting for posting an alarm ON to the program when a specified time is reached E Related Item SETALARM E Example of Program conf static alid alid setalarm 10 0 end conf evnt input types id data if types 3 then RESETALARM alid end if end evnt 4 209 RETURN a RETURN Statement E Function The RETURN statement returns control from the subroutine to the original program E Format RETURN m Example of Use RETURN E Description e The RETURN statement returns control to the statement following the statement called by the GOSUB statement E Related Item GOSUB E Example of Program evnt X 10 GOSUB SUB001 numdsp NUMOOO X end evnt SUBOOL X X 3 RETURN 4 210 CHAPTER4 INSTRUCTION REFERENCE RIGHT E a a RIGHT Function E Function E Format m Example of Use E Description E Related Item E Example of Program evnt bs a c c J J 2 vs end evnt The RIGHT function returns a character string the specified number of characters starting from the left of the specified character string RIGHTS character string number of characters RIGHTS registered character string number n
266. hen closetim 5 end if end evnt 4 172 CHAPTER4 INSTRUCTION REFERENCE OPENTIM3 eg OPENTIM3 Function E Function The OPENTIMS3 function allocates opens the timer to be used E Format RET OPENTIM3 timer number m Example of Use RET OPENTIM3 14 E Description e The OPENTIM3 function opens the timer specified in timer number e timer number specifies the number of the timer to be used Specify this timer number with an integer type value from 0 to 15 e When the OPENTIM2 function is executed any of the following value is returned 0 The timer could be opened 1 The timer could not be opened e When the screen for which open was declared changes to another the opened timer is automatically closed e The OPENTIM3 function can be used by the screen or part program being displayed If this function is executed on an undisplayed rear screen an error occurs E Related Item CLOSETIM STARTTIM STOPTIM CONTTIM SETTIM READTIM OPENTIM E Example of Program cont ret opentim3 3 settim 3 20 1 stoptim 3 closetim 3 end conf 4 173 OUT ee OUT Statement E Function The OUT statement writes 2 byte data to an I O port E Format OUT port number output data m Example of Use OUT 0 amp H20 E Description e Currently data can be written only to parallel I O ports port number specifies the number of the I O port inserted into the option bus For the color plasma this port number is fi
267. her than 0 or false 0 e When the operation result is true as a result of executing a conditional expression the THEN and subsequent statements are executed When the operation result is false the ELSE and subsequent statements are executed e The ELSE ELSEIF and subsequent statements can also be omitted e Up to 50 ELSEIF statements can be used in IF THEN END IF None 2 then x 3 then 4 115 INIT END INIT l INIT END INIT Statement E Function E Format m Example of Use E Description E Related Item m Example of Program INIT The INIT END INIT statement declares an area of an initialization block END INIT INIT static VAR END INIT e An initialization block written in a screen program or part program is executed first only once when the program including the block is executed e Write processing which should be executed first only once such as initialization or the like CONF END CONF EVNT END EVNT global moji mo j3i initial value END INI 4 116 CHAPTER4 INSTRUCTION REFERENCE INP PT INP Function E Function The INP function reads 2 byte data from the specified parallel I O port E Format INP port number m Example of Use VAR INP 0 E Description e The INP function reads data from the specified parallel I O port e The port number to be specified depends on the option board inserted into the option bus A numeric val
268. his function collectively reads data from the specified device by the specified data read count e device name indicates the name of the device to be read device name indicating the read start address e data read count specifies the number of data to be continuously read from the specified device e The data read from the specified device is set in array variable to which read data is written This variable must be a one dimensional array type variable The data read from the specified device is continuously written starting from the location specified by this variable e When the array variable is smaller than the data read count the data that cannot be written to the array is discarded e The number of data that can be read depends on the type of PLC Refer to Serial Communication Manual e For memory link a variable can be used as a table number E Related Item BWRITE E Example of Program cont cyclic 007 M01 static PARAM 10 end conf evnt input types id data if id 00 M01 and data 1 then BREAD 00 D10 5 PAARAMS 3 endif end evnt 4 33 BWRITE 8 BWRITE Function E Function E Format m Example of use E Description E Related Item m Example of Program conf The BWRITE function writes data to the specified device or memory table in blocks BWRITE device name data write count write data variable BWRITE memory table name data write count write data variable
269. ic value from 0 to 15 e display color 2 is a numeric value indicating the color number of the tile display section of the background Specify this color number with a numeric value from 0 to 15 e background color 2 is a numeric value indicating the color number of the tile background section of the background Specify this color number with a numeric value from 0 to 15 E Related Item FREDSP 4 96 CHAPTER4 INSTRUCTION REFERENCE FRECOLOR PT E Example of Program conf static name name FREOOO end conf evnt input types id data if types 3 then FRECOLOR name 2 3 1 4 5 2 endif end evnt 4 97 FREDSP 8 FREDSP Statement E Function The FREDSP statement specifies the value to be displayed in the free graph display E Format FREDSP control name display value m Example of Use FREDSP B000 FRE000 50 E Description e The FREDSP statement specifies the value to be displayed in the free graph control name is the name of the free graph display or the ID type variable indicating the free graph display e display value is the value specifying the filling range in the free graph display e display value cannot be changed even if this statement is issued to the display for which operation parameters are set to effective in the primitive E Related Item FRECOLOR E Example of Program cont static name name FREOOO end conf evnt input type id d
270. ich control was moved E Related Item None E Example of Program evnt if a 1 then goto Ll a 3 L1 numdsp NUMOOO a end evnt 4 113 INIT END INIT l HEX Function E Function The HEX function converts a decimal character string to a hexadecimal character string E Format HEX numerical expression m Example of Use HEX 123 E Description e The HEX function converts a decimal character string to a hexadecimal character string e When a floating point type is specified in numerical expression the decimal character string numeric value is converted to an integer type then converted to a hexadecimal character string e Specify the decimal character string numeric value within the range from 2147483648 to 2147483647 E Related Item OCT VAL E Example of Program evnt input type id data mojiS HEXS data strdsp STROOO mojiS end evnt 4 114 CHAPTER4 INSTRUCTION REFERENCE IF THEN ELSE pe a IF THEN ELSE Statement E Function E Format m Example of Use E Description E Related Item m Example of Program elseif w I end if end evnt Condition judgment is performed to select the next program to be executed IF conditional expression THEN statement ELSE statement IF conditional expression THEN statement list ELSEIF conditional expression THEN statement list ELSE statement list END IF IF TYPE 1 THEN VALUE 10
271. ied device or memory table in blocks This function collectively write data to the specified device by the specified data write count device name indicates the name of the device to be written device name indicating the write start address data write count specifies the number of data to be continuously written to the specified device write data variable is the variable containing the value to be written to the specified device This variable must be a one dimensional array type variable Data is continuously written to the specified device starting from the location specified by this variable When the array variable is smaller than the data write count 0 is written to the remaining area When the array variable is greater than the data write count the larger part is ignored The number of data that can be written depends on the type of PLC Refer to Serial Communication Manual For memory link a variable can be used as a table number BREAD cyclic 007 M01 static PARAM 10 end conf evnt input types id data if id BWRI T endif end evnt OO MO1 and data 1 then E 00 D10 5 PAARAMS 3 4 34 CHAPTER4 INSTRUCTION REFERENCE CHDIR eg a CHDIR Statement E Function The CHDIR statement changes a directory and or a drive E Format CHDIR directory name m Example of Use CHDIR C TEST E Description e The CHDIR statement is an instruction that changes the current di
272. iffers from that of the texture to be control in the control the FIGFORM statement specifies whether to perform resize magnification reduction Resize is performed to make the size of the texture to be displayed match that of the texture display e control name is the graphic display name or the D type variable indicating the graphic display e The integer type value indicating whether to perform resize is set in resize specification 0 Resize is not performed 1 Resize is performed FIGCOLOR FIGDSP input ty id data if ty FIGFO else FIGFO endif figdsp end evnt 3 and data 1 then RM FIGOOO 1 RM FIGOOO 2 FIG000 figno 4 88 CHAPTER4 INSTRUCTION REFERENCE FINPUT E FINPUT Statement E Function The FINPUT statement reads data from the specified file E Format FINPUT file number variable variable m Example of Use FINPUT 12 VAR STRING E Description e The FINPUT statement reads data from the file specified by file number into the specified variable e A numeric or character string variable can be specified in variable e The following delimiters can be used when data is read into the specified variable They are not included in the variable Only comma and carriage return CR can be used as delimiters Line feed LF following CR is ignored When a numeric variable is specified a blank can also be used as a delimiter When a character string variable i
273. ined function and user defined function Minus sign Exponent operator Multiplication and division Addition and subtraction Remainder of integer Relational operators Logical negation Conjunction disjunction and exclusive Note ID type variables and constants can be applied only to the comparison oy between two items using relational operator CHAPTER 3 CODING RULES 3 7 Type Conversion 3 7 Type Conversion If logical operation is performed for different types when integer and floating point type values are assigned to variables of different types type conversion occurs Assignment The following is an example of assigning floating point type data to integer type data VAR1 2 45 VAR2 2 56 In this case 2 is assigned to VAR1 and 3 assigned to VAR2 A real number is rounded off when it is converted to an integer The value obtained as a result of this rounding off becomes an integer type Logical operation For logical operation floating point type data is converted to integer type data and operated VAR 23 FLOAT 12 35 VAR AND FLOAT The result of this calculation is like 23 AND 12 Others When an integer type value is converted to a floating point type value which in turn is converted to an integer type value again loss of significant digits may occur In the OIP the number of significant digits is 6 digits VAR 99999999 FLOAT VAR VAR FLOAT As a result of
274. ined in variable name as an local variable e A local variable can be read and written only in a program where it is declared The compiler gives a warning if an undefined local variable is used Each local variable is initialized every time the block is executed e If a variable has a subscript enclosed in parentheses an arrangement variable is declared e The number of maximum subscript values in parentheses indicates that of array dimensions In arrays of two dimensions or higher subscripts are specified delimited by a comma e maximum subscript value indicates the maximum value of subscript that can be specified The subscript starts at 0 e A variable can be used as an array variable even if it is not declared in the DIM statement In this case the maximum value of the subscript is 10 e When a character variable is declared in an array the element size can be declared e Defining many arrays makes it impossible to display many screens because the OIP work area becomes small e Screen Creator 5 has a new function for declaring local variables other than arrangement variables distinctively e The DIM statement is provided to maintain the compatibility with GCSGP3 Use LOCAL instead of DIM to declare a local variable e When a DIM statement is used to declare an arrangement variable compatibility with GCSGP3 is maintained AUTO BACKUP GLOBAL LOCAL STATIC STRING 4 67 DIM R m Example of Program
275. init conf end conf evnt input type s id data if type 16 and id 00 D10 then numdsp NUM000 data end if end evnt Configuration Block cyclic 00 10 The cyclic instruction reads the value of a device D10 of the PLC whose station number is set to 00 The cyclic instruction is used to keep observing of PLC device values The cyclic instruction reads PLC device values periodically When a PLC device value changes the cyclic instruction transmits a messages to the Event Block Type the station number and device name to be read after cyclic K BASIC rules require you to link the station number and the device name by a tilde This instruction transmits a message when ever the screen changes Configuration Block Noting is processed Event Block input type S id data The input instruction reads the messages transmitted to the part The format of the messages are in order of type 16 id 00 D10 and data PLC value 00 D10 if type 16 and id 007D10 then end if A condition type 16 put after if means a message from the PLC id 00 D10 means that the ID of the device that has issued this message is 00 D10 Inserting and between these two items enables the subsequent programs to be executed only when both the conditions are satisfied 2 21 2 2 Creating a Part to be Linked to a PLC Device 2 22 numdsp NUM
276. initialized before all blocks in all programs are executed The position of initializing a variable depends on the variable type and where declaration is done Global variables static variables and backup variables are initialized before the program blocks are executed Local variables are initialized when the block where the local variables are declared are executed Therefore note that if local variables are declared in configuration blocks or event blocks the variables are initialized every time these blocks are executed Auto variables are initialized when the functions for which the auto variables are declared are called and executed 3 9 3 6 Expressions and Operations 3 6 Expressions and Operations This section explains operations performed between variables and constants Arithmetic operators exponent operation minus sign multiplication division division addition subtraction MOD remainder of integers Relational operators Exponent operation is written like X Y This represents the Y power of X 100 VAR Integer and floating point type numeric values are converted to minus values VAR1 VAR2_ VAR1 is multiplied by VAR2 VAR1 VAR2_ VAR1 is divided by VAR2 VAR1 VAR2 VARI is divided by VAR2 The quotient becomes an integer type value VAR1 VAR2 VAR2 is added to VAR1 VAR1 VAR2 VAR2 is subtracted from VAR1 VAR1 MOD VAR2 The remainder is obtained by dividing V
277. input type id data if pstat 0 then close endif end evnt 4 43 CLOSECOM 8 CLOSECOM Statement E Function E Format m Example of Use E Description E Related Item m Example of Program con The CLOSECOM statement temporarily stops the use of a serial line CLOSECOM device name CLOSECOM HST e The CLOSECOM statement is a command that temporarily inhibits a program from receiving data from an external connecting device using the OPENCOM instruction e HST host computer BCR bar code reader or TKY ten key pad can be specified in device name OPENCOM OPENCOM HST end conf evnt input type id data if type 3 and data 1 then CLOS ECOM HST else if type 3 and data 0 then REOP ENCOM HST endif end evnt 4 44 CHAPTER4 INSTRUCTION REFERENCE CLOSEPARALLEL pe CLOSEPARALLEL Statement E Function The CLOSEPARALLEL statement temporarily stops data input from a parallel port E Format CLOSEPARALLEL input bit m Example of Use CLOSEPARALLEL 3 E Description e The CLOSEPARALLEL statement is an instruction that temporarily inhibits a program from receiving data as a message from the parallel port specification bit using the OPENPARALLEL instruction e input bit specifies the bit for inhibiting data reception E Related Item OPENPARALLEL REOPENPARALLEL m Example of Program coni OPENPARALLEL 3 end conf evnt
278. ion E Function E Format m Example of Use E Description E Related Item The FSUM function calculates the sum of the variable group in the specified field FSUM file number SUM FSUM 5 e The FSUM function calculates the sum eight low order bits of the variable group included in the FIELD specified by file number by incrementing the contents of the group for each byte The function calculates the area where no character code is defined in the character string variable as 0 e The FSUM function returns the calculation result as an integer type value within the range from 0 to 255 Ifthe FIELD specified by file number does not exist an error occurs FOPEN FIELD FCLOSE FPUT FGET E Example of Program cont field 5 global no global mojilS moji2s end field global sum fopen MEMORY 2 5 end conf o fget 5 3 if sum FSUM 5 then n S umdsp NUMOOO no trdsp STROOO mojilS strdsp STROO1L moji2s else strdsp STROO2 SUM error fclose 5 end evnt 4 100 CHAPTER4 INSTRUCTION REFERENCE FUNCTION END FUNCTION FUNCTION END FUNCTION Statement E Function E Format m Example of Use E Description E Related Item The FUNCTION END FUNCTION statement declares a function block FUNCTION function name type declaration character variable declaration variable declaration EN
279. ion m Example of Use X COS ANGLE E Description The COS function calculates a cosine value for the specified numerical expression The unit for the numerical expression is radian E Related Item ATN SIN TAN E Example of Program evnt angle 3 141592 3 x COS angle end evnt 4 53 CURDIR es CURDIR Statement E Function The CURDIR statement makes a character string indicating the current directory path name into a character string variable E Format CURDIR character string variable E Example of Use CURDIR PATH E Description A full path name including a drive name should be written E Related Item DIR CHDIR MKDIR RMDIR E Example of Program cont strdsp str curdir end conf evnt input types id data if data 1 then curdir paths strdsp dsp str paths end if end evnt 4 54 CHAPTER 4 INSTRUCTION REFERENCE CVBS eg CVB Function E Function The CVB function allocates data from any position of a character string variable E Format CVB character string variable name allocation position E Example of Use VAR CVB MOJI 5 E Description e The CVB function allocates data one byte from the specified allocation position of the specified character variable name The allocated data is regarded as an integer value e allocation position must be an integer or floating point type variable or constant 1 specifies the beginning of the character string variable E Related Item M
280. ion E Format E Example of Use E Description E Related Item E Example of Program conf The BCD2BIN function converts BCD data to binary data BCD2BIN numerical expression BINDATA BCD2BIN BCDDATA The BCD2BIN function converts the entered BCD data to binary data BIN2BCD cyclic 00 D10 end conf evnt input types id data if types data 16 then BCD2BIN data numdsp NUM000 data endif end evnt 4 23 BEEP ls BEEP Statement E Function E Format E Example of Use E Description E Related Item E Example of Program conf SETB evnt The BEEP statement performs buzzer ON OFF control BEEP command value BEEP 1 e The BEEP statement is a command that sounds and stops the buzzer e When command value is 1 the buzzer sounds when 0 the buzzer stops The SETBEEP statement can be used to set the buzzer ON OFF time SETBEEP EEP 50 20 3 end conf input type id data if id BEEF D 1 else BEE endif end evni SWT000 then 4 24 CHAPTER4 INSTRUCTION REFERENCE BIN2BCD PT BIN2BCD Function E Function The BIN2BCD function converts binary data to BCD data E Format BIN2BCD numerical expression E Example of Use BCDDATA BIN2BCD BINDATA E Description The BIN2BCD function converts binary data to BCD data e Ifthe binary data to converted
281. ion allocates data from any position of a character string variable E Format CVI character string variable name allocation position E Example of Use VAR CVI MOJI 5 E Description e The CVI function allocates data four bytes from the specified allocation position of the specified character variable name The allocated data is regarded as an integer value e allocation position must be an integer or floating point type variable or constant 1 specifies the beginning of the character string variable e A cut out value is converted into a 86 series boundary E Related Item MKS MKB MKW MKI MKF MKID CVB CVW CVF CVID E Example of Program conf end conf evnt orgs 1234567 data CVI org 3 numdsp NUM000 data Displays amp H36353433 end evnt 4 57 CVID es CVID Function E Function The CVID function allocates data from any position of a character string variable E Format CVID character string variable name allocation position E Example of Use VAR CVID MOJI 5 E Description e The CVID function allocates data six bytes from the specified allocation position of the specified character variable name The allocated data is regarded as an ID value e allocation position must be an integer or floating point type variable or constant 1 specifies the beginning of the character string variable e The CVID function returns an D type value e A cut out value is converted into
282. ion between the host computer and memory link This table is of word type 2 bytes There are 2048 configuration elements address 0 to address 2047 The following explain how to access the memory table in K Basic 3 15 1 Describing memory table 0O MTBL 0 Memory table of Oth element O0O MTBL 2047 Memory table of 2047th element OO MTBL NO Memory table of element indicated by NO 3 15 2 Reading and writing One element ABC 00 MTBL 100 The contents of the 100th memory table are read into variable ABC OO MTBL 200 23 Data 23 is written to the 200th memory table 00 MTBL ABC XYZ The contents of variable XYZ are written to the memory table indicated by variable ABC 3 15 3 Reading and writing two or more elements BREAD 00 MTBL 100 20 ABCD XY BREAD 00 MTBL START NUMS ABCD XY In the first example 20 configuration elements are read into the XY location of array variable ABCD starting at address 100 of the memory table In the second example NUMS configuration elements are read into the XY location of array variable ABCD starting at the address indicated by START of the memory table BWRITE 00 MTBL 100 20 ABCD XY BWRITE 00 MTBL START NUMS ABCD XY In the first example 20 data is written from the XY location of array variable ABCD to the memory table beginning with address 100 In the second example NUMS data is written from the XY location of array variable A
283. ion must be an integer or floating point type variable or constant 1 specifies the beginning of the character string variable integer value specifies an overwriting value it must be an integer or floating point type variable or constant When specified in integer value a floating point type variable or constant is converted to an integer The two low order bytes of this value overwrites the specified character string variable name The value is converted into a 86 series boundary and saved MKS MKB MKI MKF MKID CVB CVW CVI CVF CVID orgS 1234567 strdsp MKW orgS strdsp end evnt STROOO org 2 amp H3940 STROO1 org 4 158 CHAPTER4 INSTRUCTION REFERENCE MKW PT MOVE Statement E Function The MOVE statement moves the specified part E Format MOVE part name X direction move quantity Y direction move quantity move method m Example of Use MOVE BUHIN 100 20 0 E Description e part name is the name of the part to be moved or the D type variable indicating the part to be moved X direction move quantity and Y direction move quantity are the values indicating the distance in which the part is moved When the upper left end on the display screen is 0 0 the coordinates in the right direction are X coordinates and those in the downward direction are Y coordinates The move unit is specified in dots X must be a numeric value from 0 to 639 Y must be a numeric value from 0 to 399
284. ion program for screen conf gl obal send_id open B000 1 close BOOL end conf evnt end evnt Operation program for part conf cyclic station number connected device address end conf evnt input ty id dat if ty 16 1 3 1 3 Terms 1 3 Terms 1 3 1 Screens A screen consists of a figure screen background and some parts Figure orn Ee orcs Parts You can draw a figure on a screen or a part by plotting elements such as lines rectangles circles and characters 1 4 CHAPTER INTRODUCTION 1 3 3 Parts l 3 Terms A part is a combination of a figure part background and same controls such as displays and touch switches Part background Com Basic function elements such as data display and touch switch 1 3 4 Controls A control is used to display the value of a part or a meter value or to activate a switch The operation of such a part is coded as an operation program Plotting elements such as a Straight line a square and a cicle Operation program K Basic Program for handling controls designation primitive has been used for GCSGP3 instead of control It is possible to overlay several controls on a single part i bin Pa Control Meter Control Number indicator The 1 3 Terms 1 3 5 Messages A message is a trigger for activating an operation program A part starts its operation when it
285. ions Character connection is used like VAR1 VAR2 That is is used to connect two characters For VAR VAR1 VAR2 the connected characters are assigned to VAR Character string comparison Two character strings are compared The comparison result is true 1 or false 0 is used like VAR1 VAR2 Itis used to judge whether two character strings VAR1 and VAR2 are equal lt gt lt gt is used like VAR1 lt gt VAR2 It is used to judge whether two character strings are not equal lt lt is used like VAR1 lt VAR2 When VAR1 is less than VAR2 the result becomes true gt gt is used like VAR1 gt VAR2 When VAR1 is greater than VAR2 the result becomes true lt lt is used like VAR1 lt VAR2 When VAR1 is less than or equal to VAR2 the result becomes true gt gt is used like VAR1 gt VAR2 When VAR1 is greater than or equal to VAR2 the result becomes true Two character strings are compared from the beginning for each byte When two different characters are found whether one character is greater than or less than the other is judged When one character string becomes shorter than the other during comparison the shorter string becomes small 3 6 Expressions and Operations 3 12 Priorities of operators Operators are written according to priorities below Expressions Functions lt gt NOT AND OR XOR Expression enclosed in parentheses System def
286. is portion is called a Configuration Block and is first executed in this program which is generally used for declaring variable or initializing them numdsp NUMO000 1234 The numdsp instruction displays a numerical value in a number indicator control Write the name of the number indicator control for displaying data and the data to be displayed following the instruction NUMO00 shows the name of the control The following rules apply to this naming Control names and naming rules Screen GAMEN Part on GAMEN GAMEN TEST Control in BUHIN on GAMEN GAMEN TEST NUMO00 Current part on the current screen Omitted Control in the current part on the current screen NUMO00 Note Be sure to specify the names only with alphabetical and numerical characters Just like the part in this example if a control is set in the same place as that of a programmed part you can omit the screen name and the part name to specify the control CHAPTER 2 EXAMPLES OF PROGRAMMING 2 1 Creating a Part for Displaying Numerics System name TEST Use screen Screen name AUNO GAMEN1 Part name TEST Screen The program in part TEST is supposed to indicate control NUMOOO GAMEN TEST NUMO000 or NUMOOQO The other parameter is the numerical value to be displayed You can change the display value by changing this parameter mr UU Number indicator control NUMOOO0 Drawing On screen Displayed data
287. is received a message is transmitted to the part screen A terminator code can be specified only by one byte e The port to be set must be opened by the OPENSIO statement in advance E Related Item OPENSIO CLOSESIO WRITESIO WRITWSIOB FLUSH IOCTL E Example of Program conf global buf S 200 opensio 2 1 bufs SETSIO 2 amp HD end conf evnt strdsp STROOO buf closesio 2 end evnt 4 223 SETTIM 8 SETTIM Statement E Function The SETTIM statement sets the limit time of the specified timer E Format SETTIM timer number time limit timer type m Example of Use SETTIM ID 100 0 SETTIM VAR 200 1 E Description e The SETTIM statement determines the operation of the specified timer The timer must be stopped when it is set timer number is the D type variable indicating the number of the timer whose operation is to be set or an integer type value from 0 to 15 e The time specified in time limit starts to be counted when operation of the specified timer is started It is specified in units of 100 milliseconds e timer type specifies the type of timer to be set Timers are classified into two types normal and interval The normal timer stops when the specified time limit is reached once The interval timer restarts counting from 0 when the specified time limit is reached once 0 Normal timer 1 Interval timer e If one second or lower is set as the time limit in the interval ti
288. is the pie chart name or the ID type variable indicating the pie chart e The value indicating the number of the zone in the pie chart to be changed is set in Zone position The zone position starts at 1 e tile indicates the tiling figure of the zone Specify this tiling figure with a numeric value from 0 to 15 e display color is a numeric value indicating the color number of the tile display section Specify this color number with a numeric value from 0 to 15 e background color is a numeric value indicating the color number of the tile background section Specify this color number with a numeric value from 0 to 15 E Related Item CIRDSP E Example of Program evnt input type id zone tile CIRCOLOR CIROOO zone tile 1 end evnt 4 39 CIRDSP 8 CIRDSP Statement E Function E Format m Example of Use E Description E Related Item E Example of Program conf The CIRDSP statement displays data in the zone where the pie chart display was specified CIRDSP control name zone number display value CIRDSP CIRO00 1 30 e The CIRDSP statement displays data in the zone where the pie chart display was specified control name is the pie chart name or the D type variable indicating the pie chart e The value indicating the zone number in the pie chart to be displayed is set in Zone number The zone number can be specified with a constant or variable The zone number starts at 1 e display
289. ize Day Dine of updating updating DISK_1 lt VOL gt 87 01 15 15 25 SAMPLE EXE 98765 92 11 03 9 12 ABCDEFG 123456 94 03 21 11 34 TEST2 C 256 93 05 05 12 07 DOWNLOAD OIP lt DIR gt 87 02 14 21 13 KBASIC lt DIR gt 93 12 24 8 25 DATA_007 32 89 10 10 10 42 In this example seven data are created in character strings of 280 bytes in all The label is shown for convenience only The number of data to be created depends on the size of the character string variable As much data as possible is created DIR CHDIR MKDIR RMDIR 4 69 DIM 8 E Example of Program conf obal dname 13 pnamel 13 pname2 13 p2sel tatic list 2000 4 dir g global dsel plsel Ss Ss trdsp str end conf evnt input types id if data 1 then data path dname dsel strdsp dsp str path dir paths strdsp dsp str num lists num000 num numdsp end if end evnt 4 70 CHAPTER 4 INSTRUCTION REFERENCE amp H3F pname1 plsel pname2 p2sel 0 iists DIR eg DINV Statement E Function Inverses the color in a specified screen area E Format DINV upper left X coordinate upper left Y coordinate lower right X coordinate lower right Y coordinate m Example of Use DINV 10 10 30 30 E Description e Inverses the color in a rectangular area having opposite points of specified coordinates e The upper left corn
290. k on the Save button to save the part Then select Close on the Library menu to close the part creation window Berie a tisa Com A bang marten Sas a Piiri 7 m heats E fhe aaah r fe ME fem ie e Now part creation procedures are completed 2 8 CHAPTER2 EXAMPLES OF PROGRAMMING 2 1 Creating a Part for Displaying Numerics 2 1 5 Using a created part New to create a new screen The screen creation window opens as shown below Arrange the part created above on this screen Select Create on the menu select Parts then select User Parts The part selection dialog box opens Click on test created above The Arranged Part Properties dialog box opens In this dialog box only press the OK Arrange button without changing any items 2 9 2 1 Creating a Part for Displaying Numerics Maer Em Canmi ss l Peis ruis iF Wargi O Prga l Hra T Cle T Deise Bria Ti oOo o y iskari Toks BLE Dimiao pur aera Pianasifi The dialog box closes and the mouse cursor changes into the mouse In this condition move the cursor to a screen where the part should be arranged then click the left mouse button The mouse cursor changes into a rectangular frame which shows the size of the part Click the left mouse button at an intended position on the screen and the part is arranged at that position on the screen as shown below Then save this screen Select
291. l 0 0 else LOGE Oi endif end evnt 4 126 CHAPTER4 INSTRUCTION REFERENCE IOCTL2 eg _ IOCTL2 Statement E Function The IOCTL2 statement controls PLC cyclic communication E Format IOCTL2 device name code data m Example of Use IOCTL2 00 D10 0 0 E Description e Executing the IOCTL2 statement executes the cyclic communication specified by device name The cyclic communication to be specified by device name must be declared in the CYCLIC or CYCLIC2 statement in advance e Set 0 in code and data E Related Item None E Example of Program cont cyclic 00 7D10 end conf evnt input ty id dat if id swl then OO7 D11 1 ioctl2 007D10 0 0 endif end evnt 4 127 IOSTAT l IOSTAT Function E Function The IOSTAT function reads the status of the I O device connected to the OIP E Format IOSTAT I O type m Example of Use IOSTAT 0 E Description e Write the integer value indicating the I O device whose status is to be read in O type Currently the type of I O device that can be controlled are the PLC and switch To read the PLC status specify 0 in I O type 0 The PLC is write and read enabled 1 The PLC is write inhibited e To read the switch status specify amp H60 in l O type The number of switches that can be recognized when they are pressed simultaneously is returned 0 to 640 E Related Item IOCTL E Example of Program evnt input ty id dat
292. l communication data reception is completed Sampling messages e A sampling message is issued when the primitive that is performing sampling reads data PLC messages e PLC device values are transmitted as a message A PLC message is transmitted when the device contents change during communication between the OIP and PLC If the values of several PLC devices change the changes are detected after the OIP communicates with the PLC Therefore messages may not been issued in the order of the changes in the device values To receive messages from the PLC what PLC device is to be used must be declared in the program in advance See CYCLIC command Bar code ten key pad messages A message is issued when a bar code reader or ten key pad starts communication with a part or screen The contents of a message are the data itself transmitted from the bar code reader or ten key pad e The program must be coded in advance so that messages can be received from the bar code reader and ten key pad See OPENCOM Host messages A message is issued when the host computer starts communication with a part or screen The contents of a message are the data itself transmitted from the host computer CHAPTER 3 CODING RULES 3 11 Program Operation e The program must be coded in advance so that messages can be received from the host computer See OPENCOM Messages are processed in the order they are issued execution of the program
293. laration backup declaration local declaration or auto declaration are interpreted as local variables tacitly and variables are created automatically CHAPTER 3 CODING RULES 3 5 Variables Tacit variable generation as shown above is one of the features of general BASIC languages However such a feature may not be desirable for some programmers For example if an incorrect variable name is written in a program a local variable or global variable is generated automatically while the programmer does not realize it It is quite difficult to find such an error since compilation of the program cannot find it To avoid such a trouble Screen Creator 5 is capable of giving an error when it finds a variable with no declaration while it compiles a program Normally Screen Creator 5 goes not give an error When a LOCAL CHECK statement is written in a program Screen Creator 5 gives an error when it finds a variable with no declaration For details of using the LOCAL CHECK statement see Chapter 4 Instruction Reference To make programs as easy to read as possible and to minimize errors it is recommended that the LOCAL CHECK 1 statement be written at the beginning of a program to validate the error check function and all variables be declared 3 5 4 Initializing variables Screen Creator 5 can initialize a variable when it is declared To initialize a variable write an assignment statement behind declaration of the variable as shown below Exa
294. lared e Use the DIM or STRING statement to specify a non global array and a character string type E Related Item AUTO BACKUP DIM LOCAL STATIC STRING m Example of Program cont GLOBAL var float GLOBAL mojiS 50 GLOBAL xyz 10 10 end conf 4 111 GOSUB ei GOSUB Statement E Function E Format m Example of Use E Description E Related Item E Example of Program evnt X 10 GOSUI B SUI The GOSUB statement executes the specified subroutine GOSUB subroutine name GOSUB SUBO001 e Control is transferred to the subroutine specified after the GOSUB statement e Subroutine names written in the global screen and those in the program containing the GOSUB statement can be specified Use the RETURN statement to return control e If the same name exists both in the global and local subroutines the global subroutine is called RETURN B001 numdsp end evn SUB001 ab X 3 RETURN NUM000 X 4 112 CHAPTER 4 INSTRUCTION REFERENCE GOTO be a GOTO Statement E Function The GOTO statement unconditionally moves control to the specified line E Format GOTO label name m Example of Use GOTO LABEL1 E Description The GOTO statement unconditionally moves control to the line specified by label name Execution is continued from the line to which control was moved E Related Item None E Example of Program evnt if a 1 then goto Ll a 3
295. le A character integer floating point or ID type variable followed by the element s enclosed in parentheses is an array type variable Array type variables can be used by declaring their arrays in the DIM command They are usually written as follows GLOBAL VAR 2 3 VAR1 10 An array element can be usually referenced by specifying the subscript value in the parentheses The subscript starts at 0 That is VAR1 10 is an integer type array having 11 elements Array type variables can handle two three and ten dimensional arrays Note Variables followed by different symbols and are handled as different variables although their names are the same Variables are also handled as different variables depending on whether they have an array VAR VAR VAR VAR VARI 5 VAR 5 VAR 5 VAR 5 are all different variables 3 6 CHAPTER 3 CODING RULES 3 5 Variables 3 5 2 Types of Variables The variables may be classified according to the storage method and difference between the ranges of the program to which can be referred in addition to the types Global variables Static variables Backup variables Variables defined in the global declaration Global variables are the common variables that can be referenced by all the global declared BASIC programs This variable can be referenced in a program where the variable is declared as far as it is declared as a global variable When the OIP is started glob
296. left of the specified character string E Format LEFT character string number of characters LEFT registered character string number number of characters LEFT registered character string name number of characters m Example of Use A LEFT MOJI 5 A LEFT 4 10 A LEFT TOROKU 8 E Description The LEFT function returns a character string the number of bytes specified in number of characters starting from the left of the specified character string e number of characters specifies the number of bytes of the character string to be fetched with a numeric value from 0 to 255 When number of characters is 0 a null character string is returned e character string is a direct character string or a character string variable e registered character string number is the numerical expression indicating the number registered by GCSGP3 e registered character string name is the name of the character string created by GCSGP3 or the D type variable indicating the name of the character string E Related Item MID RIGHTS E Example of Program evnt bS 12345678 aS LEFTS b 3 cS LEFTS no 3 c LEFTS id 4 end evnt 4 133 LEN ee LEN Function E Function E Format E Example of Use E Description E Related Item E Example of Program len len len le end conf The LEN function returns the length of the specified character string in a number of bytes
297. lly communicate with the PLC device memory table set in the part operation parameter specification e The number of devices must match that of devices to be used by the control The devices placed in consecutive stages are used only the number of elements control name must be the primitive in the local part e If the specified control is not using the PLC device memory table an error occurs e When the control is specified in a numeric display in a doubleword the ADDCYC statement also reads it in a doubleword E Related Item CYCLIC CYCLIC2 ADDCYCID E Example of Program conf ADDCYC NUMOO00 gt Uses 2X2 as a consecutive stage display end conf evnt input types id data Displays data on the corresponding display id1l addcycid NUM000 Indicates the ID of the device being used i getoffset idl id 1 Indicates the device to be used relative to the first device id1l getid NUMOOO i Obtains the ID of the corresponding display numdsp idl data Displays the ID on the display end evnt ADDCYC2 ee ADDCYC2 Statement E Function E Format m Example of Use E Description E Related Item m Example of Program The ADDCYC2 statement enables even BASIC of a part to read the device declared in primitive name ADDCYC72 primitive name ADDCYC2 NUMO000 e The ADDCYC2 statement is almost equivalent to the ADDCYC statement e The only difference between th
298. lor number specifies the color to be displayed when the lamp display is on with a numeric value from 0 to 15 E Related Item PIPDSP m Example of Program conf pipdsp buhin graph 0 PIPCOLOR buhin graph 1 7 lampdsp buhin graph end conf 4 178 CHAPTER4 INSTRUCTION REFERENCE PIPDSP PT PIPDSP Statement E Function The PIPDSP statement displays data in the pipe display E Format PIPDSP control name pipe mode m Example of Use PIPDSP BUHIN GRAPH 1 E Description The PIPDSP statement sets the pipe display to OFF ON1 or ON2 for data display e control name is the name of the pipe display or the variable indicating the ID of the pipe display pipe mode sets the pipe display to OFF ON1 or ON2 it specifies 0 1 or 2 for OFF ON1 or ON2 e Display cannot be changed even if the PIPDSP statement is issued to the display for which the operation parameters of the control are set to effective E Related Item PIPCOLOR E Example of Program conf pipdsp buhin pip 0 PIPCOLOR buhin pip 1 7 pipdsp buhin pip 1 end conf 4 179 PLTCOLOR ee PLTCOLOR Statement E Function The PLTCOLOR statement changes the colors and background figure of the plot display E Format PLTCOLOR control name plot color tile display color background color m Example of Use PLTCOLOR GRAPH 1 1 2 1 E Description e The PLTCOLOR statement changes the background tile and colors of the plot display 1 indica
299. lor of a base line or a reference line _PD_BSCOLOR is applicable to bar graphs and line charts Specify one of the following 0 Read of base line color 1 Read of reference line 1 color 2 Read of reference line 2 color The number 0 to 15 of the read line color is returned _SW_ONKFIG reads the graphic number displayed when a switch is ON _SW_ONRHIG is applicable to switches and selector switches For a switch specify 1 For a selector switch specify the element number of the switch whose ON graphic is to be changed The element number starts at 1 The read graphic number is returned _SW_OFFFIG reads the graphic number displayed when a switch is OFF _SW_OFFFIG is applicable to switches and selector switches For a switch specify 1 For a selector switch specify the element number of the switch whose OFF graphic is to be changed The element number starts at 1 The read graphic number is returned 4 200 CHAPTER4 INSTRUCTION REFERENCE PRMSTAT eg 8 _SL_ WRITE Function Range Type Return value 9 _PD_PLOTRNG Function Range Type _SL_WRITE reads the switch write value _SL_WRITE is applicable to switches To read the write value when a switch is ON specify 1 write value when a switch is OFF specify 0 The read write value is returned To read the PD PLOTRNG writes the start and end points of displaying a line chart PD PLOTRNG is applicable to line charts Specify one of the following 0
300. lue used to determine the IO type is 0 0 The PLC is write and read enabled 1 The PLC is write inhibited If write is executed when the PLC is write inhibited an error will occur e Switches are controlled as follows The value used to determine the IO type is amp H60 When switches are simultaneously pressed the number of switches to be assumed ON can be controlled Specify the number of switches that can be simultaneously recognized in mode with a numeric value from 0 to 640 Specifying 0 inhibits switch input The switch cannot be used in this case Thus be sure to make a program in another way so that it resets prohibition of turning on the switch The number of switches specified using this command in a model with a battery backup calendar IC GCS56LC or GCS55EM is maintained even while the power is off The number of switches specified using this command in a model with no calendar IC GC53LC or GC53LM is lost when the power is turned off Therefore the number of switches must be specified in a program which is always executed when the power is turned on e A non procedure type send buffer is cleared as shown below The value for deciding the I O type is amp H41 Specify a port CH1 to CH3 for clearing the send buffer in mode Input a number between 1 and 3 E Related Item IOSTAT 4 125 IOCTL ee m Example of Program evnt input ty id dat if id swl and dat 1 then ioct
301. m evnt input type id data if type 3 then SWMODE SW2 1 SWMODE var 2 end if end evnt 4 241 SWREAD ee SWREAD Function E Function The SWREAD function reads the status of the specified switch E Format SWREAD switch name m Example of Use STATE SWREAD SW1 E Description The SWREAD function reads the status ON or OFF of the specified switch e switch name is the name assigned to the switch or the D type variable indicating the name e The CONF and part CONF block of the global screen cannot be used in the switch primitive where operation parameters are valid e The SWREAD statement cannot read the synchronous switch status of an undisplayed screen e As a result of executing this function the status of normal switches is indicated by the following numeric values 0 OFF status 1 ON status e As a result of executing this function the status of selector switches is indicated by the following numeric values 0 All selector switches are OFF Other values Numbers of the sub switches that are ON The sub switch number in the upper left end is 1 The sub switch numbers increase in the right direction They decrease in the downward direction E Related Item SWWRITE m Example of Program evnt input type id data id SW2 state SWREAD ID if state 0 then Swwrite id 1 endif end evnt 4 242 CHAPTER4 INSTRUCTION REFERENCE SWREV eg SWREV Stateme
302. m 0 to 3 For the types of line see Plotting to Straight Line of the tool e line thickness indicates the thickness of the line dot size indicates the size of the dot Specify both the line thickness and dot size with a numeric value from 0 to 2 E Related Item LINE DOT E Example of Program conf cotor Ty Oy 3 end conf evnt dot 100 200 dot 100 300 Color Te go Oh 7 10 line 100 200 100 300 end evnt 4 48 CHAPTER4 INSTRUCTION REFERENCE CONF END CONF eg CONF END CONF Statement E Function The CONF END CONF statements declare the configuration block area E Format CONF END CONF m Example of Use CONF static VAR END CONF E Description e The configuration block written in a screen and a part is executed only once when the screen is displayed This block is not executed when the screen is being displayed It is executed once again when the screen is redisplayed after another screen has been displayed e The configuration block for global screens and parts is executed only once when the system is started e Initialization blocks INIT are used to write processing such as initialization e Only the configuration block for closed parts is not executed even if a screen is displayed This configuration block is executed when a part is opened See OPEN Instruction E Related Item EVNT END EVNT INIT END INIT E Example of Program CONF static mojis END CON
303. m Example of Use STRDSP BUHIN GRAPH ABCDEF E Description e The STRDSP statement displays data in the character display e control name is the character display name or the ID type variable indicating the character display e display data is character data to be displayed in the character display e display value cannot be changed even if this statement is issued to the display for which operation parameters are set to effective in the control E Related Item STRCOLOR STRFORM m Example of Program Cont static name name STROOO end conf evnt input type id datas STRDSP name data end evnt 4 237 STRFORM i 8 STRFORM Statement E Function E Format m Example of Use E Description E Related Item E Example of Program evnt The STRFORM statement changes the display method of the character display STRFORM control name display method STRFORM HYOJIKI 0 e The STRFORM statement changes the display method of the character display control name is the character display name or the ID type variable indicating the character display e display method is the numeric value indicating any of the following three display methods 0 Left justification method 1 Centering method 2 Right justification method STRCOLOR STRDSP input type id data var buhin moji STRFORM var data strdsp var ABCDEFG end evnt 4 238 CHAPTER4 INSTRUCTION REFERENCE STR
304. m resize magnification reduction Resize is performed to make the size of the texture to be displayed match that of the texture display e control name is the graphic display name or the D type variable indicating the graphic display e The integer type value indicating whether to perform resize is set in resize specification 0 Resize is not performed 1 Resize is performed FIGCOLOR FIGDSP input ty id data if ty FIGFO else FIGFO endif figdsp end evnt 3 and data 1 then RM FIGOOO 1 RM FIGOOO 2 FIG000 figno 4 88 CHAPTER4 INSTRUCTION REFERENCE FINPUT E FINPUT Statement E Function The FINPUT statement reads data from the specified file E Format FINPUT file number variable variable m Example of Use FINPUT 12 VAR STRING E Description e The FINPUT statement reads data from the file specified by file number into the specified variable e A numeric or character string variable can be specified in variable e The following delimiters can be used when data is read into the specified variable They are not included in the variable Only comma and carriage return CR can be used as delimiters Line feed LF following CR is ignored When a numeric variable is specified a blank can also be used as a delimiter When a character string variable is specified the character string between double quotation marks is to be read If the type of data
305. me J ram m Deseriton Electronic System amp Component Dept Electronics Div Contents E Contents CHAPTER 1 INTRODUCTION ccccccccsssseeeeeeeeeeceneteeteeees 127 1 1 1 2 What is an Operation Program cceescecesceeesceseeeeeeeeeceaeeeeaeesaeesaeessaeesaeessaeeeaaeessaeeeaeesaeeseeessaeeseaeeeneeees 1 2 Objects to be Described in Operation Programs cccceceseeeseeeeeeeeeneeeseeeeeneeeeeeeeeseeeseeeeeeeseeeeteaeseaeeteatees 1 3 12 1 Operation programs fOr Parts wes sees detente ends Beene ete etree ee 1 3 1 2 2 Operation programs for screens eeceeeeeceeeeeeceeeeeeeeeaeeseaeeeeaeeseaeesaeesaaeeseaeessaeeeeaeeeeaeeseaeeeaeersas 1 3 CHAPTER 2 EXAMPLES OF PROGRAMMING 1 2 1 2 1 2 2 2 3 Creating a Part for Displaying NUMELICS cceecceeeeeeeeeeeeeeeeeeeeeeaeeeeaeeeeeeeeeaeeeeaeeeeaeeeneeeeeaeeeseeteateseaeeeneeees 2 2 221 1 SAMANGING CONTOIS sc as2scesidaceZf ese cepessnecehacsoteve des ect thie dees TE 2 4 2 1 2 Coding a programis che een eed ein ae ie 2 6 2 1 3 Drawing a figure tn a p rtra inec ceiceees Hee des peia aana eoth onesie deed aE aaeain aDeSe i REE denies 2 7 2 1 4 Saving a created Partiese s fvtises tees eaeoe aeiae asra aat tena eaaa iaei aa ea Ta iS 2 8 2 1 5 Usi g created parth ar a a a a r ae ae paare aa aa aA e a a aea ai 2 9 2 1 6 Explanation for coded program content 0 ec eeeseceeeseeeeeeeneeeeeeeeeeese
306. me full This statement only returns the write position of the reception buffer to the beginning of the variable it does not clear data in the buffer e The port to be flushed must be opened in advance by the OPENSIO statement to be explained later E Related Item OPENSIO CLOSESIO WRITESIO WRITWSIOB SETSIO E Example of Program conf global buf S 200 opensio 2 1 bufs setsio 2 amp HD end conf evnt strdsp STROOO buf FLUSH 2 closesio 2 end evnt 4 90 CHAPTER 4 INSTRUCTION REFERENCE FOPEN be FOPEN Statement E Function The FOPEN statement opens the specified file E Format FOPEN file name mode file number m Example of Use FOPEN MEMORY 2 5 E Description e The FOPEN statement opens the file to be read or written e file name specifies the name of the file to be opened The file having the name enclosed in double quotation marks is to be opened Specify the name of the file to be opened with up to eight characters When MEMORY is specified in file name internal memory is handled as a file Currently only MEMORY can be specified in file name e mode specifies the type of the file to be opened with one of the following numeric values 0 Read only file 1 Write only file 2 Read write file When file name is MEMORY the read write file is opened regardless of what value is specified in mode e file number is used when a file is read or written or when a record is set Specify file n
307. mer messages may be accumulated to cause an error E Related Item OPENTIM STARTTIM STOPTIM CLOSETIM CONTTIM READTIM m Example of Program conf static timid timid opentim SETTIM timid 20 0 starttim timid end conf evnt input type id data if type 3 then tims readtim timid numdsp NUMO00 tim 100 end if end evnt 4 224 CHAPTER4 INSTRUCTION REFERENCE SETTIME eg SETTIME Statement E Function The SETTIME statement sets the time of the built in clock E Format SETTIME hour minute second m Example of Use SETTIME 12 0 0 E Description e hour is a numeric value from 0 to 23 e minute is a numeric value from 0 to 59 e second is a numeric value from 0 to 59 e If an unexisting hour minute or second is specified an error occurs e Once time is set using the SETTIME command in a model with a battery backup calendar IC GCS6LC or GC55EM time is updated even while the power is off If a model with no calendar IC GC53LC or GC53LM is turned off the date is initialized to January 1 1998 Thursday and the time to 00 00 00 when it is turned on again The date and time are updated while the power is on E Related Item DATE GETDATE GETDATE SETDATE TIME E Example of Program evnt input type id h S m s settime h m s end evnt 4 225 SHIFT 8 SHIFT Statement E Function E Format m Example of Use E Description
308. minates E Related Item RUN PRINT E Example of Program evnt input ty id dat if ty 3 and id SWT000 then print BUHIN1 dat send B0000 endif end evnt 4 217 SETALARM et SETALARM Statement E Function The SETALARM statement sets an alarm time E Format SETALARM hour minute m Example of Use ID SETALARM 13 30 E Description e The SETALARM statement sets an alarm time in the OIP built in clock When the set alarm time is reached the data indicating this effect is transmitted to the set screen or part program Up to 16 alarms can be used e hour specifies the hour s to be set with a numeric value from 0 to 23 e minute specifies the minute s to be set with a numeric value from 0 to 59 e When the SETALARM function is executed the alarm number is returned The alarm number to be returned is an D type variable e This function can be used by the screen or part program being displayed E Related Item RESETALARM E Example of Program conf static alid alid SETALARM 10 0 end conf evnt input type id data if types 3 then resetalarm alid end if end evnt 4 218 CHAPTER4 INSTRUCTION REFERENCE SETBEEP eg SETBEEP Statement E Function E Format m Example of Use E Description E Related Item E Example of Program conf end conf evnt input The SETBEEP statement specifies the tone of a buzzer SETBEEP
309. mory as a file the capacity of that memory must be set on the system mode screen in advance e Attempting to execute the FOPEN statement for an unformatted file causes an error E Related Item FCLOSE FIELD FPUT FGET FORMAT m Example of Program cont field 5 global no global mojilS moji2s end field FOPEN MEMORY 2 5 end conf evnt end evnt 4 91 FLUSH 8 FOR TO NEXT Statement E Function The instructions between the FOR statement and NEXT statements are repeatedly executed by the specified count Format FOR variable name start value TO end value STEP increment NEXT m Example of Use FOR I 1 TO 10 A D 3 NEXT E Description e variable name after the FOR statement specifies the variable used to count how many times the FOR to NEXT loop is repeated variable name must be an integer or floating point type variable e start value indicates the initial value The value of the variable increases by the value specified in increment each time the FOR to NEXT loop is repeated No negative value can be specified in increment When the increased value of the variable is greater than end value the statement following the NEXT statement is executed e One FOR to NEXT loop can be nested E Related Item WHILE WEND SELECT CASE E Example of Program cont static VAR 10 for i 0 to 10 VAR 1 i 3 next end conf 4 92 CHAPTER4 INSTRUCTION REFERE
310. mple STATIC VAR 12 In the case of an arrangement variable the initialization data is complicated Use and to list the initialization data In the case of one dimensional arrangement write elements having subscripts which begin with 0 Example GLOBAL ARRAY 5 0 1 2 3 4 5 In the case of multi dimensional arrangement write elements so that the subscripts increase from the right Example GLOBAL ARRAY 2 3 0 1 2 3 4 4 5 6 7 8 9 10 11 GLOBAL ARRAY 1 2 3 0 1 2 3 4 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 If the type of the initialization data is different from the type of the variable the data is initialized in the variable type It is impossible to initialize ID variables Other types of variables can be initialized Initialization applies to all types of variables Note that however if initialization of backup variables is specified backup variables are initialized every time the OIP is turned on and accordingly the purpose of using backup variables i e storing values even after turning off the power is not achieved It is also possible to initialize variables into backup variables Note that however backup variables are initialized every time the OIP is activated and the purpose of using backup variables such as memorizing variable values is is not fulfilled in this case Global variables static variables and backup variables are
311. n NUMFORM var data 2 numdsp end evnt var 30 1 4 164 CHAPTER 4 INSTRUCTION REFERENCE OCT E OCT Function E Function E Format m Example of Use E Description E Related Item E Example of Program evnt The OCT function converts a decimal character string to an octal character string OCT numerical expression OCT 134 The OCT function converts a decimal character string to an octal character string e When a floating point type is specified in numerical expression the decimal character string numeric value is converted to an integer type then converted to an octal character string e Specify the decimal character string numeric value within the range from 2147483648 to 2147483647 HEX VAL input type id data mo jis strdsp end evnt OCTS data STROOO mojis 4 165 OCT fe ONFERR Statement E Function The ONFERR statement specifies the destination to which error messages are to be transmitted E Format ONFERR destination m Example of Use ONFERR BO00 E Description e The ONFERR statement specifies the destination to which file operation function error messages are to be transmitted e destination is a screen or part name or the D type variable indicating the screen or part name e When data is received by INPUT the screen or part to which a file operation function error message was transmitted can receive information such as a type 8 and data e
312. n The COS function calculates a cosine for the specified numerical expression E Format COS numerical expression m Example of Use X COS ANGLE E Description The COS function calculates a cosine value for the specified numerical expression The unit for the numerical expression is radian E Related Item ATN SIN TAN E Example of Program evnt angle 3 141592 3 x COS angle end evnt 4 53 CURDIR es CURDIR Statement E Function The CURDIR statement makes a character string indicating the current directory path name into a character string variable E Format CURDIR character string variable E Example of Use CURDIR PATH E Description A full path name including a drive name should be written E Related Item DIR CHDIR MKDIR RMDIR E Example of Program cont strdsp str curdir end conf evnt input types id data if data 1 then curdir paths strdsp dsp str paths end if end evnt 4 54 CHAPTER 4 INSTRUCTION REFERENCE CVBS eg CVB Function E Function The CVB function allocates data from any position of a character string variable E Format CVB character string variable name allocation position E Example of Use VAR CVB MOJI 5 E Description e The CVB function allocates data one byte from the specified allocation position of the specified character variable name The allocated data is regarded as an integer value e allocation position must be an integer or floating
313. name color number E Example of Use LAMPCOLOR BUHIN GRAPH 5 E Description The LAMPCOLOR statement changes the ON display color of the lamp display e display name is the name of lamp display or the D type variable indicating the lamp display e color number indicates the color displayed when the lamp display is ON Specify this color number with a numeric value from 0 to 15 E Related Item LAMPDSP E Example of Program conf lampdsp buhin gpaph 0 LAMPCOLOR buhin gpaph 7 lampdsp buhin gpaph 1 end conf 4 131 LAMPDSP i 8 LAMPDSP Statement E Function E Format m Example of Use E Description E Related Item m Example of Program evnt input var The LAMPDSP statement indicates whether the lamp display is ON or OFF LAMPDSP control name lamp mode LAMPDSP BUHIN GRAPH 1 The LAMPDSP statement indicates whether the lamp display is ON or OFF e control name is the name of lamp display or the ID type variable indicating the lamp display e lamp mode indicates whether the lamp display is ON or OFF When lamp mode is 0 the lamp display is OFF When 1 the lamp display is ON e display value cannot be changed even if this statement is issued to the control for which operation parameters are set to effective in the control LAMPCOLOR type id data buhin graph LAMPDSP var data end evnt 4 132 CHAPTER 4 INSTRUCTION REFERENCE LEFT pe LEFT Function
314. nce 0 Normal timer 1 Interval timer e If one second or lower is set as the time limit in the interval timer messages may be accumulated to cause an error E Related Item OPENTIM STARTTIM STOPTIM CLOSETIM CONTTIM READTIM m Example of Program conf static timid timid opentim SETTIM timid 20 0 starttim timid end conf evnt input type id data if type 3 then tims readtim timid numdsp NUMO00 tim 100 end if end evnt 4 224 CHAPTER4 INSTRUCTION REFERENCE SETTIME eg SETTIME Statement E Function The SETTIME statement sets the time of the built in clock E Format SETTIME hour minute second m Example of Use SETTIME 12 0 0 E Description e hour is a numeric value from 0 to 23 e minute is a numeric value from 0 to 59 e second is a numeric value from 0 to 59 e If an unexisting hour minute or second is specified an error occurs e Once time is set using the SETTIME command in a model with a battery backup calendar IC GCS6LC or GC55EM time is updated even while the power is off If a model with no calendar IC GC53LC or GC53LM is turned off the date is initialized to January 1 1998 Thursday and the time to 00 00 00 when it is turned on again The date and time are updated while the power is on E Related Item DATE GETDATE GETDATE SETDATE TIME E Example of Program evnt input type id h S m s settime h m s end e
315. ncom HST 2 30 CHAPTER2 EXAMPLES OF PROGRAMMING 2 3 Creating a Part to be Linked to an External Device end conf evnt input type S id data if type t 22 then numdsp NUM000 data end if end evnt Initialization Block The opencom instruction is written in the Configuration Block opencom HST The opencom instruction declares receiving of messages from external devices Specify the following external device names after the opencom instruction HST Host computer BCR Bar code reader TKY Ten key pad Configuration Block Nothin is processed Event Block input type s id data The input instruction reads messages from the host computer if type 22 then end if The condition type 22 put after if means a message from the host computer If the message is transmitted from the host computer the statement following then will be executed numdsp NUM000 data This block displays data on the numeral display A numeric value from the host is input in data in this block This program ends here The configuration block of this program receives a message from the host and the event block displays the numerical data in the message from the host Note For how to send data from the host computer refer to the Communication Manual 2 31 2 4 Creating a Part for Controlling Others 2 4 Creating a Part for Controlling Others 2 4 1 Part for calling others from touch
316. nction E Function The OPENTIMS3 function allocates opens the timer to be used E Format RET OPENTIM3 timer number m Example of Use RET OPENTIM3 14 E Description e The OPENTIM3 function opens the timer specified in timer number e timer number specifies the number of the timer to be used Specify this timer number with an integer type value from 0 to 15 e When the OPENTIM2 function is executed any of the following value is returned 0 The timer could be opened 1 The timer could not be opened e When the screen for which open was declared changes to another the opened timer is automatically closed e The OPENTIM3 function can be used by the screen or part program being displayed If this function is executed on an undisplayed rear screen an error occurs E Related Item CLOSETIM STARTTIM STOPTIM CONTTIM SETTIM READTIM OPENTIM E Example of Program cont ret opentim3 3 settim 3 20 1 stoptim 3 closetim 3 end conf 4 173 OUT ee OUT Statement E Function The OUT statement writes 2 byte data to an I O port E Format OUT port number output data m Example of Use OUT 0 amp H20 E Description e Currently data can be written only to parallel I O ports port number specifies the number of the I O port inserted into the option bus For the color plasma this port number is fixed at 0 E Related Item INP m Example of Program evnt input type id data out 0 data end evnt 4
317. nding patent applications copyrights or other intellectual property rights covering subject matter in this manual The furnishing of this manual does not give you any license to these patents or other intellectual property rights And we do not have any responsibility on troubles involved in the patents and other intellectual rights caused by the use of this manual Contact us at the following place concerning other unclear points in this manual Customer Support Group Electronics System Division Komatsu Ltd Address 4 20 1 Kamata Ota ku Tokyo Japan Telephone 81 03 5711 1838 Facsimile 81 03 5711 1840 E MAIL _ panel el komatsu co jp vii Version Up Version Up Koyo Ltd has upgraded Screen Creator 5 for adding new functions operationability and so forth Below will be introduced the updated functions 1 Version 2 10 Supporting middle size systems GC53 of GCSx Series Adding the uploading editing function To make this function effective attach all screen data and K Basic programs used in the project and download them to the panel Then download the uploaded entities from the panel and restore them Then you can edit the data and programs Note that the data with the project attached increase their size The following PLCs have been added Omron SYSMAC a Fuji Dennki FLEX PC NJ T NS T Fuji Dennki Computer link protocol Fuji Dennki Loader command protocol Toyota Koki PC1 Toyota Koki PC3 Matsushita Ele
318. nf evnt nos 1 mojilS product name moji2S product number size SOF 5 mepy 5 buff writesiob 1 size buffs end evnt 4 229 SOR pe _______e SQR Function E Function The SQR function calculates a square E Format SQR numerical expression m Example of Use X SQR Y E Description e The SQR function calculates a square for the specified numerical expression numerical expression must be a numeric value greater than or equal to 0 E Related Item None E Example of Program evnt x SOR a 2 b 2 numdsp NUMOOO X end evnt 4 230 CHAPTER4 INSTRUCTION REFERENCE STARTTIM be STARTTIM Statement E Function The STARTTIM statement starts the operation of the specified timer E Format STARTTIM timer number m Example of Use STARTTIM ID STARTTIM VAR E Description e The STARTTIM statement starts the operation of the specified timer The timer starts increment from 0 e timer number is the D type variable indicating the number of the timer that starts increment or an integer type variable from 0 to 15 E Related Item OPENTIM STOPTIM CONTTIM CLOSETIM SETTIM READTIM m Example of Program conf static timid timid opentim settim timid 20 0 STARTTIM timid end conf evnt input types id data if types 3 then tims readtim timid numdsp NUMO00 tim 100 end if end evnt 4 231 STATIC fee STATIC
319. ng number is the numerical expression indicating the number registered by GCSGP3 e registered character string name is the name of the character string created by GCSGP3 or the D type variable indicating the name of the character string e When number of characters is 0 or when start position is greater than the number of bytes of the specified character string a null character string is returned E Related Item LEFT RIGHT E Example of Program evnt input type id data a mid data 3 3 strdsp STR000 a end evnt 4 151 MKB a l MKB Statement E Function The MKB statement stores data in any position of a character string variable E Format MKB character string variable name storage position integer value E Example of Use MKB MOJI 5 VAR E Description E Related Item E Example of Program conf end conf evnt The MKB statement stores one low order byte of integer value in the position specified by storage position starting from the beginning of the specified character string variable name storage position must be a integer or floating point type variable or constant 1 specifies the beginning of the character string variable integer value specifies an overwriting value it must be an integer or floating point type variable or constant When specified in integer value a floating point type variable or constant is converted to an integer One low order byte of this value overwrites t
320. nt E Function E Format m Example of Use E Description E Related Item E Example of Program evnt The SWREV statement sets whether to reverse the display of the specified switch when the switch status changes SWREYV switch name operation SWREV SW2 0 e The SWREV statement sets whether to reverse the display of the specified switch when the switch on the touch panel is pressed or the status is changed e switch name is the name assigned to the switch or the D type variable indicating the name e The CONF and part CONF block of the global screen cannot be used in the switch primitive where operation parameters are valid e operation indicates whether to reverse the display of the switch with the following numeric values 0 The display of the switch is not reversed 1 The display of the switch is reversed None input type id data if type 3 and id SWT000 then id SW2 SWREV id 1 endif end evnt 4 243 SWWRITE ee SWWRITE Statement E Function The SWWRITE statement changes the status of the specified switch E Format SWWRITE switch name status m Example of Use SWWRITE SW1 1 Description The SWWRITE statement changes the status ON or OFF of the specified switch even if the switch on the touch panel is not pressed When the status is changed the data indicating the status is transmitted to the part program on which the switch is placed e switch name is the name assigned
321. nted e If an unexisting port or BIT number is specified 0 is returned E Related Item INP OUT INPBIT OUTBIT OUTSTAT m Example of Program evnt data outbitstat 0 3 if data 0 then outbit 0 3 1 endif end evnt 4 176 CHAPTER4 INSTRUCTION REFERENCE OUTSTAT eg OUTSTAT Function E Function The OUTSTAT function reads the value of the specified output port E Format OUTSTAT port number m Example of Use DATA OUTSTAT 0 E Description e The OUTSTAT function reads the value of the specified output port e Specify port number with an integer value relative to 0 e If an unexisting port number is specified 0 is returned E Related Item INP OUT INPBIT OUTBIT OUTBITSTAT E Example of Program evnt datas outstat 0 if data 0 then out 0 amp hfffFf endif end evnt 4 177 PIPCOLOR ee PIPCOLOR Statement E Function The PIPCOLOR statement changes the OFF ON1 and ON2 colors of the pipe display E Format LAMPCOLOR display name ON OFF number color number m Example of Use LAMPCOLOR BUHIN GRAPH 5 E Description The PIPCOLOR statement changes the OFF ON1 and ON2 colors of the pipe display e display name is the name of the pipe display or the variable indicating the ID of the pipe display e ON OFF number specifies 0 1 or 2 for OFF ON1 or ON2 e color number specifies the color to be displayed when the lamp display is on with a numeric value from 0 to 15 E
322. number starts at 1 e tile 1 indicates the tiling figure of the bar Specify this tiling figure with a numeric value from 0 to 15 e display color 1 is a numeric value indicating the color number of the tile display section Specify this color number with a numeric value from 0 to 15 e background color 1 is a numeric value indicating the color number of the tile background section Specify this color number with a numeric value from 0 to 15 e tile 2 indicates the background tiling figure of the bar graph Specify this tiling figure with a numeric value from 0 to 15 e display color 2 is a numeric value indicating the color number of the tile display section of the background Specify this color number with a numeric value from 0 to 15 e background color 2 is a numeric value indicating the color number of the tile background section of the background Specify this color number with a numeric value from 0 to 15 E Related Item BARDSP BARSHIFT 4 18 CHAPTER4 INSTRUCTION REFERENCE BARCOLOR PT m Example of Program conf static name name BAROOO end conf evnt input types id data if types 3 then barcolor name 2 2 3 1 4 5 2 end if end evnt BARDSP pee BARDSP Statement E Function The BARDSP statement displays data in the bar graph display E Format BARDSP control name bar number display value m Example of Use BARDSP BARO00 1 30 E Description e The BARDSP statement displays
323. o be displayed in the plot display e display value cannot be changed even if this statement is issued to the display for which operation parameters are set to effective in the control PLTCOLOR E Example of Program conr static name name PLTOOO end conf evnt input types id x y if types 3 then PLTDSP name x y endif end evnt 4 181 PMODE es PMODE Statement E Function E Format E Example of Use E Description E Related Item E Example of Program evnt The PMODE statement changes the status of the specified part PMODE part name mode PMODE BUHIN 3 e part name is the name of the part whose status is to be modified or the D type variable indicating the part e mode indicates the status to be modified 0 Normal status 1 Switch input disable status 2 Half tone status PSTAT input types id data if pstat BUHIN 0 then PMODE BUHIN 1 endif end evnt 4 182 CHAPTER4 INSTRUCTION REFERENCE PRDSP eg PRDSP Statement E Function The PRDSP statement redisplays the specified control E Format PRDSP control name E Example of Use PRDSP BUHIN PRIM E Description e control name is the name of the control to be redisplayed or the ID type variable indicating the control E Related Item BARSET CIRSET BLTSET LNESET E Example of Program evnt lneset buhin graph 3 8 20 1 lneset buhin graph 3 8 20 1 P
324. oating point type variable or constant is converted to an integer One low order byte of this value overwrites the specified character string variable name MKS MKW MKI MKF MKID CVB CVW CVI CVF CVID orgS 1234567 strdsp MKB orgS strdsp end evnt STROOO orgs 2 amp H39 STROO1 org 4 152 CHAPTER4 INSTRUCTION REFERENCE MKDIR eg r MKDIR Statement E Function The MKDIR statement creates a directory E Format MKDIR directory name m Example of Use MKDIR TEST E Description e The MKDIR statement is an instruction for creating a subdirectory e Specify the directory to be created with a character string constant or variable e The directory to be created can be specified in directory name together with a drive name E Related Item RMDIR CHDIR DIR m Example of Program conf end conf evnt MKDIR C TEST end evnt 4 153 MKF 8 MKF Statement E Function The MKF statement stores data in any position of a character string variable E Format MKF character string variable name storage position real value E Example of Use MKF MOJI 5 VAR E Description E Related Item m Example of Program conf end conf evnt The MKF statement stores fours bytes of real value in the position specified by storage position starting from the beginning of the specified character string variable name storage position must be a integer or floating point type
325. ocal variable is initialized every time the block is executed A variable name can be specified in a normal variable arrangement variable or character string variable DIM declaration or STRING declaration is not needed to declare an arrangement variable or character variable The LOCAL statement is one of the new features of Screen Creator 5 added for distinctive declaration of local variables DIM can substitute for LOCAL However use LOCAL as far as possible in Screen Creator 5 STRING can be used instead of LOCAL to specify a size of a character string variable However use LOCAL as far as possible in Screen Creator 5 AUTO BACKUP DIM FUNCTION GLOBAL STATIC STRING global float 5 LOCAL i for i tO 5 float i i 3 next end conf 4 142 CHAPTER 4 INSTRUCTION REFERENCE LOCALCHECK be LOCALCHECK Statement E Function The LOCALCHECK statement controls the level of warning messages output by the compiler E Format LOCALCHECK warning level m Example of Use LOCALCHECK 1 E Description e The LOCALCHECK statement specifies whether or not to output a warning if local and global variables functions and or subroutines are used vaguely in a program e Two warning levels are available as shown below 1 A warning is output 0 No warning is output e Three types of warnings are available as shown below 1 Ifa variable not declared is used in a program In this case the compiler regards such a variable as a lo
326. ock to OFF e When the interlock is ON the system mode screen is not displayed even if two dots on a diagonal line are pressed When power is ON the system mode screen is not displayed even if the upper left edge on the screen is pressed e When lock is activated it must be reset by a program Make a program so that it resets lock securely e A mode specified using the INTERLOCK command in a model with a battery backup calendar IC GC56LC or GC55EM is maintained even while the power is off A mode specified using the INTERLOCK command in a model with no calendar IC GC53LC or GC53LM is lost when the power is turned off Therefore a mode must be specified in a program which is always executed when the power is turned on None INTERCLOCK 1 end conf evnt input tp if id end evnt 1id dat sw the interlock 0 4 124 CHAPTER4 INSTRUCTION REFERENCE IOCTL eg IOCTL Statement E Function The IOCTL statement controls the I O device connected to the OIP E Format IOCTL I O type mode m Example of Use IOCTL 0 0 E Description e Write the integer value indicating the I O device to be controlled in l O type Currently the type of I O device that can be controlled are the PLC switch and non procedure transmission buffer e mode is the integer value indicating how the I O device is controlled e When controlling the PLC specify one of the following values indicating how the PLC is controlled in mode The va
327. oecce eee eh cn hoe 4 110 4 2 CHAPTER4 INSTRUCTION REFERENCE 4 1 Instruction Reference GLOBA D rcino o a O 4 111 GOSUB rer EE E 4 112 NUMCOLOR 0 cecccecseccesceeseescescesessceacens 4 161 GOTO oes il dices san daceaded debe ieceheds sis cagte ss EEA 4 113 NUMD SBiiss crs a ke corte ae 4 162 INUIMIOR Missi this ssdssanasestenuavannasatednceass 4 163 HEX Penina enaa eaen 4 114 OCTO r a A a a aatia 4 164 IFE THEN ELSE erosa onran sss 4 115 ONFERR veiininccesarssaneanararsandieatouecsat S 4 165 INT END INi e nenet 4 116 OPEN foes eta areo E R E EEA 4 166 INP E E AE EET 4 117 OPENCOM cisicieceste thet leaarchathedeeeetslaeteiatadet 4 167 INPB I i scasis dese eee et ies 4 118 OPENPARALLEL cceeccescceceeseeeeeeeeneees 4 168 INPUT ieee a ea a aE EErEE 4 119 OPENSIO niiina aA 4 169 INSTR oreen ie eeen ersan eoero 4 121 OPEN TIM vaene ienee 4 170 NEn a e a e E nen et Bacal 4 122 OPENTIM ra ea erea en a er eek 4 171 INTERLOCK orent 4 123 OPENTIM 3 zerean aes 4 172 JOCTLE inio a E 4 124 OUT ccastds vnctevsvdccacvossnipep ave aduserbennperebosokite 4 173 TOC TE 2 arana a ee ede 4 126 OUTBIT 4 03 deta ide tet ed wen 4 174 TOS TA Ti NE AE 4 127 OUTBITSTA sacectessticeeseteseeesens cee saselvelslests 4 175 OQUTSTAT 33 cosie totaal eek ees 4 176 JUMP A EEE RS 4 128 PIPCOLOR airna ae Ren ai 4 177 Jai D E A ETE eh ENEN 4 129 PIPRDS Pesne ieas ah ie ste iets 4 178 PLT COLOR mrii teenoor cer iine 4 179 LAMPCOLOR O 4 130 PETDSP aeea
328. ol name request code control value 1 PRMCTL2 control name request code type 1 control value 1 PRMCTL3 control name request code type 1 control value 2 PRMCTL4 control name request code type 1 type 2 control value 1 m Example of Use PRMCTLI1 NUMO000 _PD_STAT 3 PRMCTL2 NUMO000 _PD_DCOLOR 3 4 PRMCTL3 LNE000 _PD_RANGE 0 2 5 PRMCTL4 BARO00 _PD_PTRN 1 0 12 E Description e The PRMCTL statement changes the attributes of the specified control This statement is classified into four types PRMCTL1 PRMCTL2 PRMCTL3 and PRMCTL4 control name is the constant indicating the control to be changed or the D type variable indicating the ID of the control request code specifies what attribute changes is to be performed The types of request codes are shown on the next and subsequent pages type 1 and type 2 depend on the request code to be specified control value 1 specifies the value corresponding to the specified request code it must be an integer type constant or variable control value 2 specifies the value corresponding to the specified request code it must be a floating point constant or variable E Related Item PRMCTL1 PRMCTL2 PRMCTL3 PRMCTL4 PRMSTAT1 PRMSTAT2 PRMSTAT3 PRMSTAT4 E Example of Program conf end conf evnt status prmstatl NUMO00 _PD_STAT if status 0 then PRMCTL1 NUMO00 _PD_STAT 2 endif end evnt 4 186 CHAPTER4 INSTRUCTION REFERENCE PRMCTL eg e The types
329. ont global buffer opensio 2 0 buffers setsio 2 10 end conf evnt input type id port status bytes if type 7 then moji left buffer bytes 1 strdsp STROOO mois end if end evnt 4 121 INPUT 8 INSTR Function E Function E Format m Example of Use E Description E Related Item E Example of Program evnt aS t p ins specified p ins string number end evnt tr 1 aS company tr 1 num ab The INSTR function retrieves character strings to find the specified character string When the specified character string is found the function notifies the system of the start position of the character string INSTR start position character strings to be retrieved character string to be found A INSTR 10 MOJI1 MOJI2 e The INSTR function retrieves the character strings specified in character strings to be retrieved to find the character string specified in Character string to be found This retrieval starts at the start position specified in start position When the specified character string is found the function notifies the system of the position in a number of bytes relative to the beginning of the character strings to be retrieved If the specified character string is not found 0 is set e start position is 1 when retrieval starts at the beginning of character strings e Character string variables direct character strings registration character
330. ontrol GAMEN BUHIN PRIM BUHIN Example of using periods to represent decimal points 1 23 0 01 amp amp 0 amp H amp and amp 0 are used to represent an octal number amp H is used to represent a hexadecimal number amp 7 octal notation represents 7 in decimal notation amp 10 and amp 010 octal notation represent 8 in decimal notation amp H20 hexadecimal notation represents 32 in decimal notation Used to represent the types of variables or functions These special characters are added to the ends of variable names or function names Represents an integer type variable VAR Represents a character type variable MOJI l Represents a floating point type variable FLOAT Represents an ID type variable ID Tilde 7 Used to delimit a station number and a PLC device name 00 D100 00 is a station number and D100 is a PLC device address i Cc a Used when operation parameters are written conf cyclic station number connected device address end conf Apostrophe Symbol for indicating the start of acomment The portion from this symbol to the end of a line is treated as a comment An apostrophe is used as follows conf global var 3 2 This is the declaration of a variable end conf aaa Used to delimit a label A label is used as a GOTO jump destination or a subroutine name evnt if var 0 then goto LABEL aa bb 1 LABEL aa 10 end evnt 3 3 3 3 Constant
331. or modified e Event communication is executed by a K BASIC program Event communication can also be used to write data to a device In the OIP a global screen and a local screen are displayed overlapping each other In this case communication between the global and local screens is performed as follows Global screen communication e Cyclic communication in a global screen is always executed irrespective of the local screen to be used Local screen communication e Only the cycle communication declared in the current screen can be used e Event communication is performed when the contents of a device are read or written during execution of the program being displayed on the current screen e If a program of a screen not displayed currently is activated and device reading or writing is executed data may be read or written from into a device not specified in the program To avoid such a trouble write a program so that device reading or writing will never be executed in a program of a screen not displayed For example messages are sent to programs of non displayed programs in timer alarm or graph sampling Thus device reading or writing should be prevented in programs containing event blocks which process these messages If device reading or writing is necessary for message processing execute it in a global screen program 3 24 CHAPTER3 CODING RULES 3 15 Memory Tables 3 15 Memory Tables A memory table is used for communicat
332. ort e The port number to be specified depends on the option board inserted into the option bus A numeric value from 0 to 3 can be specified in port number E Related Item OUT E Example of Program evnt vars inp 0 if var and 1 1 then var 0 OUT 0 var end evnt 4 117 INPBIT fee INPBIT Function E Function The INPBIT function reads the specified BIT number from the specified input port E Format INPBIT port number BIT number m Example of Use DATA INPBIT 0 10 E Description e The INPBIT function reads the specified BIT number from the specified input port e Specify port number and BIT number with an integer value relative to 0 e The lowest order bit number of the parallel IO is O and the next lowest order bit number is 1 That is the BIT number is sequentially incremented e If an unexisting port or BIT number is specified 0 is returned E Related Item INP OUT OUTBIT OUTBITSTAT OUTSTAT m Example of Program evnt data INPBIT 0 3 if data 0 then outbit 0 3 1 endif end evnt 4 118 CHAPTER4 INSTRUCTION REFERENCE INPUT eg INPUT Statement E Function The INPUT statement reads the data transmitted to a screen or part into the specified variable s E Format INPUT variable name variable name m Example of Use INPUT V1 ID DATA E Description e The INPUT statement reads the data transmitted to a screen or part e The integer value indicating the type of th
333. ove unit is specified in dots X must be a numeric value from 0 to 639 Y must be a numeric value from 0 to 399 GCS55EM or 0 to 479 GCS56LC For absolute move move method is 0 For relative move move method is 1 Absolute move is referenced to the upper left end on the display screen Relative move is referenced to the position of the current part E Related Item None m Example of Program evnt input type id data if type buhin 3 then buhin2 MOVE buhin 10 10 OQ endif end evnt 4 159 MTRCOLOR es MTRCOLOR Statement E Function The MTRCOLOR statement changes the needle color of the meter display E Format MTRCOLOR display name color number m Example of Use MTRCOLOR MTROOO 1 E Description e The MTRCOLOR statement changes the needle color of the meter display e control name is the meter display name or the D type variable indicating the meter display e color number is the number indicating the needle color Specify this color number with a numeric value from 0 to 15 m Related Item MTRDSP E Example of Program evnt input types id mcolor MTRCOLOR MTROOO mcolor end evnt 4 160 CHAPTER4 INSTRUCTION REFERENCE MTRDSP be MTRDSP Statement E Function The MTRDSP statement displays data in the meter display E Format MTRDSP control name display data m Example of Use MTRDSP BUHIN GRAPH 30 0 E Description e The MTRDSP statement displays data value in the meter display
334. ow the message sender s type message sender s ID and data If the condition is satisfied in the if and end if statements the display of the Number indicator control changes First the input instruction will be explained The input instruction can read various information from messages The standard usage of the input instruction is given below input type id data 2 1 Creating a Part for Displaying Numerics In this example the statement reads the type and ID of sender and data as explained below type The number indicating sender s type For example if the message is send by a switch itis set to 3 If itis send by a PLC itis setto 16 For details refer to 3 2 Message format reference id The identification ID of sender For example if the message is send by a switch it is set to the name of the switch The ID is written in order of the screen name the part name and the control name delimiting each by a period Example GAMEN BUHIN NUMOO0O This ID is called an ID type constant it is specific to K Basic You can also handle the ID as a variable by adding a after the variable just like id Note A message contains sender s type ID and data in order data Data written by sender For example if the switch is ON itis setto 1 If the switch is OFF it is set to 0 Next line is if and end if statements if type 3 and id SWTO0OO and d
335. panel This part is opened here Create part open switch Control to use One Switch control SWT000 Exterior view of part Figure Lamp control Switch control SWTO000 A program of a part for calling other parts from the touch panel is given below init local type id data end init conf end conf evnt input type id data if type 3 and id SWT000 and data 1 then 2 32 CHAPTER2 EXAMPLES OF PROGRAMMING 2 4 Creating a Part for Controlling Others open name of part to be opened 1 end if end evnt Initialization Block Nothing is processed except that the block declares local variables Configuration Block Nothing is processed Event Block input type id data The input instruction reads messages from the switch control if types 3 and id SWT000 and data 1 then end if The portion indicates that the program between the if and end if statements is executed when the switch is pressed open name of part to be opened 1 The open instruction changes the part state specified by ID from close to open If the numerical value following the part name is 1 the Configuration Block of the opened part is executed when the part opens If the value is 0 the Configuration Block is not executed This block uses an operation parameter for allowing a called part to be changed easily This program ends here The configuration block of the part specified in
336. ple of Program conf end conf evnt org S 1234567 data CVID org 1 end evnt 4 58 CHAPTER 4 INSTRUCTION REFERENCE CVW a CVW Function E Function The CVW function allocates data from any position of a character string variable E Format CVW character string variable name allocation position E Example of Use VAR CVW MOJI 5 E Description e The CVW function allocates data two bytes from the specified allocation position of the specified character variable name The allocated data is regarded as an integer value e allocation position must be an integer or floating point type variable or constant 1 specifies the beginning of the character string variable e A cut out value is converted into a 86 series boundary E Related Item MKS MKB MKW MKI MKF MKID CVB CVI CVF CVID E Example of Program conf end conf evnt orgs 1234567 data CVW org 3 numdsp NUM000 data Displays amp H3433 end evnt 4 59 CYCLIC 8 CYCLIC Statement E Function E Format m Example of Use E Description E Related Item The CYCLIC statement declares that the contents of the specified device or memory table are periodically read CYCLIC device name device name device name number CYCLIC memory table name memory table name memory table name number CYCLIC 00 DO1 00 D10 5 CYCLIC 00 MTBL 100 OO MTBL 200 10 e The CYCLIC statement periodic
337. ple of Program conf cyclic2 end conf evnt The CYCLIC2 statement declares that the contents of the specified device are periodically read as a doubleword CYCLIC2 device name device name device name number CYCLIC2 00 D01 00 D10 5 e The CYCLIC2 statement is the same as the CYCLIC statement except that the contents of the device are read as a doubleword e The word having a larger device number is the high order word e No memory table can be declared e When the screen is switched a message is issued to all the parts for which CYCLIC2 is declared INPUT CYCLIC OO d0O1l OO d7 3 input ty id dat if id numdsp end if end evnt 007 dO0l num then dat 4 62 CHAPTER4 INSTRUCTION REFERENCE DATE Eeee i DATE Function E Function The DATE function reads the current date E Format DATES m Example of Use MOJI DATE E Description e The year month and day of the current date to be read are each represented in two digits like YY MM DD The DATE function cannot be used to set a date e Once date is set using the SETDATE command in a model with a battery backup calendar IC GCS56LC or GCS5EM the date is updated even while the power is off If a model with no calendar IC GC53LC or GC53LM is turned off the date is initialized to 98 01 01 and the time to 00 00 00 when it is turned on again The date and time are updated while the power is on E Related It
338. ple of Use CHDIR C TEST E Description e The CHDIR statement is an instruction that changes the current directory and a drive e Specify the directory to be changed with a character string constant or variable e directory name can be specified starting from a drive name E Related Item MKDIR RMDIR m Example of Program conf end conf evnt CHDIR AAG gt Changes the drive CHDIR TEST Changes the directory CHDIR E ABC gt Changes both the drive and directory 4 35 CHKTIM A CHKTIM Function E Function The CHKTIM function checks the status of the specified timer E Format RET CHKTIM timer number m Example of Use RET CHKTIM 14 E Description e The CHKTIM function checks whether the specified timer is being used opened e timer number indicates the number of the timer to be checked it must be an integer type value from 0 to 15 e As a result of executing this function any of the following values is returned 0 The timer is not being used 1 The timer is being used by the local program 2 The timer is being used by a remote program E Related Item CLOSETIM STARTTIM STOPTIM CONTTIM SETTIM READTIM OPENTIM OPENTIM2 E Example of Program evnt fOr i 0 6 15 ret CHKTIM i if ret 0 then i 15 next end evnt 4 36 CHAPTER4 INSTRUCTION REFERENCE CHR Eo CHR Function E Function The CHR function assigns the character corresponding to
339. plicable to plot and line chart displays The maximum number of plots that can be displayed is returned _PD_LNENUM reads the number of bars and lines that can be displayed on the control _PD_LNENUM is applicable to plot and line chart displays The maximum number of bars and lines that can be displayed is returned _PD_ZNNUM reads the number of zones that can be displayed on the control _PD_ZNNUM is applicable to pie chart and 100 percent bar chart displays The number of zones that can be displayed is returned _PD_FIGMD reads whether to match the size of the graphic to be displayed on a graphic display with that of the display _PD_FIGMD is applicable only to graphic displays When matching the size of the graphic with that of the graphic display set 1 When not matching the size of the graphic with that of the graphic display set 1 _PD_WSIZ reads the dot size or line width of a control _PD_WSIZ is applicable to plot meter and pipe displays For a plot display the numeric value 0 to 2 indicating the dot size small to large is returned For a meter display the numeric value 0 to 2 indicating the line width narrow to wide is returned For a pipe display the numeric value 0 to 3 indicating the thickness 1 3 5 or 7 is returned _PD_PIPSTAT reads the ON or OFF status of a lamp or pipe display _PD_PIPSTAT is applicable to lamp and pipe displays Any of the following values indicating the ON or OFF status o
340. point type variable or constant 1 specifies the beginning of the character string variable E Related Item MKS MKB MKW MKI MKF MKID CVW CVI CVF CVID m Example of Program conf end conf evnt orgs 1234567 data CVB org 3 numdsp NUM000 data gt Displays 51 amp H33 end evnt 4 55 CVF E CVF Function E Function Format m Example of Use E Description E Related Item m Example of Program conf end conf evnt orgs strdsp m strdsp datas n umdsp end evnt The CVF function allocates data from any position of a character string variable CVF character string variable name allocation position VAR CVF MOJI 5 e The CVF function allocates data four bytes from the specified allocation position of the specified character variable name The allocated data is regarded as a real value e allocation position must be an integer or floating point type variable or constant 1 specifies the beginning of the character string variable e The CVF function returns a real number e A cut out value is converted into a 86 series boundary MKS MKB MKW MKI MKF MKID CVB CVW CVI CVID WNIT2Z 345672 STROOO org Kf orgs 2 1423 STROO1 org The character string will not be displayed correctly CVE org 2 NUM000 data Displays 1 23 4 56 CHAPTER4 INSTRUCTION REFERENCE CVI E CVI Function E Function The CVI funct
341. points purged from the line chart are returned as a result of the shifting control name is the line chart name or the D type variable indicating the line chart e line number is the value indicating which line in the line chart display is to be shifted This line number starts at 1 e When shift direction is 1 line chart data is shifted left and above When shift direction is 1 line chart data is shifted right and below e display data indicates the data to be displayed in the vacant area produced as a result of the shifting E Related Item LNEDSP LNECOLOR LNESHIFT PRDSP m Example of Program evnt input type S id data if data gt 0 then abc Ineshift2 LNEOOO 1 1 0 else abc lneshift2 LNEOOO 1 1 100 endif prdsp LNEQOOO end evnt 4 141 LOCAL 8 LOCAL Statement E Function E Format m Example of Use E Description E Related Item E Example of Program con I The LOCAL statement defines a local variable LOCAL variable name variable name LOCAL VAR XYZ 2 3 MOJI 20 The LOCAL statement defines a variable defined in variable name as a local variable A local variable can be read and written only in a program where it is declared The compiler gives a warning if an undefined local variable is used Each local variable is initialized every time the block is executed A variable name can be specified in a normal va
342. put CI if type t types EL 3 id data 3 and data 1 then OSEPARALLEL 3 else R endif end evnt if types 3 and data 0 then FOPENPARALLEL 3 4 169 OPENTIM ee OPENSIO Statement E Function The OPENSIO statement opens a non protocol communication port E Format OPENSIO port number mode reception buffer m Example of Use OPENSIO 1 1 moji E Description The OPENSIO statement opens a port for starting non procedual communication port number specifies a channel that performs non procedual communication CH1 to CH3 correspond to 1 to 3 respectively mode specifies the type of non procedual communication Specify 0 binary mode or 1 text mode reception buffer specifies the name of the variable to which the data to be received from an external device is to be written The variable to be specified must be a global or static character string variable When the condition is satisfied after data has been received from a connecting device a reception completion message is issued to the part or screen that executed this statement Two or more parts cannot execute the OPENSIO statement for the same port Binary mode In the binary mode all codes from 0 to OFFh can be transmitted and received In this mode read and write are also enabled by specifying the length of received data Text mode In the text mode codes from 1 to OFFh can
343. r ID variable is initialized to a blank A local variable is declared as shown below LOCAL VAR Auto variables denote variables defined by auto declarations AUTO Auto variables can be defined and referred to in functions only Auto variables are initialized every time functions are executed Each integer variable or real number variable is initialized to 0 Each character variable or ID variable is initialized to a blank An auto variable is declared as shown below AUTO VAR 3 5 3 Checking variable types and variable interpretation 3 8 in compilation When screen data is created the compiler executes syntactic analysis and processing of the program If the program contains global declaration static declaration or other distinctive declaration processing is executed according to such declaration In some cases the type is interpreted and processing is done tacitly If you do not keep such tacit interpretation in mind as a rule of writing programs programs may not function as you expect This section describes which types are interpreted tacitly 1 Variables contained in screen programs on global screens not defined by global declaration static declaration or backup declaration are interpreted as global variables tacitly and variables are created automatically 2 Variables contained in screen programs on screen other than global screens and variables contained in all part programs not defined by global declaration static dec
344. r as writing a variable name One of the type declaration characters and which indicate the type of a return value should be added to the function name The real number function name is the only exception It needs no type declaration character Argument 1 argument 2 and so forth enclosed in parentheses are given by the caller to the function The type of the arguments is declared by the type declaration character If no type declaration character is written arguments are regarded as real numbers The function caller can use variables constants and calculation expressions as arguments If variables are specified as arguments the function may substitute values for the arguments and as a result the arguments may be changed In such a case the variables of the caller are also changed In other words the function uses such arguments as the original variables though they are called arguments not variables If constants or calculation expressions are specified as arguments the values are substituted for the arguments and the function is executed If values are substituted for the arguments the values of the arguments are changed while no influences are placed upon the caller In other words the function regards such arguments as variables having default values i e auto variables When a value is substituted for the function name with a type declaration character a return value for the function is decided The function caller can
345. r switch is used its sub ID must be specified e switch name is the name assigned to the switch or the D type variable indicating the name e display graphic is the graphic name or the D type variable indicating the name e status is the integer value indicating whether the graphic is displayed when the switch status is ON or OFF 0 The graphic is displayed when the switch status is OFF 1 The graphic is displayed when the switch status is ON e sub ID is required when the selector switch is used Specify the sub switch number of the selector switch in sub ID The sub switch number in the upper left end is assigned 1 The sub switch numbers increase in the right direction They decrease in the downward direction Specify 0 in sub ID when the selector switch is not used E Related Item None E Example of Program Contr static figid subid onoff figid FIGO3 subid 3 onoff 1 end conf evnt input type id data if type 3 and id SWT000 then SWFIG id figid onoff subid endif end evnt 4 240 CHAPTER4 INSTRUCTION REFERENCE SWMODE be SWMODE Statement E Function The SWMODE statement modifies the status of the specified switch E Format SWMODE switch name mode m Example of Use SWMODE SW1 2 E Description e switch name is the name of the switch whose status is to be modified or the D type variable indicating the switch e mode indicates the status to be modifie
346. racter clock plot free graph meter and lamp displays Specify one of the following 0 Figure read 1 Fore color read 2 Back color read 3 Display color read The number 0 to 15 of the read display color is returned _PD_BCOLOR reads the background color of a control _PD_BCOLOR is applicable to numeric character clock plot bar graph line chart and free graph displays Specify one of the following 0 Figure read 1 Fore color read 2 Back color read The number 0 to 15 of the read background color is returned 4 199 PRMSTAT es 3 _PD_PIPCOLOR Function Range Type Return value 4 _PD_BSLNE Function Range Type Return value 5 _PD_BSCOLOR Function Range Type Return value 6 _SW_ONFIG Function Range Type Return value 7 _SW_OFFFIG Function Range Type Return value _PD_PIPCOLOR reads the internal color of a pipe or lamp display _PD_PIPCOLOR is applicable to pipe and lamp displays Specify one of the following 0 Read of OFF display color valid for pipe and lamp displays 1 Read of ON1 display color valid for pipe and lamp displays 2 Read of ON2 display color valid for pipe displays The number 0 to 15 of the read internal color is returned _PD_BSLNE reads the type of a base line or a reference line _PD_BSLNE is applicable to bar graphs and line charts Specify one of the following 0 Read of base line type 1 Read of reference line 1 type 2
347. racter display e control name is the character display name or the ID type variable indicating the character display e display data is character data to be displayed in the character display e display value cannot be changed even if this statement is issued to the display for which operation parameters are set to effective in the control E Related Item STRCOLOR STRFORM m Example of Program Cont static name name STROOO end conf evnt input type id datas STRDSP name data end evnt 4 237 STRFORM i 8 STRFORM Statement E Function E Format m Example of Use E Description E Related Item E Example of Program evnt The STRFORM statement changes the display method of the character display STRFORM control name display method STRFORM HYOJIKI 0 e The STRFORM statement changes the display method of the character display control name is the character display name or the ID type variable indicating the character display e display method is the numeric value indicating any of the following three display methods 0 Left justification method 1 Centering method 2 Right justification method STRCOLOR STRDSP input type id data var buhin moji STRFORM var data strdsp var ABCDEFG end evnt 4 238 CHAPTER4 INSTRUCTION REFERENCE STRING eg STRING Statement E Function E Format m Example of Use E Description E Related Item
348. raight line may be cleared The cleared straight line is not redisplayed e The type and color of the straight line are specified by COLOR e If this is used in an initialization block or configuration block drawing is executed after executing this block and accordingly lines are not drawn Be sure to use this in an event block E Related Item COLOR E Example of Program conf Color Ly 0 8 end conf evnt dot 100 200 dot 100 300 color 1 Q 0 line 100 200 100 300 end evnt 4 135 LINPUT 8 LINPUT Statement E Function The LINPUT statement reads data from the specified file E Format LINPUT file number character string variable m Example of Use LINPUT 12 STRING E Description E Related Item m Example of Program conf end conf evnt The LINPUT statement reads data from the file specified by file number into the character string defined by character string variable The data between the current file position and carriage return CR or line feed LF is assigned to character string variable CR and LF however are not assigned file number must match the number of the file opened by the FOPEN statement FOPEN FCLOSE FPRINT FWRITE FINPUT topen CITESTI 2 7 5 AAAS 12345 fwrite 5 fseek 5 linput 5 end evnt AAAS ABCD 0 0 VSTRS The file is written as follows 12345 ABCD CR LF When data is read the variabl
349. rectory and a drive e Specify the directory to be changed with a character string constant or variable e directory name can be specified starting from a drive name E Related Item MKDIR RMDIR m Example of Program conf end conf evnt CHDIR AAG gt Changes the drive CHDIR TEST Changes the directory CHDIR E ABC gt Changes both the drive and directory 4 35 CHKTIM A CHKTIM Function E Function The CHKTIM function checks the status of the specified timer E Format RET CHKTIM timer number m Example of Use RET CHKTIM 14 E Description e The CHKTIM function checks whether the specified timer is being used opened e timer number indicates the number of the timer to be checked it must be an integer type value from 0 to 15 e As a result of executing this function any of the following values is returned 0 The timer is not being used 1 The timer is being used by the local program 2 The timer is being used by a remote program E Related Item CLOSETIM STARTTIM STOPTIM CONTTIM SETTIM READTIM OPENTIM OPENTIM2 E Example of Program evnt fOr i 0 6 15 ret CHKTIM i if ret 0 then i 15 next end evnt 4 36 CHAPTER4 INSTRUCTION REFERENCE CHR Eo CHR Function E Function The CHR function assigns the character corresponding to the specified numeric value character code m Format CHR character code E Example of Use MOJI CHR
350. rent value time to hour read variable minute read variable and second read variable e Hour is a numeric value from 0 to 23 Minute is a numeric value from 0 to 59 Second is a numeric value from 0 to 59 e Read variables must be integer type variables e Once date is set using the SETDATE command in a model with a battery backup calendar IC GCS56LC or GCS5EM the date is updated even while the power is off If a model with no calendar IC GCS53LC or GC53LM is turned off the date is initialized to January 1 1998 Thursday and the time to 00 00 00 when it is turned on again The date and time are updated while the power is on DATE GETDATE SETDATE SETTIME TIME H M S NUMO000 H NUM001 M NUM002 S 4 110 CHAPTER 4 INSTRUCTION REFERENCE GLOBAL eg ls GLOBAL Statement E Function The GLOBAL statement declares that global variables are to be used E Format GLOBAL variable name variable name m Example of Use GLOBAL VAR XYZ 2 3 MOJI 20 E Description e The GLOBAL statement declares that global variables are to be used Global variables can be read and written from all programs Global variables must be declared before they are used in a program These variables are initialized once when the power supply is turned on The values of global variables used after the power supply has been turned on are retained e A normal variable an array variable or a character string variable can be written in
351. res of Screen Creator 5 BACKUP a BACKUP Statement E Function The BACKUP statement declares a backup variable E Format BACKUP variable name variable name m Example of Use BACKUP VAR XYZ 2 3 MOJI 20 E Description e The BACKUP statement declares a backup variable Besides the characteristics of a global variable a backup variable has a function to retain its value even if the power supply is turned off e A normal variable an array variable or a character string variable can be specified in variable name e In order to declare arrays and character string type no DIM and STRING declarations are required E Related Item AUTO DIM GLOBAL LOCAL STATIC STRING E Example of Program conr BACKUP a x 2 3 moji 40 BARCOLOR fs __e BARCOLOR Statement E Function The BARCOLOR statement changes the bar color and figure of the bar graph display E Format BARCOLOR display name bar number tile 1 display color 1 background color 1 tile 2 display color 2 background color 2 m Example of Use BARCOLOR BARO00 2 3 1 4 5 2 1 E Description e The BARCOLOR statement changes the bar tiles and colors of the bar graph display and the background tiles and colors of the entire display 1 indicates that the color and tile for which 1 was specified remain unchanged e control name is the name of a bar graph or the D type variable indicating the graph e The value indicating the bar number in the bar
352. reset see _PL_SMPCLT _SW_RACT sets whether to perform reverse operation when a switch is ON _SW_RACT is applicable to switches and selector switches To perform reverse operation when a switch is ON set 1 Not to perform reverse operation set 0 _SW_BZER sets whether to sound the buzzer when a switch is ON _SW_BZER is applicable to switches and selector switches To sound the buzzer when a switch is pressed set 1 Not to sound the buzzer set 0 _SW_STAT changes the status disable halftone of a switch _SW_STAT is applicable to switches and selector switches Set one of the following numeric values indicating the switch status 0 Normal operation status 1 Input disable status 2 Halftone status normal operation input _SW_BMODE changes the switch background color display method _SW_BMODE is applicable to switches and selector switches When changing the switch background color display method to direct display set 0 When changing the display method to replacement display set 1 _SW_ONCOLOR sets a switch ON background color _SW_ONCOLAOR is applicable to switches and selector switches Set the number of the switch ON background color to be used with a numeric value from 0 to 15 4 189 PRMCTL E l 18 _SW_OFFCOLOR Function _SW_OFFCOLOR sets a switch OFF background color Range _SW_OFFCOLAOR is applicable to switches and selector switches Control value Set the number of the switch O
353. riable arrangement variable or character string variable DIM declaration or STRING declaration is not needed to declare an arrangement variable or character variable The LOCAL statement is one of the new features of Screen Creator 5 added for distinctive declaration of local variables DIM can substitute for LOCAL However use LOCAL as far as possible in Screen Creator 5 STRING can be used instead of LOCAL to specify a size of a character string variable However use LOCAL as far as possible in Screen Creator 5 AUTO BACKUP DIM FUNCTION GLOBAL STATIC STRING global float 5 LOCAL i for i tO 5 float i i 3 next end conf 4 142 CHAPTER 4 INSTRUCTION REFERENCE LOCALCHECK be LOCALCHECK Statement E Function The LOCALCHECK statement controls the level of warning messages output by the compiler E Format LOCALCHECK warning level m Example of Use LOCALCHECK 1 E Description e The LOCALCHECK statement specifies whether or not to output a warning if local and global variables functions and or subroutines are used vaguely in a program e Two warning levels are available as shown below 1 A warning is output 0 No warning is output e Three types of warnings are available as shown below 1 Ifa variable not declared is used in a program In this case the compiler regards such a variable as a local variable It regards such a variable as a global variable in a global screen program 2 If global and lo
354. rmat TIMID number m Example of Use AA TIMID VAR E Description e number is the timer number integer value to be changed to an ID type timer number E Related Item TIMINT OPENTIM2 E Example of Program cont opentim2 2 settim 2 20 0 starttim 2 end conf evnt input type id if id timid 2 then end if end evnt 4 248 CHAPTER4 INSTRUCTION REFERENCE TIMID eg TIMINT Function E Function The TIMINT function changes an D type timer number to an an integer type timer number E Format TIMINT ID number m Example of Use VAR TIMINT ID E Description e ID number is the D type timer number to be changed to to an integer type timer number E Related Item TIMID OPENTIM m Example of Program id opentim no TIMINT id chktim no end evnt 4 249 TIMINT l VAL VAL2 Function E Function E Format m Example of Use E Description E Related Item m Example of Program conf The VAL VAL2 function converts the number specified in character string to a numeric value VAL character string VAL2 character string A VAL 123 A VAL2 123 45 e When the specified character string begins with a character other than 0to 9 E and the VAL VAL2 function returns 0 e If the specified character string contains an unconvertible character the VAL VAL2 function converts the characters before it e When the VAL function is used to
355. rogram on a global screen a compilation error occurs 3 5 3 5 Variables 3 5 Variables Alphanumeric characters and an underscore _ can be used as variable names Uppercase and lowercase letters of variable names are not identified A variable name cannot begin with anumber Write each variable name with up to 20 characters bytes Add one of the type declaration characters and in order to the end of a constant name to express the type of the constant The real number constant is the only exception No type declaration character is added to the end of the real number constant 3 5 1 Classification of variables Character type variable Variable that stores characters A variable ending with is a character type variable For the default up to 20 characters bytes can be stored in a character type variable Use the STRING command to increase the number of characters Integer type variable Variable that stores an integer A variable ending with is an integer type variable Floating point type Variable that stores a floating point number A variable ending variable with is a floating point type variable Variables that do not end with are also treated as floating point type variables ID type variable Variable that stores ID type values such as a screen name a part name a primitive name and a logical device name A variable ending with is an ID type variable Array type variab
356. rol size vertically and horizontally by dragging the lower right handle 2 5 2 1 Creating a Part for Displaying Numerics 2 1 2 Coding a program In this section try to code a program for the part being created Select Edit on the menu then select Edit Part Programs The program editor window opens as shown below wet siz E Type the following program on this screen init numdsp NUM000 1234 end init conf end conf evnt end evnt The program contents will be explained later First of all type the following program The program editor screen will change as follows aa zit 4 a 2 6 CHAPTER 2 EXAMPLES OF PROGRAMMING 2 1 Creating a Part for Displaying Numerics To save this program select Program on the menu then select Save Then select Program on the menu and select Close in order to close the program editor window Now the program editor window is closed and the part editor window is re displayed 2 1 3 Drawing a figure in a part Then try to add a pattern to the part In this example enclose the number indicator control in a rectangle Select Create on the menu select Rectangle and drag the rectangle along the diagonal line of the number indicator control Now the number indicator control is enclosed in a rectangle The rectangular frame should be slightly larger than the control While drawing the rectangle the dialog box for inputting the rectangle properties is open
357. round section Specify this color number with a numeric value from 0 to 15 FIGDSP input types id tile FIGCOLOR end evnt FIGOOO tile S 1 1 4 86 CHAPTER4 INSTRUCTION REFERENCE FIGDSP ee FIGDSP Statement E Function The FIGDSP statement texture the graphic specified in the graphic display E Format FIGDSP control name texture name m Example of Use FIGDSP B000 FIGO00 SWFIG E Description e The FIGDSP statement displays the texture specified in the texture display This texture name must be the one created by the plotting tool e control name is the graphic display name or the ID type variable indicating the graphic display e texture name is the variable indicating the name or ID of the texture to be displayed in the texture display or the registered graphic number integer type e display value cannot be changed even if this statement is issued to the display for which operation parameters are set to effective in the control E Related Item FIGCOLOR FIGFORM m Example of Program evnt input ty id figno FIGDSP FIGOOO figno end evnt 4 87 FIGFORM ee FIGFORM Statement E Function E Format m Example of Use E Description E Related Item m Example of Program evnt The FIGFORM statement changes the display format of the texture display FIGFORM control name resize specification FIGFORM HYOJIKI 0 e When the size of the texture display d
358. rror number E Related Item FOPEN FCLOSE FPRINT FWRITE FINPUT m Example of Program coni ONFERR end conf evnt input ty id dat1 end evnt When an error occurs 8 is set in ty and an error code number is set in dat1 4 166 CHAPTER4 INSTRUCTION REFERENCE OPEN eg OPEN Statement E Function The OPEN statement opens displays the specified part E Format OPEN part name mode m Example of Use OPEN BUHIN 1 E Description e The OPEN statement opens displays the closed part on the screen e part name is the name of the part to be opened or the variable indicating the ID of the part to be opened e mode specifies whether to execute the configuration block of the program attached to the part when the part is opened 0 The configuration block is not executed 1 The configuration block is executed E Related Item CLOSE m Example of Program evnt input types id data if pstat BUHIN 3 then OPEN BUHIN O endif end evnt 4 167 OPENCOM ee OPENCOM Statement E Function E Format m Example of Use E Description E Related Item m Example of Program con The OPENCOM statement declares that the program receives data from a serial line OPENCOM logical device name OPENCOM HST e The OPENCOM statement declares that the program receives data from the specified external connecting device When the host computer transmits data this statem
359. rt in the line chart display left or right by one point e When this statement is executed the values of the points purged from the line chart are returned as a result of the shifting control name is the line chart name or the D type variable indicating the line chart e line number is the value indicating which line in the line chart display is to be shifted This line number starts at 1 e When shift direction is 1 line chart data is shifted left and above When shift direction is 1 line chart data is shifted right and below e display data indicates the data to be displayed in the vacant area produced as a result of the shifting E Related Item LNEDSP LNECOLOR LNESHIFT PRDSP m Example of Program evnt input type S id data if data gt 0 then abc Ineshift2 LNEOOO 1 1 0 else abc lneshift2 LNEOOO 1 1 100 endif prdsp LNEQOOO end evnt 4 141 LOCAL 8 LOCAL Statement E Function E Format m Example of Use E Description E Related Item E Example of Program con I The LOCAL statement defines a local variable LOCAL variable name variable name LOCAL VAR XYZ 2 3 MOJI 20 The LOCAL statement defines a variable defined in variable name as a local variable A local variable can be read and written only in a program where it is declared The compiler gives a warning if an undefined local variable is used Each l
360. ruction reads messages from the switch control if typet 3 and id SWTO0O and data 1 then print numeric value to be displayed send _ remote destination part name end if This portion executes print and send instructions when the switch is pressed print numeric value to be displayed The print instruction transmits messages to other parts A message comprises a type an ID and a display value described here If you want to transmit two or more numeral values you can chain them by delimiting each value by a comma Example print 123 456 789 In this case the input instruction set for the part receiving data is divided into three as shown below Example input type id datal data2 data3 In this example datai is read to 123 data2 is read to 456 and data3 is read to 789 send _ remote destination part name 2 35 2 4 Creating a Part for Controlling Others The send instruction transmits a message generated by the print instruction to the specified part remote destination part name Be sure to use print and send instructions in combination When numeric value to be displayed is 25 Part BUHIN1 Contents of print message 2 TEST BUHIN1 25 Part BUHIN2 Press this Mee Transmission send Screen TEST Print Message creation send gt Message transmission to the specified p
361. s 3 3 Constants OIP K Basic uses character constants integer type constants floating point type constants and D type constants Character constant Integer type constant Floating point type ID type constant 3 4 CHAPTER 3 CODING RULES A character string enclosed in double quotation marks is called a character constant Character strings of up to 80 bytes can be enclosed in double quotation marks ABCDEF and 1234 etc are character constants Integer type constants can be represented in the octal decimal and hexadecimal formats amp 123 amp 66 octal notation amp or amp O is added to the beginning of numbers 0 to 7 100 322 decimal notation Values from 2147483648 to 2147483647 can be assigned amp H123 amp HFF amp H is added to the beginning of hexadecimal notation characters 0 to F Floating point type constants can consist of values from 1 70141E 38 to constant 1 70141E 38 The number of significant digits is 6 digits A floating point type constant can be written like 1 23 0 001 2 3E 4 E 4 indicates the 4 power of 10 Screen names part names primitive names logical device names graphic names text names and PLC device names can be written as ID type constants Screen name part name and primitive name A screen name can be written like SCREEN and a part name can be written as SCREEN PART A primitive name can be written like SCREEN PART PRIM e Logical device name In OIP B
362. s and the vertical direction toward below corresponds to the Y axis e Color is inversed as shown below In color display the palette values 0 to 15 are inversed In other words 0 is changed into 15 1 is changed into 14 7 is changed into 8 and so forth In monochrome display activated color is changed into deactivated color deactivated color is changed into activated color and transparent color is changed into activated color e If this is used in an initialization block or configuration block drawing is executed after executing this block and accordingly color is not inversed Be sure to use this in an event block E Related Item None E Example of Program evnt input ty id dat if ty 3 and id SWT000 then DINV 0 0 639 399 endif end evnt 4 71 DOT 8 DOT Statement E Function E Format m Example of Use E Description E Related Item m Example of Program conf color 1 end conf evnt The DOT statement displays dots on a screen DOT X1 Y1 DOT 20 300 The DOT statement displays a dot in the specified coordinate X1 Y1 X1 must be a numeric value from 0 to 639 Y1 must be a numeric value from 0 to 399 GC55EM or 0 to 479 GC56LC Dots are directly displayed as the background of a screen When a part is opened or closed in the area where dots are displayed or when a control is displayed the dots may be cleared The cleared dots are not redisplayed The si
363. s are displayed in one bar graph display The bar number is integer value data starting at 1 display data is the numeric data indicating the size of the bar graph E Related Item BARDSP PRDSP E Example of Program evnt BARSET buhin gpaph 3 20 1 var buhin graph no 4 value 23 barset var no value prdsp var end evnt 4 21 BARSHIFT ge BARSHIFT Function E Function The BARSHIFT function shifts bar graph data left or right and displays it E Format DATA BARSHIFT control name shift direction display data m Example of Use DATA BARSHIFT BARO00 1 30 E Description e When two or more bars are being displayed in one bar graph display the BARSHIFT statement shifts the bars constituting the graph left or right by one bar and displays the bars e When the BARSHIFT function is executed the values of the bars purged from the graph are returned as a result of the shifting e The variable indicating the graph name or ID is set in control name e When shift direction is 1 bar graph data is shifted left and above When shift direction is 1 bar graph data is shifted right and below e display data indicates the data to be displayed in the vacant area produced as a result of the shifting E Related Item BARDSP BARCOLOR E Example of Program evnt input type id data if data gt 0 then abc barshift BAR000 1 0 else abc barshift BAR000 1 10
364. s returned For a BCD 3 is returned For the lamp primitive 2 is always returned 4 194 CHAPTER4 INSTRUCTION REFERENCE PRMSTAT eg 6 8 _PD_FONT Function Range Return value _PD_XFSZ Function Range Return value _PD_YFSZ Function Range Return value _PD_PTPOS Function Range Return value _PD_ZSPRS Function Range Return value _PD_XNUM Function Range Return value _PD_YNUM Function Range Return value _PD_DIRECT Function Range Return value _PD_FONT reads the type of the font displayed on the control _PD_FONT is applicable to numeric and clock displays For half size character display O is returned For full size character display 1 is returned _PD_XFSZ reads the horizontal direction size of the font displayed on the control _PD_XFSZ is applicable to numeric character and clock displays For 1 magnification 0 is returned For 2 magnifications 1 is returned For 4 magnifications 2 is returned For 8 magnifications 3 is returned For 16 magnifications 4 is returned _PD_YFSZ reads the vertical direction size of the font displayed on the control _PD_YFSZ is applicable to numeric character and clock displays For 1 magnification 0 is returned For 2 magnifications 1 is returned For 4 magnifications 2 is returned For 8 magnifications 3 is returned For 16 magnifications 4 is returned For 32 magnifications 5 is returned _PD
365. s specified the character string between double quotation marks is to be read If the type of data written to the specified file does not match that of the specified read variable the contents of the variable are undefined e file number must match the number of the file opened by the FOPEN statement E Related Item FOPEN FCLOSE FPRINT FWRITE LINPUT E Example of Program conf fopen C TEST 2 5 end conf evnt vars 2 fwrite 5 123 var ABCD XYZ fseek 5 O 0 finput 5 VAR1 VAR2 VSTR1S VSTR2 end evnt Data is written to the specified file as follows 123 2 ABCD XYZ CR LF When data is read the variables change as follows VAR1 123 VSTR1 ABCD VAR2 2 VSTR2 XYZ 4 89 FLUSH 8 FLUSH Statement E Function The FLUSH statement returns the write position of a non procedual communication reception buffer to the beginning of the variable E Format FLUSH port number m Example of Use FLUSH 2 E Description e The FLUSH statement enables received data to be written from the beginning of the variable to which the write position of the non procedual communication reception buffer was returned e port number specifies the port CH1 to CH3 to be flushed with a value from to 3 e Execute the FLUSH statement when a reception completion message is received Unless the FLUSH statement is executed the reception buffer may beco
366. s the sum of the variable group in the specified field FSUM file number SUM FSUM 5 e The FSUM function calculates the sum eight low order bits of the variable group included in the FIELD specified by file number by incrementing the contents of the group for each byte The function calculates the area where no character code is defined in the character string variable as 0 e The FSUM function returns the calculation result as an integer type value within the range from 0 to 255 Ifthe FIELD specified by file number does not exist an error occurs FOPEN FIELD FCLOSE FPUT FGET E Example of Program cont field 5 global no global mojilS moji2s end field global sum fopen MEMORY 2 5 end conf o fget 5 3 if sum FSUM 5 then n S umdsp NUMOOO no trdsp STROOO mojilS strdsp STROO1L moji2s else strdsp STROO2 SUM error fclose 5 end evnt 4 100 CHAPTER4 INSTRUCTION REFERENCE FUNCTION END FUNCTION FUNCTION END FUNCTION Statement E Function E Format m Example of Use E Description E Related Item The FUNCTION END FUNCTION statement declares a function block FUNCTION function name type declaration character variable declaration variable declaration END FUNCTION FUNCTION ADD A B ADD A B END FUNCTION The FUNCTION END FUNCTION statement declares
367. sages to the part set 1 When not issuing messages set 0 _PL_SMPCTL controls sampling Stop start and reset _PL_SMPCTL is applicable to plot bar graph and line chart displays Stop stops sampling Start starts sampling from the stop status Reset clears display and starts sampling from the beginning 0 Sampling is stopped 1 Sampling is started 2 Sampling is reset _PL_SMPTME changes a sampling time _PL_SMPTME is applicable to plot bar graph and line chart displays Set a value indicating the sampling time setting value 0 5 second When the sampling time is changed sampling is started after it has been reset see _PL_SMPCLT 4 188 CHAPTER4 INSTRUCTION REFERENCE PRMCTL eg 12 PL_DIRECT Function Range Control value 13 _SW_RACT Function Range Control value 14 SW_BZER Function Range Control value 15 _SW_STAT Function Range Control value 16 _SW_BMODE Function Range Control value 17 _SW_ONCOLOR Function Range Control value _PL_DIRECT changes the display direction of a line chart _PLI_DIRECT is applicable only to line chart displays When changing the display direction of the line chart from right to left set 0 When changing the display direction from left to right set 1 This direction change is meaningless if sampling is not performed When the display direction is changed sampling is started after it has been
368. scription e The STOPTIM statement stops the increment operation of the E Related Item specified timer e timer number is the D type variable indicating the number of the timer that stops increment or an integer type variable from 0 to 15 E Example of Program 4 234 conf static timid timid opentim settim timid 20 0 starttim timid end conf evnt input types id data if type 3 and data 1 then tims readtim timid numdsp NUMO00 tim 100 else STOPTIM timid end if end evnt CHAPTER 4 INSTRUCTION REFERENCE The STOPTIM statement stops the increment operation of the specified OPENTIM STARTTIM CONTTIM CLOSETIM SETTIM READTIM STR PT STR Function E Function E Format m Example of Use E Description E Related Item E Example of Program evnt The STR function converts the specified numeric value to a character string STR numerical expression A STR 123 e An integer or floating point type numerical expression can be specified in numerical expression e When the numeric value specified in numerical expression is negative is added to the beginning of the character string VAL input type id data a STRS data strdsp end evnt hyojiki a 4 235 STRCOLOR 8 STRCOLOR Statement E Function E Format m Example of Use E Description E Related Item m Example of Program conf
369. se if statement detects the moment the switch is released and writes 0 in the PLC device 2 27 2 2 Creating a Part to be Linked to a PLC Device 2 2 4 Indicator switches Set the MO bit to 1 or 0 bit to 1 and at the same time displays the result in the lamp Create the part that writes values 1 and 0 to the PLC and Pressing this switch sets the MO displays the result in the lamp ee ee Control to use One Switch control SWT000 and one Lamp control LAM000 Exterior view of part Figure Lamp control Switch control These two contorls are placed overlapping each other A program of an indicator lamp switch is given below init local type id data cyclic station number connected device address end init conf cyclic station number connected device address end conf evnt 2 28 CHAPTER2 EXAMPLES OF PROGRAMMING 2 2 Creating a Part to be Linked to a PLC Device input type id data if type 3 and id SWTO00 and data 1 then station number connected device address 1 else if type S 3 and id SWTO000 and data 0 then station number connected device address 1 elseif type 16 and id station number connected device address then lampdsp NUM000 data end if end evnt This program consists of a lamp part and a switch part Initialization Block In this example you can use a cyclic instruction to observe the PLC bit device that turns on off
370. sed or a message is received are written in these statements E Related Item CONF END CONF INIT END INIT E Example of Program conf static moji end conf evnt input ty id dat end evnt 4 78 CHAPTER4 INSTRUCTION REFERENCE EXECPRCODE eg EXECPRCODE Statement E Function The EXECPRCODE statement executes primitive data operation E Format EXECPRCODE control name type operation data variable name m Example of Use EXECPRCODE NUMO000 0 20 VAR E Description e When a control in a part is used to validate an operation parameter the EXECPRCODE statement executes data operation set in the part operation parameter specification e type is usually 0 When the specified primitive is the plot display and type is 0 the EXECPRCODE statement executes X data operation When type is 1 the statement executes Y data operation control name must be the control in the local part e operation data specifies the value to be operated it must be an integer or floating point type variable or constant e variable name specifies the variable to which the operation result is to be written it must be an integer or floating point type variable e If no operation code is written in the specified control the value specified in operation data is set in the specified variable E Related Item None m Example of Program conf end conf evnt input type id data EXECPRCODE NUMOOO 0 data datal numd
371. set in the second variable name which is followed by data Screen Optional Item written in the PRINT statement Item written in the PRINT statement Switch single 1 1 when ON 0 when OFF Switch multi Switch number 1 when ON 0 when OFF Selector switch __ Number of activated switch _ eara o or OFF 0 status eo nasi status Parallel port BIT number BIT value or channel number satisfying the condition Non procedual The port number status and number of received bytes are set in this order Sampling 9 Conwol __ Sampled data_ _ M device value reader _ Magneticcard 19 o i y Ten keypad_ 20 Code of pressed key Memory cara 21 J o o E Host 22 Optional data to be determined by the user 4 119 INPUT 4 120 CHAPTER4 INSTRUCTION REFERENCE INPUT be bytes written to the reception buffer For the text mode a terminator code is also read When the status is 1 or 1 the number of received data is read The numbers of multi switches and selector switches are counted as 1 2 3 and so forth from the upper left switch When all switches are counted in the X direction the switches on the lower Y line are counted in the same way They are integers E Related Item PRINT CYCLIC OPENPARALLEL OPENCOM OPENSIO E Example of Program cont global buffer opensio 2 0 buffers setsio 2 10 end conf evnt input type id port status bytes
372. sp NUMOO1 datal end evnt 4 79 EXIT FUNCTION ee EXIT FUNCTION Statement E Function The EXIT FUNCTION statement exits a function forcedly E Format EXIT FUNCTION m Example of Use FUNCTION DIV A B IF B 0 THEN EXIT FUNCTION DIV A B END FUNCTION E Description e The EXIT FUNCTION statement gives an instruction to exit a function forcedly in a function block where the function itself is defined and returns the control to the side which called the function e This statement is one of the new features of Screen Creator 5 E Related Item DECLARE FUNCTION FUNCTIONCHECK m Example of Program declare my_div a b conf global x y local share share my_div x y end conf function my_div a b Vo if b S 0 then EXIT FUNCTION my_div a b end function 4 80 CHAPTER4 INSTRUCTION REFERENCE EXP PT EXP Function E Function The EXP function calculates the value of an exponential function for the base of a natural logarithm E Format EXP numerical expression m Example of Use VAR EXP A 2 E Description The EXP function returns the result of exponent operation for the base E of the natural logarithm E Related Item LOG E Example of Program evnt input ty id data if ty 3 then numdsp NUM000 EXP 10 else numdsp NUM000 EXP 5 endif end evnt 4 81 FCLOSE 8 FCLOSE Statement E Function E Format
373. splay set 0 When matching the size of the graphic with that of the graphic display set 1 4 187 PRMCTL Ee 6 _PD_WSIZ Function Range Control value 7 _PD_PIPSTAT Function Range Control value 8 _PL_FIRST Function Range Control value 9 PL_SMPMSG Function Range Control value 10 _PL_SMPCTL Function Range Control value 11 _PL_SMPTME Function Range Control value _PD_WSIZ changes the dot size or line width of a display _PD_WSIZ is applicable to plot meter and pipe displays For a plot display set the dot size small to large with a numeric value from 0 to 2 For a meter display set the line width narrow to wide with a numeric value from 0 to 2 For a pipe display set the thickness 1 3 5 or 7 with a numeric value from 0 to 3 _PD_PIPSTAT changes the ON or OFF status of a lamp or pipe display _PD_PIPSTAT is applicable to lamp and pipe displays Set the ON and OFF statuses of the lamp and pipe displays as follows _PL_FIRST changes the start registration number of the registration graphic or character string to be displayed _PL_FIRST is applicable to character and graphic displays Set the value you want to use as the start registration number _PL_SMPMSG specifies whether to issue messages to the part on which the control is placed when sampling is performed by the control _PL_SMPMSG is applicable to plot bar graph and line chart displays When issuing mes
374. splayed or when a control is displayed the dots may be cleared The cleared dots are not redisplayed The size and color of a dot are specified by the COLOR statement If this is used in an initialization block or configuration block drawing is executed after executing this block and accordingly points are not plotted Be sure to use this in an event block COLOR O 3 dot 100 200 dot 100 300 color 1 0 20 line 100 200 100 300 end evnt 4 72 CHAPTER4 INSTRUCTION REFERENCE DSPMODE PT DSPMODE Statement E Function The DSPMODE statement changes the display mode of the control E Format DSPMODE control name display mode m Example of Use DSPMODE NUMO00 2 E Description e The DSPMODE statement is a command that changes the display mode of the control e control name is the control name or the D type variable indicating control name e control mode specifies the mode in which the control is displayed The display mode is specified with any of the following numeric values 0 Normal display mode 1 Inverse display mode 2 Blink display mode The display color is replaced with the background color 3 On and off display mode The display status and nondisplay status are repeatedly displayed E Related Item NUMDSP STRDSP FIGDSP SLDDSP MTRDSP FREDSP PLTDSP BARDSP BLTDSP CIRDSP LNEDSP E Example of Program evnt input ty id data if id SWTOOO then DSPMODE NUMOOO 3 endif end evnt
375. ssestreeeesessssss 4 213 INi DA A ERA N E E E E IN a E 4 149 RUN seterienusnni iae a ee duten saedes 4 214 MKB e oler E araa Ee EE 4 151 MKDIR remenen e 4 152 SELECT CASE END SELECT 4 215 MRE eoe sane agate eee eA 4 153 SEND ince ies 4 216 MR Dare er Milt eit foe detent 4 154 SETALARM eon onen inerea 4 217 MRK UD erior ierre erecek eeure erai 4 155 SETBEEP sacs tev encucapingereausneaeeisiamnteatantierparte 4 218 MKS sunsn en es ehhh 4 156 SETBLIGHT sccsserserscenisshixcatsotnacbespssaaweiteage 4 219 MK Wiisish siestihd ea a ns a 4 157 SETA Pisin cttenih enliven ete 4 220 MOVE senate tnor pooier ee a ERA ENA 4 158 SETLNEPLOT osise 4 221 MTRCOL OR nran onera e ihi 4 159 SEISION aeie eS 4 222 MTRDS Pong tii aii ness 4 160 SETIM ie ha cietes eis ble aed EA 4 223 4 1 Instruction References ee SETTIME suar 4 224 SHIFT merer eia 4 225 n a A idles 4 226 STE DIBRI o E cae 4 227 SOB ese da lected n e ease 4 228 GOR oe neat A E aan 4 229 STARTTIM spiced ia aa 4 230 SIATIC aana aa 4 231 STOP E O E eae cals 4 232 STOP TIN seracnrinernn neinna hh 4 233 T a A AAE AA 4 234 STRCOLOR oninaainisai en anin 4 235 SUNUD AA 4 236 STRFORM ossi 4 237 STRING aca ratin n i 4 238 SW BIG enian i annen 4 239 SWMODE sesexiasacarncccste inani 4 240 SWREA Daeron iibri adietan 4 241 VBE Vin ciao Peas nccleststaciesgsetcets 4 242 SWW RITE osiin 4 243 EDP sacasants A A 4 245 TIMES em aa aA EREA 4 246 GUNDA D sss aise EE AEA 4 247 TIMIN T a
376. ssible to reference global variables static variables and backup variables if they are declared in the programs It is also possible to reference local variables which are declared or not declared in programs No library functions can be referenced except auto variables declared in programs 3 11 Program Operation 3 11 Program Operation 3 18 Operation of an OIP program is started when a message is issued to the part or screen written in the program GCSGP3 provides the following types of messages Part and screen messages e Part and screen programs can execute the SEND instruction to issue messages to a part or screen Switch messages e A message is issued when the switch primitive placed on a part is set to ON or OFF e A message is also issued by touching the switch primitive Internal timer messages e A message is issued when the specified time has elapsed e The internal timer in the program must be operated to receive messages from the timer See OPENTIM Alarm messages e A message is issued when the specified time is reached For how to operate alarms see SETALARM Command PIO messages A message is issued when the parallel input status changes e To receive messages from the parallel input which PIO bit is to be used must be declared in the program in advance See OPENPARALLEL Non procedual communication messages A non procedual communication message is issued when non procedua
377. statement permits the program whose data reception from an external connecting device was temporarily inhibited by the CLOSECOM statement to receive data again e logical device name specifies any of the following external connecting devices HST Host computer BCR Bar code reader TKY Ten key pad E Related Item OPENCOM CLOSECOM E Example of Program conf OPENCOM HST end conf evnt input type id data if type 3 and data 1 then CLOSECOM HST else if type 3 and data 0 then REOPENCOM HST endif end evnt 4 207 REOPENPARALLEL 8 REOPENPARALLEL Statement E Function E Format m Example of Use E Description E Related Item E Example of Program conf The REOPENPARALLEL statement permits data re reception from the temporarily closed parallel port REOPENPARALLEL input bit REOPENPARALLEL 3 e The REOPENPARALLEL statement permits the script whose data reception from the parallel port was temporarily inhibited by the CLOSEPARALLEL statement to re receive data e input bit is the bit for restarting data reception This input bit is the same as the bit specified by the CLOSEPARALLEL statement OPENPARALLEL CLOSEPARALLEL OPENPARALLEL 3 end conf evnt input type id data if type 3 and data S 1 then CLOS EPARALLEL 3 else if type 3 and data 0 then REOP ENPARALLEL 3 endif end evnt 4 208 CHAPTER4
378. static timid opentim2 3 settim 3 20 0 starttim 3 end conf evnt input type id data if type 3 and id SWTOOO then stoptim 3 else if id SWT001 then conttim 3 end if end evnt 4 51 COPY le COPY Statement E Function E Format m Example of use E Description E Related Item E Example of Program evnt input ty if id end evnt The COPY statement makes a hardcopy of a screen COPY color number COPY 5 The COPY statement makes a hard copy of a displayed screen In the Color Number field a color specified on the color palette of Screen Creator 5 is printed black If color palette number 16 is specified in addition to color palette numbers from 0 and 15 colors of even color palette numbers are printed black If 17 is selected the print colors of number 16 are inversed i e colors of odd color palette numbers are printed black If an even color palette number is specified in monochrome printing the print color is the same as in the case where color palette number 2 is selected If an odd color palette number is specified the print color is the same as in the case where color palette number 1 is selected The Color Number can be specified only when Select Color is selected in Screen Print Mode of Printer Setup of System Setup on the OIP system screen id SWT000 then COPY 8 4 52 CHAPTER4 INSTRUCTION REFERENCE COs ee COS Function E Functio
379. string names and registration character string numbers can be specified in character strings to be retrieved None his is oip 2 When a character string variable is gt When a registration character is specified 4 122 CHAPTER4 INSTRUCTION REFERENCE INSTR pe INT Function E Function The INT function omits the fraction of the value specified in numerical expression to create an integer E Format INT numerical expression m Example of Use A INT 30 1 E Description e The INT function omits the fraction of the numerical expression enclosed in parentheses in the negative direction e The INT function calculates the maximum integer that does not exceed the value specified in numerical expression when omitting the decimal point e When the value specified in numerical expression is negative the INT function omits the figures below the decimal point as follows INT 1 4 gt 1 INT 1 4 gt 2 E Related Item CINT E Example of Program evnt input types id data intvar S INT data numdsp NUM000 intvar end evnt 4 123 INT 8 INTERLOCK Statement E Function E Format m Example of Use E Description E Related Item E Example of Program con The INTERLOCK statement controls transition to the system mode screen INTERLOCK mode INTERLOCK 1 e When mode is 1 the INTERLOCK statement sets the interlock to ON When 0 the INTERLOCK statement sets the interl
380. t STR000 org 2 id STR001 org The character string will not be displayed correctly 4 156 CHAPTER4 INSTRUCTION REFERENCE MKS eg MKS Statement E Function The MKS statement stores data in any position of a character string variable E Format MKS character string variable name storage position character string E Example of Use MKS MOJIS 5 ABCD E Description The MKS statement stores a character string Character string in the position specified by storage position starting from the beginning of the specified character string variable name e storage position must be a integer or floating point type variable or constant 1 specifies the beginning of the character string variable e character string specifies an overwriting character string it must be a variable or constant E Related Item MKB MKW MKI MKF MKID CVB CVW CVI CVF CVID E Example of Program conf end conf evnt org 1234567 strdsp STROOO org MKS orgs 2 76543 strdsp STROO1 Orgs end evnt 4 157 MKW 8 MKW Statement E Function The MKW statement stores data in any position of a character string variable E Format MKW character string variable name storage position integer value E Example of Use MKW MOJI 5 VAR E Description E Related Item E Example of Program cont end conf evnt The MKW statement stores two bytes of integer value in the position specified b
381. t E Function The PRMCTL statement changes the attributes of the specified primitive E Format PRMCTLI control name request code control value 1 PRMCTL2 control name request code type 1 control value 1 PRMCTL3 control name request code type 1 control value 2 PRMCTL4 control name request code type 1 type 2 control value 1 m Example of Use PRMCTLI1 NUMO000 _PD_STAT 3 PRMCTL2 NUMO000 _PD_DCOLOR 3 4 PRMCTL3 LNE000 _PD_RANGE 0 2 5 PRMCTL4 BARO00 _PD_PTRN 1 0 12 E Description e The PRMCTL statement changes the attributes of the specified control This statement is classified into four types PRMCTL1 PRMCTL2 PRMCTL3 and PRMCTL4 control name is the constant indicating the control to be changed or the D type variable indicating the ID of the control request code specifies what attribute changes is to be performed The types of request codes are shown on the next and subsequent pages type 1 and type 2 depend on the request code to be specified control value 1 specifies the value corresponding to the specified request code it must be an integer type constant or variable control value 2 specifies the value corresponding to the specified request code it must be a floating point constant or variable E Related Item PRMCTL1 PRMCTL2 PRMCTL3 PRMCTL4 PRMSTAT1 PRMSTAT2 PRMSTAT3 PRMSTAT4 E Example of Program conf end conf evnt status prmstatl NUMO00 _PD_STAT if status 0 then PRMCTL
382. t E Function E Format m Example of Use E Description E Related Item m Example of Program The DEVWR statement writes data to the specified device DEVWR device name offset value write value DEVWR 00 D10 10 5 The DEVWR statement writes data to the device that is offset value away from the device specified in device name offset value specifies the distance from the device specified in device name The DEVWR statement writes data to the device corresponding to the specified distance offset value must be an integer or floating point type variable or constant write value specifies the data to be written to the specified device it must be an integer or floating point type variable or constant The DEVWR statement is used for the device e g EVENTWR 007 D10 10 where continuous write is declared in the EVENTWR statement If the device to which data is to be written does not exist an error occurs CYCLIC EVENTWR DEVRD conf eventwr 00 7D10 5 Declares that data is to be written to the device that is end conf gt 5 away from D10 evnt input types id data Writes 10 to the device whose DEVWR O00 D10 data 10 offset value is data end evnt 4 66 CHAPTER4 INSTRUCTION REFERENCE DIM eg DIM Statement E Function E Format m Example of Use E Description E Related Item The DIM statement defines an array DIM variable name maximum subscript value l
383. t display The speed of executing the PRDSP display statement after setting data in two or more points is faster than that of modifying all the line point values after executing the LNEDSP statement e control name is the name of the line chart display or the D type variable indicating the line chart display e line number specifies which line data is to be displayed when two or more lines are displayed in one line chart display This line number is the integer value data starting at 1 e point number specifies which point value on the specified line is to be changed This point number is the integer value data starting at 1 e display data is the numeric data indicating the size of the line chart E Related item LNEDSP PRDSP m Example of Program evnt lneset buhin graph 3 8 20 1 var buhin graph no 4 value 23 point 4 LNESET var no point value prdsp var end evnt 4 139 LNESHIFT ie LNESHIFT Statement E Function The LNESHIFT statement shifts the display data of a line chart left or right E Format LNESHIFT cotrol name line number shift direction display data m Example of Use A LNESHIFT LNEO000 1 1 30 E Description E Related Item m Example of Program evnt The LNESHIFT statement is a function that shifts each of the points constituting the line chart in the line chart display left or right by one point and displays the points When this statement is ex
384. t the environmental conditions for creating a part Select Tool on the Screen Creator 5 menu then select Option The option setting dialog box opens Hereinafter figures showing on menu selection are not shown In this dialog box check off the Name automatically check box and Compile when saving screen check box Keep these boxes checked off Ba Tgp tart E Grable E Here riera Iras ap fo ee ee erar E effete i a FF Creaisd cieo XOR diank igi Y i Ephem depar P irie drij Taria peat e a a D deer a bg cor Poe Toa Foci T Gw FF Ate araia Tana boca owes be WITEN Fie e ii m pi tam j 2 3 2 1 Creating a Part for Displaying Numerics 2 1 1 Arranging controls This section describes how to arrange a number indicator for displaying numeric values in the part creation window In this example use the number indicator control For details of the controls refer to the Control Reference Manual To arrange the number indicator control select Create on the menu select Control then select number indicator The number indicator setting dialog box appears Leave the default properties unchanged Do not forget that the control name is NUMOO00 Arkaute Arrangenant and cole Qpenviion parameter kara pa Acton G Monal C Ae f Bink P Flach Decimal point G Fad Float f Peedi Pariin c pai fF Fant G Ha C Full I Bot garg suppera inig Ganjil meer IM C gT E prg aom O HE
385. t within the set range e After LNEDSP LNESHIFT or PRDSP has been executed the set display range is released and the entire range display status is set e Line charts for which Blink or On and Off is specified are displayed within the entire range e When different ranges are set for two or more line charts within 100 milliseconds the last set range corresponds to the first line chart to be displayed All other line charts are displayed LNEDSP LNESHIFT PRDSP type id data SETLN EP LOT 2 07 30 lneshift lnegraph 1 1 40 end evnt 4 222 CHAPTER4 INSTRUCTION REFERENCE SETSIO eg SETSIO Statement E Function The SETSIO statement sets a non protocol communication reception method E Format SETSIO port number value m Example of Use SETSIO 2 amp HD E Description e The SETSIO statement sets the condition for issuing messages to BASIC of the part screen when data is received in the non procedual communication mode e port number specifies the port for which the non procedual communication mode is to be set e When the port specified in port number is in the binary mode value specifies the number of data to be received in bytes 0 cannot be specified When the port is in the text mode value specifies a terminator code 1 to OFFh of the received data e For the binary mode specify the number of bytes to be received from the connecting device When the specified number of
386. t writes transmission data to the same buffer serial port in the binary mode e port number specifies the channel CH1 to CH3 to which transmission data is to be written with a numeric value from 1 to 3 e Of the transmission data written to the variable specified by variable name number of bytes specifies the number of bytes to be transmitted valid when the binary mode is used e variable name specifies the name of the variable to which transmission data is written e In the text mode the written data is transmitted till the code Oh indicating the end of the character string is detected That is data from 1 to OFFh can be transmitted No terminator code is automatically inserted into the end of data e Inthe binary mode all data 0 to OFFh can be transmitted e The port to which transmission data is to be written must be opened by the OPENSIO statement in advance OPENSIO CLOSESIO WRITESIO WRITWSIOB SETSIO conf global buf S 200 opensio 2 1 bufs setsio 2 amp HD end conf evnt sendbufS ABCDEFG WRITES IO 2 sendbuf closesio 2 end evnt 4 252 CHAPTER4 INSTRU CTION REFERENCE WRITESIO WRITESIOB 4 253
387. tained AUTO BACKUP GLOBAL LOCAL STATIC STRING 4 67 DIM R m Example of Program conf DIM FLOAT 10 ID 5 MOJIS 10 40 for i 1 to 5 FLOAT i i 3 next end conf 4 68 CHAPTER4 INSTRUCTION REFERENCE DIR eg DIR Function E Function E Format m Example of Use E Description E Related Item The DIR function makes a list of directory or file data into character string variables and returns the number of created data i e the number of entries in the directory or file DIR directory name file attribute value offset value and character string variable NUM DIR A SUBDIR amp H20 6 LIST e A directory name can be specified in a full path name including a drive name or in an abbreviated name beginning with a current directory name Example A SUBDIRI1 SUBDIR2 SUBDIR2 SUBDIR3 e A file name instead of a directory name should be specified to create data of a single file e A file attribute value for selecting data to be created should be specified in a logical OR of the flags shown below amp HO1 Read only file amp H02 Hidden file amp HO04 System file amp HO08 Volume label amp H10 Sub directory amp H20 Standard file e An offset value is specified in order to exclude the first n data from data to be created e Each created data consists of a 40 byte record of the fixed length It is followed by detailed data as shown below Name Extension S
388. tem ATN COS TAN m Example of Program evnt angle 3 141592 3 x SIN angle numdsp num000 x end evnt 4 227 SLDDSP CE ei SLDDSP Statement E Function The SLDDSP statement displays data in the slide display E Format SLDDSP control name display data m Example of Use SLDDSP BUHIN GRAPH 30 0 E Description e control name is the slide display name or the D type variable indicating the slide display e display data is numeric data indicating the display position of the point graphic to be displayed in the slide display e display value cannot be changed even if this statement is issued to the display for which operation parameters are set to effective in the control E Related Item None m Example of Program evnt input type id data SLDDSP SLD000 data end evnt 4 228 CHAPTER4 INSTRUCTION REFERENCE SOF eg SOF Function E Function The SOF function calculates the size of a field E Format SOF file number m Example of Use AAA SOF file number E Description e file number is the file number defined in the FIELD declaration This size becomes the size of the file to be actually read or written e The size is calculated in bytes E Related Item FOPEN FIELD FCLOSE FPUT FGET EOF E Example of Program cont field 5 global no global mojilS moji2s end field global buff 50 opensio 1 0 buffs fopen C TEST 2 5 end co
389. tered objects in ascending order of their numbers When option is a negative value the RSTAT function checks the objects in descending order of their numbers If there is no object that is number specified by option away from the specified registration name the RSTAT function returns 1 GETGID GETGNO cont end conf evnt id getgid no RSTAT id 0 1 Checks the next registered screen if no lt gt 1 then jump no number end evnt 4 214 CHAPTER4 INSTRUCTION REFERENCE RUN eg arr RUN Statement E Function The RUN statement runs the specified program E Format RUN execution part screen m Example of Use RUN BUHIN E Description e The RUN statement issues a message to the part screen specified in execution part screen and runs the part screen program The message to be issued contains the message type and ID It however does not contain the issued data e The program to which a command was issued is not run when the RUN command is issued it is run when the program that issued the RUN command terminates e execution part screen is a screen name a part name or an D type variable E Related Item INPUT PRINT SEND E Example of Program evnt input ty id fig if ty 3 and id SWT000 then RUN BOOO endif end evnt 4 215 SELECT CASE END SELECT SELECT CASE END SELECT Statement E Function The statements satisfying the specified condition are executed
390. tes that the color and tile for which 1 was specified remain unchanged e control name is the plot display name or the D type variable indicating the plot display e plot color indicates the display color of a dot Specify this plot color with a numeric value from 0 to 15 e tile indicates the background tiling figure of the graph e Specify this tiling figure with a numeric value from 0 to 15 e display color is the numeric value indicating the color number of the tile display section Specify this color number with a numeric value from 0 to 15 e background color is the numeric value indicating the color number of the tile background section Specify this color number with a numeric value from 0 to 15 E Related Item PLTDSP E Example of Program conf static name name PLTOOO end conf evnt input types id data if types 3 then PLTCOLOR name 2 3 1 4 endif end evnt 4 180 CHAPTER4 INSTRUCTION REFERENCE PLTDSP pe PLTDSP Statement E Function E Format E Example of Use E Description E Related Item The PLTDSP statement displays data in the plot display PLTDSP control name display coordinate X display coordinate Y PLTDSP BUHIN GRAPH 15 30 e The PLTDSP statement displays data in the plot display e display name is the plot display name or the D type variable indicating the plot display e display coordinate X and display coordinate Y are the numeric data indicating the coordinates t
391. that received messages Messages can also be issued to the undisplayed screen rear screen The operation program that received messages on the rear screen also operates 3 12 Messa ge Format 3 12 Message Format A message is a trigger for operating an OIP program Each message consists of an issuer an issuer ID and issued data By the way each message can have one or more data Three types are as shown below 1 Value indicating the type of the message issuer integer type 2 Value indicating the ID of the message issuer ID type 3 Data itself type of data to be issued Use the INPUT instruction to read messages into a program Suppose for example that numeric data 10 was transmitted from the program whose screen name is SCREEN and whose part name is PART In this case the INPUT statement that reads messages is written as follows INPUT TYPES ID DATA TYPE Value 2 indicating that messages were transmitted from the part is set in TYPE ID GAME BUHIN indicating the ID of the transmitted part is set in ID DATA Data itself 10 inthis case oe The message format is as follows Screens Type of the message issuer 1 ID of the message issuer Screen name Data Data written in the PRINT statement Parts Type of the message issuer 2 ID of the message issuer Part name Data Data written in the PRINT statement Switches Type of the message issuer 3 ID of the message issuer Switch name Dat
392. the parallel IO is O and the next lowest order bit number is 1 That is the BIT number is sequentially incremented e If an unexisting port or BIT number is specified 0 is returned E Related Item INP OUT INPBIT OUTBIT OUTSTAT m Example of Program evnt data outbitstat 0 3 if data 0 then outbit 0 3 1 endif end evnt 4 176 CHAPTER4 INSTRUCTION REFERENCE OUTSTAT eg OUTSTAT Function E Function The OUTSTAT function reads the value of the specified output port E Format OUTSTAT port number m Example of Use DATA OUTSTAT 0 E Description e The OUTSTAT function reads the value of the specified output port e Specify port number with an integer value relative to 0 e If an unexisting port number is specified 0 is returned E Related Item INP OUT INPBIT OUTBIT OUTBITSTAT E Example of Program evnt datas outstat 0 if data 0 then out 0 amp hfffFf endif end evnt 4 177 PIPCOLOR ee PIPCOLOR Statement E Function The PIPCOLOR statement changes the OFF ON1 and ON2 colors of the pipe display E Format LAMPCOLOR display name ON OFF number color number m Example of Use LAMPCOLOR BUHIN GRAPH 5 E Description The PIPCOLOR statement changes the OFF ON1 and ON2 colors of the pipe display e display name is the name of the pipe display or the variable indicating the ID of the pipe display e ON OFF number specifies 0 1 or 2 for OFF ON1 or ON2 e co
393. tic VAR 10 for i 0 to 10 VAR 1 i 3 next end conf 4 92 CHAPTER4 INSTRUCTION REFERENCE FORMAT eg FORMAT Statement E Function The FORMAT statement initializes formats the specified file E Format FORMAT file name m Example of Use FORMAT A E Description file name specifies the name of the file to be initialized e A E or MEMORY can be specified as the drive name e When MEMORY is specified in drive name the contents of the file are filled with 0 e Be sure to execute the FORMAT statement when using the file for the first time E Related Item FOPEN FIELD FCLOSE FPUT FGET E Example of Program cont field 5 global no global mojilS moji2 end field global sum FORMAT MEMORY fopen MEMORY 2 5 end conf evnt nos 1 mojilS product name moji2S product number fput 5 7 3 fclose 5 end evnt 4 93 FPRINT ee FPRINT Statement E Function The FPRINT statement writes data to the specified file E Format FPRINT file number expression expression m Example of Use FPRINT 12 100 ABCD VAR STRING E Description The FPRINT statement writes the numeric value variable or character defined in expression to the file specified by file number A numeric value a character or a numeric or character variable can be specified in expression
394. time to 00 00 00 when it is turned on again The date and time are updated while the power is on E Related Item GETDATE GETTIME SETDATE SETTIME TIMES E Example of Program cont moji DATES strdsp STROOO moji end conf 4 63 DECLARE fee DECLARE Statement E Function The DECLARE statement declares a function E Format DECLARE function name type declaration character variable declaration variable declaration m Example of Use DECLARE ADD A B E Description e The DECLARE statement declares a type of a function used in a program Such declaration is called prototype declaration e A function itself is declared in one of the three manners as shown below Local function Defined in a program other than a global screen program Global function Defined in a global screen program Library function Defined in a library e The declared type of a function in the prototype declaration must be the same as the type of the function itself e This is one of the new features of Screen Creator 5 E Related Item FUNCTION FUNCTIONCHECK E Example of Program DECLARE my_add a b conf global x y local sum sums my_add x y end conf 4 64 CHAPTER4 INSTRUCTION REFERENCE DEVRD eg DEVRD Statement E Function The DEVRD statement reads the contents of the specified device E Format DEVRD device name offset value variable name m Example of Use DEVRD 00 D10
395. tion E Format m Example of Use E Description E Related Item m Example of Program COnE name end evnt con The LNEDSP statement displays data in the line chart display LNEDSP control name line number point number display data LNEDSP BUHIN GRAPH 2 2 30 0 e The LNEDSP statement displays line data in the line chart display e control name is the name of a line chart or the ID type variable indicating the chart e line number is the value indicating the line number in the line chart to be displayed The line number starts at 1 e point number specifies the data point to be changed in the line chart it is the integer type value starting at 1 The maximum point value depends on what line chart is placed e display value is the numeric data indicating the size of the specified line chart point e display value cannot be changed even if this statement is issued to the display for which operation parameters are set to effective in the control LNECOLOR LNESHIFT static name LNE000 input type id data lnedsp name 2 2 data end evn 4 138 CHAPTER4 INSTRUCTION REFERENCE LNESET pe LNESET Statement E Function The LNESET statement sets data in the line chart display E Format LNESET control name line number point number display data m Example of Use LNESET BUHIN GRAPH 2 4 30 0 E Description e The LNESET statement sets the data to be displayed in the line char
396. tion The EVENTWR statement declares the device s to which data is to be written E Format EVENTWR device name device name device name number m Example of Use EVENTWR 00 D01 00 D10 5 E Description e The EVENTWR statement declares the device s in a part or screen to which data is to be written This statement only declares the devices to which data is to be written it does not actually write data to the devices e Specifying number enables two or more devices to be continuously declared This continuous declaration however does not mean that data is written to all the declared devices at a time The DEVWR statement is used to actually write data to the declared devices e The devices to which data is to be written must be declared before the DEVWR statement is executed E Related Item CYCLIC DEVRD DEVWR m Example of Program conf EVENTWR OO7D10 5 gt Declares that data is to be written to end conf five devices from D10 evnt input types r id datas gt Writes 10 to the device whose offset devwr 00 D10 data S 10 gt value is data end evnt 4 77 EVNT END EVNT 8 EVNT END EVNT Statement E Function The EVNT END EVNT statements declares the event block area E Format EVNT END EVNT m Example of Use EVNT input ty id data END EVNT E Description e The event block is a program block that operates when it receives a message The contents executed when a switch is pres
397. tion reads the back light status E Format BLSTAT 0 m Example of Use E Description The BLSTAT function reads the current back light status ON OFF The return values of this function are as follows 0 The back light is off 1 The back light is on Related Item BLCTL m Example of Program conf ret BLSTAT if ret 0 then blctl 1 end conf 4 29 BLTCOLOR fe BLTCOLOR Statement E Function E Format m Example of Use E Description E Related Item E Example of Program evnt end evnt The BLTCOLOR statement changes the tile and color of a belt graph display BLTCOLOR control name zone position tile display color background color BLTCOLOR BLT000 2 1 2 3 e The BLTCOLOR statement changes the tile and color of the specified zone of a belt graph display 1 indicates that the color and tile for which 1 was specified remain unchanged e control name is the bar graph name or the D type variable indicating the bar graph e The value indicating the zone number to be changed is set in zone position The zone position can be specified with a constant or variable The zone position starts at 1 e tile indicates the tiling figure of the zone Specify this tiling figure with a numeric value from 0 to 15 e display color is a numeric value indicating the color number of the tile display section Specify this color number with a numeric value from 0 to 15 e background color is a numeric
398. to BCD data is greater than 99999999 it is fixed at 99999999 E Related Item BCD2BIN m Example of Program evnt input types id data data BIN2BCD datas 007D10 data end evnt 4 25 BITSET 8 BITSET Statement E Function The BITSET statement sets the specified bit of a variable to ON or OFF E Format BITSET variable name set position ON OFF value E Example of Use BITSET VARIABLE 10 1 E Description The BITSET statement sets the specified bit of the specified variable to Oor 1 e variable name specifies the name of the variable where the specified bit is set to O or 1 it must be an integer or floating point type variable e set position specifies where in the variable the specified bit is to be set with a value from 0 to 31 it must be a variable or constant e When 1 is set in the variable ON OFF value also specifies 1 When O is set ON OFF value also specifies 0 It must be a variable or constant E Related Item BITTEST E Example of Program conf end conf evnt if bittest input types id data numdsp NUMOOO data datas 31 1 then bitset data 31 0 else bitset data 31 1 endif numdsp NUM000 data end evnt 4 26 CHAPTER4 INSTRUCTION REFERENCE BITTEST eg BITTEST Function E Function The BITTEST function tests the specified bit of a variable E Format BITTEST variable name test position E
399. to the switch or the D type variable indicating the name For multi switches it is necessary to set switch numbers in the offset and to get switch IDs using the GETID command e status indicates that the normal switches are in any of the following statuses 0 OFF status 1 ON status e status indicates that the selector switches are in any of the following statuses 0 All selector switches are OFF Other values Numbers of the sub switches that are ON The sub switch number in the upper left end is 1 The sub switch numbers increase in the right direction They decrease in the downward direction The numbers of multi switches and selector switches are counted as 1 2 3 and so forth from the upper left switch When all switches are counted in the X direction the switches on the lower Y line are counted in the same way They are integers e When this statement is executed a message is issued as a switch is pressed e Executing the SWWRITE statement for the switch where synchronous operation is valid causes an error e The SWWRITE statement is invalid for the switch of the momentary type E Related Item GETID SWREAD 4 244 CHAPTER4 INSTRUCTION REFERENCE m Example of Program evnt input type id data id SW2 state swread ID if state 0 then SWWRITE id 1 endif end evnt 4 245 SWWRITE es __e TAN Function E Function The TAN function calculates a tangent for the specified num
400. tring specified in replacing character string the specified number of characters bytes starting from the specified start position If the specified number of characters is greater than the specified character string variable the character string is replaced only by the size of the variable For this reason the size of the character string variable remains unchanged even if the character string is replaced The start position of the character string to be replaced starts at 1 When number of characters is negative and start position is 0 or negative an error occurs LEFT RIGHT MID input type midS mojiS static mojis al BCDEFG id datas 4 3 data 4 150 CHAPTER4 INSTRUCTION REFERENCE MID eg a MID Function E Function The MID function returns a character string the specified number of characters E Format MID character string start position number of character MID registered character string number start position number of characters MID registered character string name start position number of characters m Example of Use A MID X 2 3 A MID 10 2 3 A MID NAME 2 3 E Description e The MID function fetches the specified number of characters bytes from the specified character string starting from the position specified in start position e character string is a direct character string or a character string variable e registered character stri
401. trira sirami 100 stria messed Sf dam mod 5 50 Petia ee mae b HH 2 42 CHAPTER2 EXAMPLES OF PROGRAMMING CHAPTER 3 CODING RULES 3 1 3 1 Usable Characters 3 3 2 1 Usable Characters Half size alphanumeric characters 0x20 to 0x7f ASCII codes half size Kana characters Oxa0 to Oxdf ASCII codes and full size characters 2 byte codes can be used to write programs As for the full size characters character strings enclosed in double quotation marks are valid As for the Kana characters device names and character strings enclosed in double quotation marks are valid Alphabetic characters can be written in either capital letters or small letters However capital alphabetic letters and small alphabetic letters are discriminated from each other when they are used in character strings What uppercase and lowercase letters are not identified means that variable function and subroutine names used in K Basic are handled as follows Label means the same as LABEL variable means the same as Variable CHAPTER 3 CODING RULES 3 2 Special Characters 3 2 Special Characters Some characters in OIP K Basic have special meanings These characters are called special characters The following special characters are used in OIP K Basic Period Used to delimit screen part and control Also used to represent a decimal point Example of using periods to delimit screen part and a c
402. ue from 0 to 3 can be specified in port number E Related Item OUT E Example of Program evnt vars inp 0 if var and 1 1 then var 0 OUT 0 var end evnt 4 117 INPBIT fee INPBIT Function E Function The INPBIT function reads the specified BIT number from the specified input port E Format INPBIT port number BIT number m Example of Use DATA INPBIT 0 10 E Description e The INPBIT function reads the specified BIT number from the specified input port e Specify port number and BIT number with an integer value relative to 0 e The lowest order bit number of the parallel IO is O and the next lowest order bit number is 1 That is the BIT number is sequentially incremented e If an unexisting port or BIT number is specified 0 is returned E Related Item INP OUT OUTBIT OUTBITSTAT OUTSTAT m Example of Program evnt data INPBIT 0 3 if data 0 then outbit 0 3 1 endif end evnt 4 118 CHAPTER4 INSTRUCTION REFERENCE INPUT eg INPUT Statement E Function The INPUT statement reads the data transmitted to a screen or part into the specified variable s E Format INPUT variable name variable name m Example of Use INPUT V1 ID DATA E Description e The INPUT statement reads the data transmitted to a screen or part e The integer value indicating the type of the sender that transmitted data is set in the first variable name The value indicating the ID of the sender is
403. umber CYCLIC 00 DO1 00 D10 5 CYCLIC 00 MTBL 100 OO MTBL 200 10 e The CYCLIC statement periodically reads the contents of the declared PLC device through communication If the previously read contents do not match the contents read by this statement change of contents a messages is transmitted to the declaring operation program This statement never operates during execution of the operation program because it makes a declaration e This declaration must be made before the device is used in the program e Communication occurs when data is read from the device example A 00 D0001 for which CYCLIC is not declared e To declare CYCLIC for the memory table the table number must be specified with an integer value e In the cyclic operation of the memory table a message is issued when data is written from the host computer or operation program to the memory table This message is issued even if the contents do not change e Specifying number following device name or memory table name enables CYCLIC to be continuously declared e When the screen is switched a message is issued to all the parts for which CYCLIC is declared INPUT 4 60 CHAPTER4 INSTRUCTION REFERENCE CYCLIC eg E Example of Program conf cyclic O0O d0O1l 00 d4 3 cyclic O00 7mtb1 20 00 mtb1 100 end conf evnt input ty id dat if id 00 mtb1 20 then numdsp num dat end if end evnt 4 61 CYCLIC2
404. umber directly with a numeric value from 1 to 16 it cannot be specified by a variable e To handle internal memory as a file the capacity of that memory must be set on the system mode screen in advance e Attempting to execute the FOPEN statement for an unformatted file causes an error E Related Item FCLOSE FIELD FPUT FGET FORMAT m Example of Program cont field 5 global no global mojilS moji2s end field FOPEN MEMORY 2 5 end conf evnt end evnt 4 91 FLUSH 8 FOR TO NEXT Statement E Function The instructions between the FOR statement and NEXT statements are repeatedly executed by the specified count Format FOR variable name start value TO end value STEP increment NEXT m Example of Use FOR I 1 TO 10 A D 3 NEXT E Description e variable name after the FOR statement specifies the variable used to count how many times the FOR to NEXT loop is repeated variable name must be an integer or floating point type variable e start value indicates the initial value The value of the variable increases by the value specified in increment each time the FOR to NEXT loop is repeated No negative value can be specified in increment When the increased value of the variable is greater than end value the statement following the NEXT statement is executed e One FOR to NEXT loop can be nested E Related Item WHILE WEND SELECT CASE E Example of Program cont sta
405. umber of characters RIGHTS registered character string name number of characters A RIGHTS MOJI 5 A RIGHTS 4 10 A RIGHTS TOROKU 8 The RIGHTS function returns a character string the specified number of characters bytes starting from the right of the specified character string number of characters specifies the number of bytes of the character string to be fetched with a numeric value from 0 to 255 When number of characters is 0 a null character string is returned character string is a direct character string or a character string variable registered character string number is the numerical expression indicating the number registered by Screen Creator registered character string name is the name of the character string created by Screen Creator or the D type variable indicating the name of the character string MID LEFT 12345678 IGHT b 3 IGHTS no 3 IGHTS id 4 4 211 RMDIR ae RMDIR Statement E Function The RMDIR statement deletes a directory E Format RMDIR directory name m Example of Use RMDIR TEST E Description e The RMDIR statement is an instruction for deleting a subdirectory e Specify the directory to be deleted with a character string constant or variable e The directory to be deleted can be specified in directory name together with a drive name E Related Item MKDIR CHDIR m Example of Program RMDIR C TEST end evnt 4
406. unction The EXIT FUNCTION statement exits a function forcedly E Format EXIT FUNCTION m Example of Use FUNCTION DIV A B IF B 0 THEN EXIT FUNCTION DIV A B END FUNCTION E Description e The EXIT FUNCTION statement gives an instruction to exit a function forcedly in a function block where the function itself is defined and returns the control to the side which called the function e This statement is one of the new features of Screen Creator 5 E Related Item DECLARE FUNCTION FUNCTIONCHECK m Example of Program declare my_div a b conf global x y local share share my_div x y end conf function my_div a b Vo if b S 0 then EXIT FUNCTION my_div a b end function 4 80 CHAPTER4 INSTRUCTION REFERENCE EXP PT EXP Function E Function The EXP function calculates the value of an exponential function for the base of a natural logarithm E Format EXP numerical expression m Example of Use VAR EXP A 2 E Description The EXP function returns the result of exponent operation for the base E of the natural logarithm E Related Item LOG E Example of Program evnt input ty id data if ty 3 then numdsp NUM000 EXP 10 else numdsp NUM000 EXP 5 endif end evnt 4 81 FCLOSE 8 FCLOSE Statement E Function E Format m Example of Use E Description E Related Item E Example of Program 4 82 The FCLOSE statement
407. use the function name in an expression as a variable or an argument of another function The program of the function ends when processing reaches end function and processing is handed over to the caller Use exit function to terminate processing of a function in the middle of a function program The following shows an example of user defined function declaration function my_div a b if b 0 then if a lt 0 then my_div 217483648 else my_div 217483647 end if exit function end if my_div a b end function 3 16 CHAPTER3 CODING RULES 3 10 User defined Functions 3 10 2 Definition positions of user defined functions and ranges of referencing The types of programs which can refer to user defined functions and the ranges of referencing differ with the positions where the functions are defined The user defined functions are classified into three types as shown below Global functions A global function has its function block written in the global screen program A global function can be read from any screen or part program Local functions A local function has its function block written a program for a screen other than the global screen A local function can only be called by the program in which it is defined Library functions A library function has its function block written in a function library under the control of Screen Creator 5 A library function can be read by any program 3 10 3 Ho
408. ust be the primitive in the local part e If the specified primitive is not using the PLC device memory table an error occurs ADDCYC ADDCYC2 conf addcyc NUMOOO0 end conf evnt input type id data id1l ADDCYCID NUMOOO i getoffset id1l id 1 device idl getid NUM000 i numdsp idl data end evnt gt Uses 2X2 as a consecutive stage display Displays data on the corresponding display Indicates the ID of the device being used Indicates the device to be used relative to the first Obtains the ID of the corresponding display gt Displays the ID on the display 4 13 ASC a l ASC Function E Function The ASC function specifies the first 1 byte character code of a character string E Format ASC character string m Example of Use AA ASC AABCD AA ASC MOJI E Description e The ASC function specifies the first character code of the character expression character string constant or variable enclosed in parentheses with a decimal number e The ASC function specifies only the initial 1 byte code of a character expression which begins with a Kanji character E Related Item CHR m Example of Program evnt input type id datas num ASC data numdsp NUM000 num end evnt 4 14 CHAPTER4 INSTRUCTION REFERENCE ATN E ATN Function E Function The ATN function calculates the inverse tangent for the numerical expression
409. value to be changed to an ID type timer number E Related Item TIMINT OPENTIM2 E Example of Program cont opentim2 2 settim 2 20 0 starttim 2 end conf evnt input type id if id timid 2 then end if end evnt 4 248 CHAPTER4 INSTRUCTION REFERENCE TIMID eg TIMINT Function E Function The TIMINT function changes an D type timer number to an an integer type timer number E Format TIMINT ID number m Example of Use VAR TIMINT ID E Description e ID number is the D type timer number to be changed to to an integer type timer number E Related Item TIMID OPENTIM m Example of Program id opentim no TIMINT id chktim no end evnt 4 249 TIMINT l VAL VAL2 Function E Function E Format m Example of Use E Description E Related Item m Example of Program conf The VAL VAL2 function converts the number specified in character string to a numeric value VAL character string VAL2 character string A VAL 123 A VAL2 123 45 e When the specified character string begins with a character other than 0to 9 E and the VAL VAL2 function returns 0 e If the specified character string contains an unconvertible character the VAL VAL2 function converts the characters before it e When the VAL function is used to convert the number specified in character string to a numeric value the result becomes real type e When the
410. value is the numeric data indicating the size of the pie chart to be displayed e display value cannot be changed even if this statement is issued to the display for which operation parameters are set to effective in the control CIRCOLOR static name name end con evnt CIR000 input type id zone data CI end evn CIROOO zone data 4 40 CHAPTER4 INSTRUCTION REFERENCE CIRSET eg CIRSET Statement E Function The CIRSET statement sets data in the pie chart display E Format CIRSET control name zone number display data m Example of Use CIRSET BUHIN GRAPH 2 30 0 E Description e The CIRSET statement sets the data to be displayed in the pie chart display The speed of executing the PRDSP display statement after setting data in each zone is faster than that of modifying all zone values after executing the CIRDSP statement e control name is the name of the pie chart display or the D type variable indicating the pie chart display e zone number indicates which zone data is to be modified The zone number is integer value data starting at 1 e display data is the numeric data indicating the size of each zone of the pie chart E Related Item CIRDSP PRDSP E Example of Program evnt CIRSET buhin gpaph 3 20 1 var buhin graph no 4 value 23 CIRSET var no value prdsp var end evnt 4 41 CLEAR l CLEAR Statement E Function The CLEAR
411. variable name e When an array or character variable is declared the DIM and STRING statements need not be declared e Use the DIM or STRING statement to specify a non global array and a character string type E Related Item AUTO BACKUP DIM LOCAL STATIC STRING m Example of Program cont GLOBAL var float GLOBAL mojiS 50 GLOBAL xyz 10 10 end conf 4 111 GOSUB ei GOSUB Statement E Function E Format m Example of Use E Description E Related Item E Example of Program evnt X 10 GOSUI B SUI The GOSUB statement executes the specified subroutine GOSUB subroutine name GOSUB SUBO001 e Control is transferred to the subroutine specified after the GOSUB statement e Subroutine names written in the global screen and those in the program containing the GOSUB statement can be specified Use the RETURN statement to return control e If the same name exists both in the global and local subroutines the global subroutine is called RETURN B001 numdsp end evn SUB001 ab X 3 RETURN NUM000 X 4 112 CHAPTER 4 INSTRUCTION REFERENCE GOTO be a GOTO Statement E Function The GOTO statement unconditionally moves control to the specified line E Format GOTO label name m Example of Use GOTO LABEL1 E Description The GOTO statement unconditionally moves control to the line specified by label name Execution is continued from the line to wh
412. ve to rewrite an operation parameter to change any device name without the need of changing the program A program example using templates is shown below init local type id data cyclic station number num connected device address end init conf end conf evnt input type S id data if type 16 and id T station number num connected device name then numdsp NUM000 data end if end evnt CHAPTER2 EXAMPLES OF PROGRAMMING 2 2 Creating a Part to be Linked to a PLC Device The station number and num connected device address templates are displayed in the Property of arranged part dialog box of the part having this operation program as shown below It is possible to input values for these templates of each arranged part 2 23 2 2 Creating a Part to be Linked to a PLC Device 2 2 2 Indicator lamps Display of MO bit status Goes on when the bit is turned on Goes out when the bit is turned off sii iy ly iy i my i pt Ss Sl hii ei i i aa a at a a Control to use One Lamp control LAMO000 Exterior view of part Figure Lamp control Note The Lamp control has a function to change the OFF color of its area to the ON color if it is set to ON So the figure of the Lamp area must be painted with the OFF color 2 24 CHAPTER2 EXAMPLES OF PROGRAMMING 2 2 Creating a Part to be Linked to a PLC Device A program of a indicator lamp to be linked to a PLC device is given below init
413. ven below init local type S id data end init conf end conf evnt input type S id data if types 3 and id SWT000 and data 1 then station number connected device address 1 else if type S 3 and id SWTO000 and data 0 then station number connected device address 0 end if 2 26 CHAPTER2 EXAMPLES OF PROGRAMMING 2 2 Creating a Part to be Linked to a PLC Device end evnt Initialization Block You don t have to use any cyclic instruction in this example because a value is only written to the PLC Configuration Block Nothing is processed Event Block input types id data The input instruction reads messages from the switch Messages are read in order of type 3 id SWT000 and data ON OFF 1 or 0 of switch if type 3 and id SWT000 and data 1 then else if type S 3 and id SWT0O0O and data 0 then end if type 3 means the message from the switch id SWT000 means the ID of the switch control data 1 means that the switch is pressed and data 0 means that the switch is released The following instruction is executed when these three conditions are satisfied simultaneously station number connected device address 1 In this statement 1 is written in the PLC device 0 may be written in the same manner The if statement of this program detects the moment the switch is pressed and writes 1 in the PLC device The el
414. vnt 4 225 SHIFT 8 SHIFT Statement E Function E Format m Example of Use E Description E Related Item m Example of Program conf end con evnt input numdsp The SHIFT statement shifts the contents of the specified variable left or right SHIFT variable name shift amount SHIFT VARIABLE 1 e The SHIFT statement shifts the contents bit string of the specified variable by the specified amount left or right e is set in the positions of the bits vacated as a result of the shifting e variable name specifies the variable name used to shift the bit string it must be an integer type variable e shift amount specifies how much the bit string in the variable is to be shifted A numeric value from 31 to 31 can be specified in shift amount When the specified shift amount is positive the SHIFT statement shifts the bit string left When it is negative the SHIFT statement shifts the bit string right None t types id datas NUMOOO data shif numdsp end evn t data 1 NUMO00 data t 4 226 CHAPTER 4 INSTRUCTION REFERENCE SIN PT SIN Function E Function The SIN function calculates a sine for the specified numerical expression E Format SIN numerical expression m Example of Use X SIN ANGLE E Description e The SIN function calculates a sine value for the specified numerical expression The unit for the numeric expression is radian E Related I
415. vnt input types id data if types 3 then VAR GETGID NO GETGNO VAR 00 D100 NO end if end evnt 4 107 GETID 8 GETID Function E Function E Format m Example of Use E Description E Related Item m Example of Program conf The GETID function obtains the value of the ID separate from the reference ID by offset GETID object indicated by reference ID offset value ID GETID VARID 10 The GETID function obtains the D type value separate from the reference D type value by the specified offset value object indicated by reference ID specifies an D type variable name a screen name a part name a registration character string graphic name or a device name offset value is the integer or real value indicating the offset from the reference ID to the ID to be obtained When 0 is specified in offset value the reference ID value is obtained When 1 is specified in offset value the ID of the first element of a continuous stage type control is obtained GETOFFSET cyclic 007 d0001 30 end conf evnt input ty id dat offset getoffset 00 d0001 id Error processing corresponding to the offset value etc id getid 00 d0001 o0ffset end evnt 4 108 CHAPTER4 INSTRUCTION REFERENCE GETOFFSET es GETOFFSET Function E Function The GETOFFSET function calculates the offset between the reference ID and specified ID E Format GETOF
416. w to call user defined functions To call a user defined function the user should declare the type of the function i e prototype declaration before all blocks of the program i e initialization block configuration block event block subroutine block and function block The following format is used to declare a function declare function name type declaration character argument 1 argument 2 The type of the function shown in 3 10 1 Definition of user defined functions is declared as shown below declare my_div a b Functions to be actually referenced are selected in the order of the library functions global functions and local functions If there are several types of functions having the same function name these functions are referenced in the order shown above By writing a LOCAL CHECK statement at the beginning of the program before function declaration it is possible to give an error indicating that function names are duplicate when compiling the program For details of using the LOCAL CHECK statement see Chapter 4 Instruction Reference 3 10 4 Variable declaration in user defined functions and referencing external variables It is possible to use auto variables in function blocks by declaring them It is impossible to declare other types of variables Global variables and local variables contained in operation programs can be referenced provided they can be referenced in the programs In other words it is po
417. whether to issue messages to the part on which the control is placed when sampling is performed by the control _PL_SMPMSG is applicable to plot bar graph and line chart displays When messages are issued to the part 1 is returned When no message is issued O is returned _PL_SMPTME reads a sampling time _PL_SMPTME is applicable to plot bar graph and line chart displays A value indicating the sampling time read value 0 5 second is returned _PL_DIRECT reads the display direction of a line chart _PLI_DIRECT is applicable only to line chart displays When line charts are displayed from right to left 0 is returned When they are displayed from left to right 1 is returned _SW_NUMS reads the number of switch elements _SW_NUMS is applicable to switches and selector switches For a switch 1 is always returned For a selector switch the number of elements is returned 4 197 PRMSTAT ee 28 29 30 31 32 33 34 _SW_TYPE Function Range Return value _SW_ONCOLOR Function Range Return value _SW_OFFCOLOR Function Range Return value _SW_BMODE Function Range Return value _SW_RACT Function Range Return value _SW_BZER Function Range Return value _SW_STAT Function Range Return value _SW_TYPE reads a switch type _SW_TYPE is applicable to switches and selector switches For the momentary switch O is returned For the alternate switch
418. writing value it must be an integer or floating point type variable or constant When specified in real value an integer type variable or constant is converted to a real number This value overwrites the specified character string variable name The value is converted into a 86 series boundary and saved MKS MKB MKW MKI MKID CVB CVW CVI CVF CVID orgS 1234567 strdsp MKF orgS strdsp end evnt STROOO org 27 Les 23 STROO1 org The character string will not be displayed gt correctly 4 154 CHAPTER4 INSTRUCTION REFERENCE MKI pe MKI Statement E Function The MKI statement stores data in any position of a character string variable E Format MKI character string variable name storage position integer value E Example of Use MKI MOJI 5 VAR E Description The MKI statement stores four bytes of integer value in the position specified by storage position starting from the beginning of the specified character string variable name e storage position must be a integer or floating point type variable or constant 1 specifies the beginning of the character string variable e integer value specifies an overwriting value it must be an integer or floating point type variable or constant When specified in integer value a floating point type variable or constant is converted to an integer This value overwrites the specified character string variable name e The value is converted
419. written is positive a blank is written before it When the data is negative a minus sign is written before it A blank is also written after the written numeric string When a character string is written no delimiter is inserted file number must match the number of the file opened by the FOPEN statement E Related Item FOPEN FCLOSE FPUT WRITE m Example of Program conf fopen Cs THST 2 5 end conf evnt vars 2 fprint 5 end evnt 123 45 var ABCD PO KRYZ Data is written to the specified file as follows A 123A A 45A 2A ABCDXYZ A indicates a blank 4 94 CHAPTER4 INSTRUCTION REFERENCE FPUT eg FPUT Statement E Function The FPUT statement writes data to the specified file E Format FPUT file number record number m Example of Use FPUT 5 3 E Description e The FPUT statement writes the contents of the variable group declared by FIELD END FIELD to the specified record record number in the specified file file number e file number specifies the number of the file to be written This file number must match the number of the file opened by the FOPEN statement e record number specifies the record in the file to which the contents of the declared variable group is to be written In this case the variable group included in FIELD is used as one unit record number is 1 when data is written to the beginning of the file E Related Item FOPEN FIELD FCLOSE FGET E
420. written to the specified file does not match that of the specified read variable the contents of the variable are undefined e file number must match the number of the file opened by the FOPEN statement E Related Item FOPEN FCLOSE FPRINT FWRITE LINPUT E Example of Program conf fopen C TEST 2 5 end conf evnt vars 2 fwrite 5 123 var ABCD XYZ fseek 5 O 0 finput 5 VAR1 VAR2 VSTR1S VSTR2 end evnt Data is written to the specified file as follows 123 2 ABCD XYZ CR LF When data is read the variables change as follows VAR1 123 VSTR1 ABCD VAR2 2 VSTR2 XYZ 4 89 FLUSH 8 FLUSH Statement E Function The FLUSH statement returns the write position of a non procedual communication reception buffer to the beginning of the variable E Format FLUSH port number m Example of Use FLUSH 2 E Description e The FLUSH statement enables received data to be written from the beginning of the variable to which the write position of the non procedual communication reception buffer was returned e port number specifies the port CH1 to CH3 to be flushed with a value from to 3 e Execute the FLUSH statement when a reception completion message is received Unless the FLUSH statement is executed the reception buffer may become full This statement only returns the write position of the reception buffer to the beginning of the variable
421. xed at 0 E Related Item INP m Example of Program evnt input type id data out 0 data end evnt 4 174 CHAPTER4 INSTRUCTION REFERENCE OUTBIT eg OUTBIT Statement E Function The OUTBIT statement rewrites the specified BIT number of the specified output port E Format OUTBIT port number BIT number write data E Example of Use OUTBIT 0 10 1 E Description e The OUTBIT statement rewrites the specified BIT number of the specified output port e Specify port number and BIT number with an integer value relative to 0 e When write data is 0 the output is set to OFF When 1 the output is set to ON e The lowest order bit number of the parallel IO is O and the next lowest order bit number is 1 That is the BIT number is sequentially incremented e If an unexisting port or BIT number is specified an error occurs E Related Item INP OUT INPBIT OUTBITSTAT OUTSTAT E Example of Program evnt DATA INPBIT 0 3 if data 0 then outbit 0 3 1 endif end evnt 4 175 OUTBITSTAT 8 OUTBITSTAT Function E Function The OUTBITSTAT function reads the specified BIT number of the specified output port E Format OUTBITSTAT port number BIT number m Example of Use DATA OUTBITSTAT 0 10 E Description e The OUTBITSTAT function reads the specified BIT number of the specified output port e Specify port number and BIT number with an integer value relative to 0 e The lowest order bit number of
422. y storage position starting from the beginning of the specified character string variable name storage position must be an integer or floating point type variable or constant 1 specifies the beginning of the character string variable integer value specifies an overwriting value it must be an integer or floating point type variable or constant When specified in integer value a floating point type variable or constant is converted to an integer The two low order bytes of this value overwrites the specified character string variable name The value is converted into a 86 series boundary and saved MKS MKB MKI MKF MKID CVB CVW CVI CVF CVID orgS 1234567 strdsp MKW orgS strdsp end evnt STROOO org 2 amp H3940 STROO1 org 4 158 CHAPTER4 INSTRUCTION REFERENCE MKW PT MOVE Statement E Function The MOVE statement moves the specified part E Format MOVE part name X direction move quantity Y direction move quantity move method m Example of Use MOVE BUHIN 100 20 0 E Description e part name is the name of the part to be moved or the D type variable indicating the part to be moved X direction move quantity and Y direction move quantity are the values indicating the distance in which the part is moved When the upper left end on the display screen is 0 0 the coordinates in the right direction are X coordinates and those in the downward direction are Y coordinates The m
423. ze and color of a dot are specified by the COLOR statement If this is used in an initialization block or configuration block drawing is executed after executing this block and accordingly points are not plotted Be sure to use this in an event block COLOR O 3 dot 100 200 dot 100 300 color 1 0 20 line 100 200 100 300 end evnt 4 72 CHAPTER4 INSTRUCTION REFERENCE DSPMODE PT DSPMODE Statement E Function The DSPMODE statement changes the display mode of the control E Format DSPMODE control name display mode m Example of Use DSPMODE NUMO00 2 E Description e The DSPMODE statement is a command that changes the display mode of the control e control name is the control name or the D type variable indicating control name e control mode specifies the mode in which the control is displayed The display mode is specified with any of the following numeric values 0 Normal display mode 1 Inverse display mode 2 Blink display mode The display color is replaced with the background color 3 On and off display mode The display status and nondisplay status are repeatedly displayed E Related Item NUMDSP STRDSP FIGDSP SLDDSP MTRDSP FREDSP PLTDSP BARDSP BLTDSP CIRDSP LNEDSP E Example of Program evnt input ty id data if id SWTOOO then DSPMODE NUMOOO 3 endif end evnt 4 73 EOF fee EOF Function E Function E Format m Example of Use E Description E Relate

Download Pdf Manuals

image

Related Search

Related Contents

資料4-5 リスクアセスメント・ガイドライン  BlueSerial.de  Samsung MW82N-B Наръчник за потребителя    user manual version 2  KDL-40W5100 - Manuals, Specs & Warranty  GL7-V manual  2.Specs. - Global Sources  TV de proyección LCD HD-Monitor Manual de instrucciones  T800 Movie Cube Theater  

Copyright © All rights reserved.
Failed to retrieve file