Preview

Lab Report for Motor Control

Good Essays
Open Document
Open Document
1108 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Lab Report for Motor Control
Exericise 1
In function “void Exercise_One()”, the third parameter “0xfe” of “cbDout(BOARD_NUM_0,FIRSTPORTA,0xfe)” is used to controlled “on-and-off” status of each coils; Specifically, the binary value of second digit of the hexadecimal number indicates that status, “1” for “off” while “0” for “on”; For example, “e” in binary is 1110, coil A is turned on (controlling coil A to D from the most right bit to most left).
So to turn on coil C only, a binary number 1011 (in hexadecimal “b”) is needed and the code for it is shown as follows: cbDout(BOARD_NUM_0,FIRSTPORTA,0xfb) Similarly to turn on coil C and D, a binary number 0011(in hexadecimal “3”) is needed and the code for it is shown as follows: cbDout(BOARD_NUM_0,FIRSTPORTA,0xf3) Exercise 2
A counter-clockwise would be a reversed version of “Full_Step_CW()” as follows: void Full_Step_CCW()
{
unsigned short Step_Code ; switch ( Step_Number) { case 0 : Step_Code = 0x09; break; case 1: Step_Code = 0x05; break; case 2: Step_Code = 0x06; break; case 3: Step_Code = 0x0a; break; default: Step_Code = 0x0f; break; cbDout(BOARD_NUM_0,FIRSTPORTA, Step_Code);
Step_Number++;
If(Step_Number == 4) Step_Number = 0;
}
}
According to table 1, a Full_Step_CW() , going from ‘a’ , ‘6’, ‘5’ to ‘9’ would rotate clock wise 7.5 degree per step. Then going from ‘9’, ‘5’, ‘6’ to ‘a’ would make it rotate counter clockwise and by calling it each time, the motor would rotate 1 step.
To rotate counter-clockwise, in function “void Exercise_Two() “, the following code should be added. This would call the function “Full_Step_CCW()” 12 times. For the cases where the global variable “Step_Code”, it would be reset back to 0; int a; for(a=0; a<12; a++) { Full_Step_CCW(); Sleep(1000); }
Exercise 3
By using the results in table 2 and similar principle in Exercise 2, the following two functions are written: void Half_Step_CW()
{
unsigned short Step_Code ; switch (

You May Also Find These Documents Helpful