View previous topic :: View next topic |
Author |
Message |
kbruin79
Joined: 02 Aug 2010 Posts: 30
|
PIC10f204 configuration |
Posted: Sun Mar 31, 2013 11:50 pm |
|
|
Hello,
I am trying to get a simple code running on a PIC10f204 to flash an LED. This is always my first step to make sure the GPIO pins are functioning properly. I wrote this code and unfortunately the PIC output GP1 pin never worked. Here is the code, any idea what I am missing ? I appreciate your comments. Thanks
Code: |
#include <10f204.h>
#use delay (CLOCK=4000000) //(clock=4M)
#fuses NOWDT, NOMCLR, NOPROTECT
#byte CMCON0 = 7
#bit CMCON0_3=CMCON0.3
void main(void)
{
//Turn off comparator
CMCON0_3=0;
while(1){
OUTPUT_HIGH(PIN_B1);
delay_ms(500);
OUTPUT_LOW(PIN_B1);
delay_ms(500);
}
}
|
|
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9221 Location: Greensville,Ontario
|
|
Posted: Mon Apr 01, 2013 3:13 pm |
|
|
first observations would be
1) *MCLR tied high ? or disabled ??
2) GP1 is used for programming, is it 'removed' from that when testing?
3) proper bit set to disable the comparator?
4) version of compiler issues ??
5) tested good LED ? Heck I've bought bad 'new' ones before ??
report back....
hth
jay |
|
|
kbruin79
Joined: 02 Aug 2010 Posts: 30
|
|
Posted: Mon Apr 01, 2013 4:29 pm |
|
|
Thanks for the reply, see my answers below.
temtronic wrote: | first observations would be
1) *MCLR tied high ? or disabled ??
MCLR set as input. So it's disabled
2) GP1 is used for programming, is it 'removed' from that when testing?
Yes it's removed from the programing circuit when tested
3) proper bit set to disable the comparator?
Yes, 3rd bit in the CMCON0 disables the comparator.
//Turn off comparator
CMCON0_3=0;
4) version of compiler issues ??
It's either 4.16 or 4.19 but I will check when I get home
5) tested good LED ? Heck I've bought bad 'new' ones before ??
I checked that too, LED is working.
report back....
hth
jay |
|
|
|
kbruin79
Joined: 02 Aug 2010 Posts: 30
|
|
Posted: Tue Apr 02, 2013 10:56 am |
|
|
Problem fixed, it was a programer issue. Thanks ! |
|
|
|