hi.,
I want to control DC motor(12V,<500mA) Speed and Direction also using PIC 16F877A Microcontroller.
How to implement it with H-Bridge(without using H bridge IC's).what are the ways to control the speed of the motor.
please explain what are the ways to generate PWM.
Think you are using Mikroe C, there should be plenty of examples /tutorials around on PWM.
The 877A has an inbuilt hardware pwm module so its easy enough to initiate.
To contol the motor you have two common ways of controlling it, a single transistor to drive the motor, using another pic output to turn a double pole relay on /off to change the motors polarity /direction.
Using a H bridge you use 2 sections for forwards and 2 sections for reverse.