View previous topic :: View next topic |
Author |
Message |
i2c2k Guest
|
16F675 doesn't work |
Posted: Tue Dec 07, 2004 1:22 pm |
|
|
hi!
i wanted to try out a PIC16F675 with internnal resonator but i wasn't successfull.
i set INTRC for internal clock and connected CLKOUT to oscilloscope and MCLR to hi level. i measured the internal clock but the programme doesn't start. it's a simple progamme that clears the whole tris-a-register (all outputs) and switches GP0 (A0) on and off in a but i can't measure a signal at GP0.
doesn anybody know a solution for my problem?
thanks! |
|
|
mnv
Joined: 04 Aug 2004 Posts: 7
|
|
Posted: Tue Dec 07, 2004 1:25 pm |
|
|
sorry, i meant the 12F675!! |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Tue Dec 07, 2004 1:37 pm |
|
|
Which compiler version are you using?
Post your program. |
|
|
Guest
|
|
Posted: Tue Dec 07, 2004 1:59 pm |
|
|
i used the 3.150 compiler
this is the source code:
Code: |
#include <12f675.h>
#fuses INTRC,NOWDT,NOPROTECT,MCLR,BROWNOUT
#use delay(clock=4000000)
void main(void)
{
delay_ms(1); //for "security" purpose
setup_comparator(NC_NC_NC_NC);
setup_adc(NO_ANALOGS);
set_tris_a(0b00000000);
while (1) {
output_a(0xff);
delay_ms(100);
output_a(0x00);
delay_ms(100);
}
}
|
...so the led connected on any GP-pin should blink. right? but it doesn't and i have no idea why |
|
|
future
Joined: 14 May 2004 Posts: 330
|
|
Posted: Tue Dec 07, 2004 2:17 pm |
|
|
One thing I see... from datasheet.
� Operating speed:
- DC - 20 MHz oscillator/clock input
- DC - 200 ns instruction cycle
Are you using a 40mhz crystal? |
|
|
mnv
Joined: 04 Aug 2004 Posts: 7
|
|
Posted: Tue Dec 07, 2004 2:20 pm |
|
|
no, i use internal crystal (INTRC-fuse).
might the missing crystal-calibration cause such a problem and how can i calibrate the crystal if needed?
thx!!! |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Tue Dec 07, 2004 4:44 pm |
|
|
Quote: | ...so the led connected on any GP-pin should blink. right? |
No, not all pins can be used as general I/O pins:
- GP3 can only be an input, not output.
- GP4 is now configured as clock output (change your fuse #INTRC to #INTRC_IO if you want to use GP4 for general purpose I/O.
Some suggestions:
- Increase the delay so the led will blink only once a second. Now it is blinking 5 times a second which might be difficult to see.
- Add a PUT fuse setting, this will improve startup stability.
- Double check your led is not reverse connected. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Dec 07, 2004 6:29 pm |
|
|
I took your program and compiled it with PCM vs. 3.150.
I don't have a 12F675, so I programmed it into a 12F629,
which is a very similar chip. It worked.
I have +5v connected to pins 1 and 4 on the chip,
and Ground connected to pin 8. Verify that you
have those same three connections.
When the program is running, I can see about a 5 Hz
square wave on pins 7, 6, 5, and 2. On pin 3, I see
about a 1 MHz square wave. |
|
|
Guest
|
|
Posted: Wed Dec 08, 2004 4:55 am |
|
|
thanks for your efforts @PCM programmer!
i assume i did everything possible so i will wait for my 12F629-samples.
as i read in this forum the 12F675 comes with some problems and i'm not the only person who has them.
@ckielstra
it doesn't even work with the PUT fuse. and for my oscilloscope the signals that should be supplied by one of the 5 GP-pins should be displayable. well... it just doesn't work. the programme doesn't start up because even the set_tris-command isn't processed (HI-Z on every available GP-pin). |
|
|
|