Академический Документы
Профессиональный Документы
Культура Документы
sensor blocks, control blocks and program blocks. Besides, several block
libraries that are not used frequently can also be called from the menu bar.
Actuator blocks include all electronic components that can perform certain
motions in case that they receive certain commands from a related controller.
Main commands from controller consist of DO (Digital Output) startup and
shutdown, DC (motor) rotation, voice, display, etc. Below is a list of detailed
blocks:
S.N. Icon Name Function
DC ports on the controller: DC0~DC3; Check
then become valid;
1. Start motor Speed variation: -100~100; if motor is
closed-loop motor, then have the option
Closed-loop selected;
DC ports on the controller: DC0~DC3; Once a
2. Stop motor DC port is selected, relevant motor will stop its
rotation;
It represents the LCD screen of the controller;
Ccon102 controller can display 8 lines of
3. Display
characters; numbers of characters in each line
cannot exceed 21.
It refers to the digital output function of I/O ports
on the controller; all on-off-type actuators can
use this function; Channel Number parameter
4. Digital output for this block corresponds to I/O port on the
controller, can select multiple options; Status
parameter corresponds to the DO on-off status
of the I/O port;
Page 24
Ccon102
Page 25
Ccon102
Sensor blocks include all collection modules that can gather environment
data for the controller. Controller collects environment data via functions such
as AI, DO, counter, etc. Below is a detailed list of sensor blocks:
S.N. Icon Name Function
Read analog input value from relative I/O port on
the controller; AI Channel Number corresponds
to I/O port number on the controller; Clicking AI
Analog Var1 can help you rename the variable; Clicking
1.
input Convert it to be a Compare block after
detection can switch the block to be a judgment
block; Condition loop block will be referred in
control blocks in detail;
Read analog input value from relative I/O port on
Light the controller; generally used by light sensor for
2.
detection data collection; refer to Analog input instruction
to find more details of its usage;
Read analog input value from relative I/O port on
Temp the controller; generally used by temp sensor for
3.
detection data collection; refer to Analog input instruction
to find more details of its usage;
Read analog input value from relative I/O port on
Greyscale the controller; generally used by greyscale sensor
4.
detection for data collection; refer to Analog input
instruction to find more details of its usage;
Page 26
Ccon102
Page 27
Ccon102
12. Reset time Clear system time, and start timing again;
In user program, return value from each port generally has either of the
below two functions: data storage or judgment making. And judgment making
is used more frequently. As to VJC software, three judgment modes are
available, they are: while sentence, ifelse sentence, for sentence.
If a program needs to make a judgment, there should be an object and
reference value. The object for comparison is often the return value of a certain
Page 28
Ccon102
Condition expression
Condition mentioned above is an expression including three parts: left
part, middle part and right part. Left and right part can be formulas, variables or
numerical values, while the middle part can be ==, !, =, >, <, >=, etc. Return
Page 29
Ccon102
value of such condition sentence only has two possibilities, they are 0 and 1. If
return value is 0, the condition is not met. If return value is 1, then the condition
is met.
When setting condition loop and condition judgment, you can find
Condition 1 and Condition 2. Usually we only use Condition 1. Condition
2 will become valid if Valid option on tab Condition 2 is selected. After
valid on tab Condition 2 is selected, other parameters for Condition 2 will
be activated (refer to below picture).
Detailed description:
Only when Valid selected will parameters for Condition 2 become
activated;
Logic relation means the relation between Condition 1 and Condition
2. Three logic relations are available, they are AND, OR and NOT (for C
language, &&, || and &&! instead). Parameters for AND, OR and NOT
can be formulas or values. Three results are available for the calculation:
Condition 1 AND Condition 2: when both conditions are met, result is 1,
or result is 0;
Condition 1 OR Condition 2: result will be 1 if one condition is met at
least, or result is 0;
Condition 1 NOT Condition 2: If return values for both conditions are
different, result is 1, otherwise result is 0;
Page 30
Ccon102
Page 31
Ccon102
For graphic blocks, you may find Variable option or sensor variable option.
After clicking that option, you will find a pop-up dialogue box as shown below.
The dialogue box is the variables box.
Variables box integrates all variables used in flow charts. Users can switch
types of variables by clicking icons of different sensors or others in the picture
as shown above. Then users can choose a serial number from 10 options
above icons on the picture as shown above. Highlighted option (yellow
Page 32
Ccon102
background) means the option is selected. There is also a key icon after the
selected option. In the area of icons, gray box means the variable type is
unavailable.
*Initialize*
This block is for setting the properties of line tracer. It determines which
port the motor or the grayscale sensor will be connected, output power of the
motor etc.
Page 33
Ccon102
Closed-loop Motor: If the motor that you use is a closed-loop motor, you
need to check this item. However, if your motor isnt, do not check this
item; otherwise, your motor will rotate at the max speed.
(Motor) Port: Two motors on the line tracer. One for the left wheel, one
for the right wheel. The user can decide which port the motor will be
connected to.
Power: The actual speed the motor generates is the speed value that
the user programs multiplies by the power value. If the power values are
positive but the robot moves backwards, the user can set the power
values negative. In this case, the user wont consider about turning
while setting the motor speed.
Number of Grayscale Sensors: If your robot is a line tracer with 7
grayscale sensors, please select 7 Grayscale Sensor; If yours is one
with 5 greyscale sensors, please select 5 grayscale sensors. If yours
is the one with neither 7 nor 5 grayscale sensors, then the Line Tracing
Blocks are not applicable, the user needs to customize by him/herself.
(Grayscale) Port: It determines which I/O port should one grayscale
sensor connects to.
Page 34
Ccon102
Types of Lines If the line is black (white ground), choose Black Line. If
the line is white (black ground), choose White Line. The user needs to
note that the white and black are concepts to grayscale sensors, for
example, glass is colorless, but the grayscale sensor will identify it as black.
Turn on DO?: This item determines whether to turn on the Digital Output. Select
Yes to switch on all the grayscale sensors.
Deviation of Threshold Value: The threshold value (i.e. critical value) usually refers
to (Minimum value + Maximum value)0.5. However, under some particular
circumstances, you may need the threshold value to deviate toward the minimum value by
decreasing the 0.5. The user needs to note that the threshold value shouldnt be too
small, like (2+8)0.5equals 5, if the user changes 0.5 into 0.1, the threshold value
will be invalid, because its even smaller than the minimum value.
Notices: The block of Initialize is for setting properties of the robot. No matter the line
tracing programs or threshold value of the grayscale sensor, the user needs to use this
block to start with. Usually, the block is at the beginning of a program. However, if types of
the lines change while the line tracer is moving, for example, black line on white ground
changes into white line on black ground, then the user needs to add another Initialize
block.
Initialize block can be seen as a block that stores information of the necessary robot
properties.
*Environment Gathering*
This block is used to gather the value of the ground grayscale. If the robot only
moves on one type of the ground, you only need to select
one type accordingly. If the robot moves on both types, you
need to check them both.
In the flow chart program, an Initialize block must be put
before the Environment Gathering block.
After being operated on the controller, the user can operate by
Page 35
Ccon102
instructions displayed on the controller. Take selecting both types as an example, the user
will go through some steps as following.
A. Move the arrow to select Yes by pressing Left or Right button, then press
ENTER to enter the interface of environment gathering. An instruction on the screen tells
you to put the grayscale sensors on the BLACK LINE.
B. Put the grayscale sensors on the BLACK LINE (refers to the black line on the
white ground that deviates to white the most), then press ENTER and wait until an
instruction appears on the screen telling you to put the grayscale sensors on the
WHITEGROUND.
C. Put the greyscale sensors on the WHITE GROUND (the blackest white ground
with black line on it), then press ENTER and wait until an instruction appears on the
screen telling you to put the grayscale sensors on the WHITE LINE.
D.Put the grayscale sensors on the WHITE LINE (the blackest white line on the
black ground), then press ENTER and wait until an instruction appears on the screen
telling you to put the grayscale sensors on the BLACK GROUND.
E. Put the grayscale sensors on the BLACK GROUND (the whitest black ground with
white line on it), then press ENTER and wait until an instruction appears on the screen
telling you that the environment gathering is OK (done).
F.If the block is followed by other program blocks, the program will go on after Step E
is complete.
Notices: There should be an Initialize block before the Environment Gathering block,
otherwise, the correct threshold value will not be gathered. The values will be stored in
EEPROM10-23 in turn, in which the values gathered from white ground with black line
will be stored in EEPROM10-16, and the values gathered from black ground with white
line will be stored in EEPROM17-23. If EEPROM is occupied in the program, do not use
EEPROM10-23; the user can change the threshold value directly in EEPROM10-23
instead of using Environment Gathering block.
*Intersection*
Page 36
Ccon102
Type of Intersection: The offset orientation of the intersections in one block. Two tips
for users to select the type of intersections. .
The same direction where the robot needs to turn to.
If the robot neednt to turn, choose one direction that has the less offsets.
Speed of Line Tracing: When the grayscale sensor in the middle is over the line, this
speed value is the speed of the motor that rotates faster.
Left Turn Speed Difference: When the grayscale sensor in the middle is over the line,
this difference value equals to Speed of Line Tracing minus speed of the left wheel(the
slower wheel).
Right Turn Speed Difference: When the grayscale sensor in the middle is over the line,
this difference value equals to Speed of Line Tracing minus speed of the right wheel (the
slower wheel).
Times of loops: This refers to how many intersections the line tracer will pass. A loop will
be complete when the line tracer passes one intersection. The Times of Loops is the
same as how many intersections needed to pass.
Time after Passing Intersection: How long the line tracer will move after passing the
intersection.
Car Stops after Completed: Whether the line tracer stops after the block is complete.
*Time*
Page 37
Ccon102
When theres no intersection or referential point on the way to destination, the line tracer
can be controlled by time. However, the distance the robot moves is determined by its
speed and time. The user can set time, not the speed which is affected by voltage,
frictional resistance etc. These factors cannot be controlled, so the distance/destination
the line tracer will move to cannot be precisely controlled.
*Advanced*
Page 38
Ccon102
This block will end with the return value of one sensor meeting the preset value, for
example, if an IR sensor is plugged into the NO.7 I/O port, the returning value when no
object is detected is 3000; when an object is detected, the returning value will be less than
500. The user can therefore set the line tracer to stop by AI(7)<500.
Sensor Port: The sensors I/O port number that responds to the termination of this
block.
Symbol: Mathematical notation that determines the relation of the return value and the
preset value.
Reference Value: The threshold value of the sensor that responds to the termination
of this block.
*Turn*
The robot motion is controlled by two motors, and turns are made by speed difference of
the two motors. If we think speed as pure numerical value (speed on the counter direction
will be represented as negative values), then the robot will turn to the side with smaller
speed value. This block will be complete for one time after the greyscale sensor crosses a
line.
Crossed Lines: Refers to the lines that itd crossed, for example, the line tracer needs
to turn 180 degrees by crossing 2 lines at a crossroad.
Stopped Position: It determines where the line tracer would stop over the
lineMiddle, Deviate to left or Deviate to right. The line tracer usually turns a little too
much because of inertia, so when the line tracer turns left at a relatively high speed, the
Page 39