View previous topic :: View next topic |
Author |
Message |
esorato
Joined: 10 Nov 2005 Posts: 4
|
help with internal oscilator on PIC16F628 |
Posted: Thu Nov 10, 2005 6:01 am |
|
|
Hi guys
I�m new in this group and I�m having a trouble with internal oscilator.
I did the test program bellow:
//teste.c
#include "C:\temp\ODO\teste.h"
#define testepin PIN_A0 // Move asento para cima
void main()
{
port_b_pullups(TRUE);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
while(true)
{
delay_ms (10); // delay antes de ler o dado
output_low(testepin);
delay_ms (10); // delay antes de ler o dado
output_high(testepin);
}
}
//teste.h
#include <16F628.h>
#fuses NOWDT,INTRC_IO, PUT, NOPROTECT, BROWNOUT, MCLR, LVP, NOCPD
#use delay(clock=4000000)
I expected that testepin changes is state every 10ms but nothing happens.
I�m suspecting of internal oscilator programming but I�m not sure.
Someone could help me ?
thank�s
Edson |
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1635 Location: Perth, Australia
|
|
Posted: Thu Nov 10, 2005 6:15 am |
|
|
Depending on your circuit, you may need to change LVP to NOLVP. You may also need to disable the analog input on A0 (I have not looked at the datasheet for this processor). _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
|
esorato
Joined: 10 Nov 2005 Posts: 4
|
|
Posted: Thu Nov 10, 2005 6:55 am |
|
|
Thank�s
I�m programming with PicStart Plus (stand alone not in circuit).
I�m using the configuration bits of MPLAB to program and I�m enabling Low voltage Program.
Regarding the configuration of A0: If I use the project wizard and configure the port to output I�m not disabling analog input ???
Edson |
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1635 Location: Perth, Australia
|
|
Posted: Thu Nov 10, 2005 7:49 am |
|
|
Quote: | I�m enabling Low voltage Program. |
This is probably your problem. Set the NOLVP fuse.
Quote: | Regarding the configuration of A0: If I use the project wizard and configure the port to output I�m not disabling analog input ??? |
I noticed there was no SETUP_ADC_PORTS() function call in the code you have listed to select digital I/O however this should not be a problem as you are using the port as an output. _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
|
esorato
Joined: 10 Nov 2005 Posts: 4
|
|
Posted: Thu Nov 10, 2005 7:53 am |
|
|
OK.
Thank�s. I�ll try this. |
|
|
esorato
Joined: 10 Nov 2005 Posts: 4
|
|
Posted: Fri Nov 11, 2005 5:38 am |
|
|
Hi,
It worked.
But it�s strange because when I use CC5x itsn�t necessary change to no low voltage program.
Anyway... it�s working.
Tank�s
Edson |
|
|
|