beautypg.com

Figure 4-17 rotation direction control – FUJITSU CAN-Motor Board MB91F267N User Manual

Page 81

background image

AN07-00180-3E

- 81 -

The rotation direction routine is written around Line 221 in the MAIN.C main function as shown in

“Figure 4-17 Rotation direction control”.

When SW5 is set to the right side, the motor rotates to the right, and when it is set to the left side, the

motor rotates to the left.

Figure 4-17 Rotation direction control

void main(void)
{

(omitted)

/* main loop */
while (1)
{
if (!gCanEnableFlag)
{

(omitted)


/* Motor Rev Direction */
gMtRevDir = PDR2_P27;

/* Set Value */
gDirection = gMtRevDir;

(omitted)

}

(omitted)

}
}

←Acquisition of the rotation direction

←Configuration of the rotation direction