inaccurate frequency using TMR1 PI18F452


Results 1 to 15 of 15

Threaded View

  1. #11
    Join Date
    Oct 2006
    Posts
    6


    Did you find this post helpful? Yes | No

    Default Interrupt routine

    Code:
    Disable  
    miint:
    	IF PIR1.0 = 1 THEN
    		T1CON.0 = 0
    		OFFCNT_H =TMR1H
    		OFFCNT_L =TMR1L
    		IF ARRANCA_MOTOR = 1 THEN
    			PORTC.5 = 0				'PULSO DE STEP
    			PORTA.5 = 0					'SALIDA PARA SHAFT
    			PRESCALER = FRECUENCIA + OFFCNT
    			TMR1H = PRESCALERH
    			TMR1L = PRESCALERL
    			PORTA.5 = 1				'SALIDA PARA SHAFT
    			PORTC.5 = 1				'PULSO DE STEP
    		ELSE
    			IF EMULACION = 1 THEN
    				IF ACTIVA_PRESENCIA = 0 THEN
    					TRIGGER = 0
    				ELSE
    					TRIGGER = 1
    				ENDIF
    			ENDIF
    		ENDIF
    	'*****************************************************************************************************
    	ENDIF
    	T1CON.0 = 1
    	PIR1.0 = 0
    	'**************************** INTERRUPCION POR TIMER 0  ****************************
    	
    salida1:
    	Resume                 ' retorna al programa principal
     	Enable
    Last edited by Darrel Taylor; - 13th October 2006 at 23:18. Reason: added [code][/code] tags

Similar Threads

  1. Code Measure Frequency by TMR1
    By blinkstar88 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 19th February 2011, 10:51
  2. TMR1 external LP xtal setup check
    By comwarrior in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 13th October 2009, 19:11
  3. HPWM command and oscillator frequency
    By RussMartin in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 8th March 2009, 23:41
  4. HPWM10 Frequency Updating
    By duncan303 in forum mel PIC BASIC Pro
    Replies: 17
    Last Post: - 19th January 2008, 13:30
  5. Measuring change of frequency with PIC
    By Aussie in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 19th July 2007, 02:47

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts