Вы находитесь на странице: 1из 7

Program Structure Design Document

Module Structural Diagram


main() Operate the Autonomous robot Rotation angle

Drive mode
wait_port_ready( )

stop() Stop

wait_start() Wait start switch on

start() Drive beginning

tracking_ctrl() Running control

turn() Turn 180 degree

Wait buffering

operation

stop() Stop operation SW2 Motor speed counter

wait_start() Wait start switch on detection 10ms counter progress

set_l_speed() Set the right motor speed

set_r_speed() Set the left motor speed

get_SW2() get SW2 counter

get_time10() Get 10ms counter

. . . . . . Date Revision Contents

Date
Prepared by

Page CTTC

15

Program Structure Design Document


Module Structural Diagram
start() Drive beginning

Initial Motor speed

init_drive()

initial drive

Left motor interrupt flag Right motor interrupt flag

Motor speed

get_iflag_l() Get int flag for left motor

get_flag_r() Get int flag for right motor

set_l_speed() Set the right motor speed

set_r_speed() Set the left motor speed

. . . . . . Date Revision Contents

Date
Prepared by

Page CTTC

25

Program Structure Design Document


Module Structural Diagram
tracking_ctrl() Running control

Sensor value

get_sensor() Get line sensor

accel_ctrl() Acceleratio n control

decel_ctrl() Deceleration control

turn() Get 10ms counter

stop() stop operation

accel_ctrl() Acceleration control 10ms counter progress Motor speed Motor speed get_time10() Get 10ms counter get_period_acc() Calculate acceleration speed decel_ctrl() Deceleration control Motor speed

set_l_speed() Set the right motor speed

set_r_speed() Set the left motor speed

10ms counter

progress Motor speed get_period_dec( ) Calculate deceleration

Motor speed

get_time10() Get 10ms counter

set_l_speed() Set the right motor speed

set_r_speed() Set the left motor speed

. . . . . .

Date
Prepared by

Page

35

Date

Revision Contents

CTTC

Program Structure Design Document


Module Structural Diagram
turn() turn 180 degree

Right motor int flag init_drive() Begin initial drive get_flag_r() Get int flag for right motor stop() stop operation

tmint_200us() Interrupt every 200us

Drive mode

is_run() Check drive or not

. . . .

Date
Prepared

by

. . Date Revision Contents

Page CTTC

45

Program Structure Design Document


Module Structural Diagram

tmint_100us() iflag_l

get_iflag_l()

tmint_100us() iflag_r

get_iflag_r()

tmint_1ms() sensor

get_sensor()

tmint_100us()

set_r_speed()

tmint_100us()

set_l_speed()

tmint_1ms() tsw

get_tsw()

buf_r_timer r_direction

buf_l_timer l_direction

tmint_1ms()

get_time2()

tmint_1ms()

get_time10()

tmint_1ms() is_fix

wait_fix()

over_2ms

over_10ms

int_SW2()

get_sw2()

iflag_sw2

. .

Date

. . . . Date Revision Contents

Prepared by

Page CTTC

55

Вам также может понравиться