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

Timing problem with PIC18F2620

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



Joined: 25 Jan 2007
Posts: 5

View user's profile Send private message

Timing problem with PIC18F2620
PostPosted: Thu Jan 25, 2007 11:06 am     Reply with quote

I starting to work with PIC18F2620 and I simply trying to test output port...

//**************

void main()
{

setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_OFF|ADC_TAD_MUL_0);
setup_spi(FALSE);
setup_wdt(WDT_OFF);
setup_timer_0(RTCC_INTERNAL);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);

while(1)
{
output_bit(PIN_A0, 1);
delay_ms(50000);
output_bit(PIN_A0, 0);
delay_ms(50000);
}
}

//**************

#include <18F2620.h>
#device ICD=TRUE
#device adc=8
#fuses NOWDT,WDT128,HS, NOPROTECT, NOIESO, NOBROWNOUT, BORV21, NOPUT, NOCPD, STVREN, DEBUG, NOLVP, NOWRT, NOWRTD, NOEBTR, NOCPB, NOEBTRB, NOWRTC, NOWRTB, FCMEN, XINST, NOPBADEN, LPT1OSC, MCLR
#use delay(clock=20000000)

//**************

I cannot obtain the good delay, I got 2us high and 2us down. I got a 20MHz x-tall. Maybe I've fogot a fuse or something. Anybody can help me on this?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jan 25, 2007 12:04 pm     Reply with quote

Quote:
while(1)
{
output_bit(PIN_A0, 1);
delay_ms(50000);
output_bit(PIN_A0, 0);
delay_ms(50000);
}
}

The delays are too long. Change them both to 500.


Quote:
#include <18F2620.h>
#device ICD=TRUE
#device adc=8
#fuses NOWDT,WDT128,HS, NOPROTECT, NOIESO, NOBROWNOUT, BORV21, NOPUT, NOCPD, STVREN, DEBUG, NOLVP, NOWRT, NOWRTD, NOEBTR, NOCPB, NOEBTRB, NOWRTC, NOWRTB, FCMEN, XINST, NOPBADEN, LPT1OSC, MCLR
#use delay(clock=20000000)

CCS doesn't support the Extended Instruction Set. Change the fuse
to NOXINST.
Corta



Joined: 25 Jan 2007
Posts: 5

View user's profile Send private message

PostPosted: Thu Jan 25, 2007 1:56 pm     Reply with quote

wow it's work!
Thank you very much!
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