CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

help with internal oscilator on PIC16F628

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
esorato



Joined: 10 Nov 2005
Posts: 4

View user's profile Send private message Send e-mail

help with internal oscilator on PIC16F628
PostPosted: Thu Nov 10, 2005 6:01 am     Reply with quote

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: 1636
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Thu Nov 10, 2005 6:15 am     Reply with quote

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

View user's profile Send private message Send e-mail

PostPosted: Thu Nov 10, 2005 6:55 am     Reply with quote

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: 1636
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Thu Nov 10, 2005 7:49 am     Reply with quote

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

View user's profile Send private message Send e-mail

PostPosted: Thu Nov 10, 2005 7:53 am     Reply with quote

OK.
Thank�s. I�ll try this.
esorato



Joined: 10 Nov 2005
Posts: 4

View user's profile Send private message Send e-mail

PostPosted: Fri Nov 11, 2005 5:38 am     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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