|
|
View previous topic :: View next topic |
Author |
Message |
Guest
|
MCLR problem?? |
Posted: Fri Jun 24, 2005 7:33 am |
|
|
Hi all, i am very new to PIC, and have got a small problem. I have got a PICF877A. I am, for now, trying to flash a LED. I have got a 4MHz resinator, and the MCLR pin is high with a 10k and a .1uf cap. I have check for +5 on MCLR and it is OK. When i power on, the LED just stays on. I can make the thing work by touching the OCS1 pin with my bare hand, but when i let go, it will stop. I have also used a 20MHz crystal and a PICF84A without much luck. Here is my code just incase i am doing somthing wrong.
#include <16F877a.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=4000000)
void main() {
while (TRUE) {
output_high(PIN_A0);
delay_us(500);
output_low(PIN_A0);
delay_us(500);
}
}
Thank you very much
Mark Demczuk |
|
|
Guest
|
|
Posted: Fri Jun 24, 2005 7:53 am |
|
|
The first thing I would do would be to change the delay_us to delay_ms since 500 us is .5 milliseconds - very fast. It would probably appear to be ON all of the time. |
|
|
Markdem
Joined: 24 Jun 2005 Posts: 206
|
|
Posted: Fri Jun 24, 2005 8:08 am |
|
|
Thank you so much, i cant belive i did that. Set time to 2000 and it works
Mark |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Fri Jun 24, 2005 10:42 am |
|
|
@4MHz you should be using XT instead of HS |
|
|
Guest
|
Re: MCLR problem?? |
Posted: Thu Jan 26, 2006 2:27 am |
|
|
Anonymous wrote: | Hi all, i am very new to PIC, and have got a small problem. I have got a PICF877A. I am, for now, trying to flash a LED. I have got a 4MHz resinator, and the MCLR pin is high with a 10k and a .1uf cap. I have check for +5 on MCLR and it is OK. When i power on, the LED just stays on. I can make the thing work by touching the OCS1 pin with my bare hand, but when i let go, it will stop. I have also used a 20MHz crystal and a PICF84A without much luck. Here is my code just incase i am doing somthing wrong.
#include <16F877a.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=4000000)
void main() {
while (TRUE) {
output_high(PIN_A0);
delay_us(500);
output_low(PIN_A0);
delay_us(500);
}
}
Thank you very much
Mark Demczuk |
|
|
|
rnielsen
Joined: 23 Sep 2003 Posts: 852 Location: Utah
|
|
Posted: Thu Jan 26, 2006 9:13 am |
|
|
The Guest phantom Quote poster has struck again....
One reason to get rid of Guest posting. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|