Professional Documents
Culture Documents
c
/*
* File:
: LEDOn.
.c
* Author:
: piyathil
*
* Created on March 22, 2023, 10:07 AM
*/
#i
include <stdio.h>
#i
include <stdlib.h>
#i
include <p18f4321.h>
#i
include <delays.h>
void main(void) {
TRISCbits.
.TRISC4=
=0; // Make RC4 as output
LATCbits.
.LATC4 =1; //T
Turn LED D3 ON, This is only for testing
TRISBbits.
.TRISB3 = 0; // This is the Enable A pin
TRISBbits.
.TRISB2 = 0; // This is the Phase A - Directional control pin
LATBbits.
.LATB2=
=1; // this is the direction control bit
LATBbits.
.LATB3=
=0; // Enable pin on time
Delay10TCYx(
(on_time)
);
LATBbits.
.LATB3=
=1; // Enable pin off time
Delay10TCYx(
(period-
-on_time);
};
return;
}