akshat mishra
Newbie level 4
- Joined
- Jul 6, 2013
- Messages
- 6
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 51
I am using pic18f97j60
I want led to blink for 1 sec. Below i pasting my code i don't know what it is going wrong with that program
Timer frequency is 32 khz.
#include <p18f97j60.h>
unsigned int i=0;
void Delay_1s(void);
void init_timer1(void);
void main(void)
{
init_timer1();
TRISJbits.TRISJ1 = 0;
LATJbits.LATJ1=0;
while(1)
{
Delay_1s();
LATJbits.LATJ1 = 1;
Delay_1s();
LATJbits.LATJ1 = 0;
}
}
void Delay_1s()
{
unsigned int i = 0;
for (i=0; i<20; i++)
{
TMR1L = 55;
while(TMR1L != 255 );
}
}
void init_timer1()
{
T1CONbits.TMR1CS = 1;
T1CONbits.T1CKPS = 3;
T1CONbits.RD16 = 1;
T1CONbits.T1OSCEN = 1;
T1CONbits.T1SYNC = 1;
T1CONbits.T1RUN = 1;
T1CONbits.TMR1ON = 1;
}
Give me solution .
I want led to blink for 1 sec. Below i pasting my code i don't know what it is going wrong with that program
Timer frequency is 32 khz.
#include <p18f97j60.h>
unsigned int i=0;
void Delay_1s(void);
void init_timer1(void);
void main(void)
{
init_timer1();
TRISJbits.TRISJ1 = 0;
LATJbits.LATJ1=0;
while(1)
{
Delay_1s();
LATJbits.LATJ1 = 1;
Delay_1s();
LATJbits.LATJ1 = 0;
}
}
void Delay_1s()
{
unsigned int i = 0;
for (i=0; i<20; i++)
{
TMR1L = 55;
while(TMR1L != 255 );
}
}
void init_timer1()
{
T1CONbits.TMR1CS = 1;
T1CONbits.T1CKPS = 3;
T1CONbits.RD16 = 1;
T1CONbits.T1OSCEN = 1;
T1CONbits.T1SYNC = 1;
T1CONbits.T1RUN = 1;
T1CONbits.TMR1ON = 1;
}
Give me solution .
Last edited: