MikroElektronika PIC Microcontrollers PIC18 Instrukcja Użytkownika Strona 48

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 88
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 47
48 l Robotics experiment with PIC microcontroller
Listing 4-1 : The source code of motor.h library file for driving the DC motor
(continue)
/********** Motor B Forward ********/
void Motor_B_FWD()
{
Pwm2_Start();
PORTB.F1 =0;
PORTB.F2 =1;
}
/************************************/
/********** Motor A Backward *******/
void Motor_A_BWD()
{
Pwm1_Start();
PORTD.F0 =1;
PORTD.F1 =0;
}
/************************************/
/********** Motor B Backward *******/
void Motor_B_BWD()
{
Pwm2_Start();
PORTB.F1 =1;
PORTB.F2 =0;
}
/************************************/
/********** Motor A Off ************/
void Motor_A_Off()
{
Pwm1_Stop();
PORTD.F0 =0;
PORTD.F1 =0;
}
/************************************/
/********** Motor B Off ************/
void Motor_B_Off()
{
Pwm2_Stop();
PORTB.F1 =0;
PORTB.F2 =0;
}
/************************************/
/********** Go Forward ************/
void Forward(char speed)
{
Motor_Init();
Change_Duty(speed);
Motor_A_FWD();
Motor_B_FWD();
}
/************************************/
Przeglądanie stron 47
1 2 ... 43 44 45 46 47 48 49 50 51 52 53 ... 87 88

Komentarze do niniejszej Instrukcji

Brak uwag