We will make a simple H-Bridge using transistors to use it as an interfacing circuit between micrcontroller and DC motor
Code:
#define M3 PORTC.F0#define M1 PORTC.F1#define M4 PORTC.F2#define M2 PORTC.F3void main() {unsigned char dutyCyle ;TRISC = 0 ; PORTC = 0 ;M3 = 0 ;M2 = 0 ;M1 = 0 ;M4 = 0 ;while(1){M2 = 0 ; M4 = 0 ;M3 = 0 ; M1 = 1 ;Delay_ms(2000) ;M3 = 0 ; M1 = 0 ;M2 = 0 ; M4 = 1 ;Delay_ms(2000) ;}}
No comments:
Post a Comment