| 
	
	|  |  |  
	
		| View previous topic :: View next topic |  
		| Author | Message |  
		| Corta 
 
 
 Joined: 25 Jan 2007
 Posts: 5
 
 
 
			    
 
 | 
			
				| Timing problem with PIC18F2620 |  
				|  Posted: Thu Jan 25, 2007 11:06 am |   |  
				| 
 |  
				| 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
 
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Thu Jan 25, 2007 12:04 pm |   |  
				| 
 |  
				|  	  | 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
 
 
 
			    
 
 | 
			
				|  |  
				|  Posted: Thu Jan 25, 2007 1:56 pm |   |  
				| 
 |  
				| wow it's work! Thank you very much!
 |  |  
		|  |  
		|  |  
  
	| 
 
 | 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
 
 |