QNo.1 application on PIC 16F887 microcontroller: Write a program using MikroBasi
ID: 2250087 • Letter: Q
Question
QNo.1 application on PIC 16F887 microcontroller: Write a program using MikroBasic Pro to develop the following The four windings terminals (W1-W4) of a bipolar stepper motor are connected to RBO-RB3 respectively of 16F887 through suitable driving circuits. The microcontroller rotates the stepper motor clock-wise using the pulses given below starting from WI to W4. And it rotates the motor anti-clock-wise using the same pulses but in reverse order i.e. starting from W4 to WI W1 W2 W3 W4 0 0 0 0 0 A switch S1 is connected RA2. If S1 is OFF, the program will rotate the motor clock-wise. And if SI is ON, the program will rotate the motor anti-clock-wise. The time delay between sending each control pulse (step) is 0.2 seconds for both directions. Program should be keep on working in the same mannerExplanation / Answer
1.Code is as follows (using PIC 16F887)
void main()
{
ANSEL = 0;
ANSELH = 0;
PORTD = 0;
TRISD = 0;
while(1)
{
PORTD=0x09;
Delay_ms(500); //delay
PORTD=0x0C;
Delay_ms(500);
PORTD=0x06;
Delay_ms(500);
PORTD=0x03;
Delay_ms(500);
}
}
Note: You can adjust the delay to control the speed as per your wish just by changing the value in Delay_ms(500)
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.