Тёмный
No video :(

interfacing servo motor with pic16f877a mikro c and proteus | AL AMIN | Pic Mikro controller|Proteus 

AL AMIN
Подписаться 128
Просмотров 2,2 тыс.
50% 1

Components Required:
PIC16F877A microcontroller.
Servo motor.
Power supply for the servo motor (typically 5V).
Proteus simulation environment.
MikroC IDE for PIC programming.
Circuit Connection:
Connect the power supply's positive terminal (usually 5V) to the servo motor's red (power) wire.
Connect the power supply's ground (GND) to both the servo motor's black (ground) wire and the PIC16F877A's ground pin (e.g., pin 8).
Connect the signal wire (usually yellow or white) of the servo motor to one of the PIC16F877A's PWM-capable pins (e.g., CCP1, usually on pin RC2).
MikroC Code:
Here's a simple example of MikroC code to control the servo motor:
c
Copy code
void main() {
TRISC.F2 = 0; // Set CCP1 pin (RC2) as output
CCP1CON = 0x0C; // Set CCP1 module to PWM mode
T2CON = 0x04; // Timer2 settings: prescaler 1:1, TMR2ON = 1
PR2 = 249; // Set PWM period (20ms)
while (1) {
// Move servo to the leftmost position (0 degrees)
CCPR1L = 12; // Set the duty cycle for 0 degrees
Delay_ms(1000); // Wait for 1 second
// Move servo to the middle position (90 degrees)
CCPR1L = 24; // Set the duty cycle for 90 degrees
Delay_ms(1000); // Wait for 1 second
// Move servo to the rightmost position (180 degrees)
CCPR1L = 36; // Set the duty cycle for 180 degrees
Delay_ms(1000); // Wait for 1 second
}
}
Proteus Simulation:
Open Proteus and create a new project.
Add the PIC16F877A microcontroller from the library and connect it to the circuit.
Add a servo motor model from the Proteus library and connect it to the PWM output (RC2) of the PIC16F877A.
Set up a 5V power supply for the servo motor.
Compile your MikroC code and generate a HEX file.
Load the HEX file into the PIC16F877A microcontroller in Proteus.
Run the simulation.
You should see the servo motor moving from 0 to 180 degrees and back in a continuous loop.
Make sure you have the necessary libraries and components installed in Proteus and that your MikroC compiler is set up correctly. This example provides a basic idea of how to interface and control a servo motor with a PIC microcontroller using MikroC and simulate it in Proteus. You can further customize the code to achieve your specific requirements.

Опубликовано:

 

23 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 3   
@newmail3549
@newmail3549 11 месяцев назад
any google drive link for files?
@ALAMIN-jq4pf
@ALAMIN-jq4pf 11 месяцев назад
Yes
@ALAMIN-jq4pf
@ALAMIN-jq4pf 11 месяцев назад
At first try it to watch the video .Then can learn properly
Далее
Using Servo Motors with Arduino
43:06
Просмотров 1,4 млн
STM32 Servo Mastery in Proteus Simulation
11:59
Turn any DC Motor into a Servo Motor
25:24
Просмотров 285 тыс.
Damascus Steel From Stick Welding Electrodes
14:15
Просмотров 608 тыс.
The Bingo Paradox: 3× more likely to win
30:15
Просмотров 413 тыс.
servo motor control with pic
23:47
Просмотров 108 тыс.
Servomotor mikroc
5:15
Просмотров 5 тыс.