syedshan
Advanced Member level 1
- Joined
- Feb 27, 2012
- Messages
- 463
- Helped
- 27
- Reputation
- 54
- Reaction score
- 26
- Trophy points
- 1,308
- Location
- Jeonju, South Korea
- Activity points
- 5,134
Dear all,
I need to ask related to generating 1Khz clock using PIC, please suggest me something since I am beginner to PIC and have usually worked over FPGAs.
But I have to urgently make this 1Khz clock for our system.
Hence I applied this strategy that I take the LED blinking code from extreme electronic(which is famous among beginners) and targeted as the 1Khz clock instead of blinking LED, what do you guys suggest....The code is below.
Hence I intend to give the signal from the bit-0 of port-D as a clock signal...(please do not consider clock freq. now, just asking about the strategy)
Is this the correct way to do that. If not then what is the better and quicker way to generate the clock.
Bests,
Shan
I need to ask related to generating 1Khz clock using PIC, please suggest me something since I am beginner to PIC and have usually worked over FPGAs.
But I have to urgently make this 1Khz clock for our system.
Hence I applied this strategy that I take the LED blinking code from extreme electronic(which is famous among beginners) and targeted as the 1Khz clock instead of blinking LED, what do you guys suggest....The code is below.
Code:
#include <htc.h>
//#include <p18f4550.h>
__CONFIG(1,0x0F24);
__CONFIG(2,0X0000);
void Wait()
{
unsigned char i;
for(i=0;i<100;i++)
_delay(60000);
}
void main()
{
//Initialize PORTD
//PD0 as Output
TRISD=0b11111110;
//Now loop forever blinking the LED.
while(1)
{
LATD=0B00000001; //PORTD0 = HIGH
Wait();
LATD=0B00000000; //PORTD0 = LOW
Wait();
}
}
Hence I intend to give the signal from the bit-0 of port-D as a clock signal...(please do not consider clock freq. now, just asking about the strategy)
Is this the correct way to do that. If not then what is the better and quicker way to generate the clock.
Bests,
Shan