Download V+ Language User`s Guide Version 11.0
Transcript
100 Chapter 5 - Functions Examples of String Functions The instruction: TYPE $ERROR(-504) will output the text “*Unexpected end of file*” to the screen. The instructions: $message = "The length of this line is: " TYPE $ENCODE($message, /I0, LEN($message)+14), " characters." will output the message “The length of this line is: 42 characters.” 5.3 Location, Motion, and External Encoder Functions V+ provides numerous functions for manipulating and converting location variables. See Chapter 7 for details on motion processing and a table that includes all location related functions. See Appendix B for details on the external encoders. Examples of Location Functions The instruction: rotation = RZ(HERE) will place the value of the current rotation about the Z axis in the variable “rotation”. The instruction: dist = DISTANCE(HERE, DEST) will place the distance between the motion device’s current location and its destination (the value of the next motion instruction). The instructions: IF INRANGE(loc_1) == 0 THEN IF SPEED(2) > 50 THEN SPEED 50 END MOVE(loc_1) END will ensure “loc_1” is reachable and then move the motion device to that location at a program speed not exceeding 50.