ICSP not recognizing..


Closed Thread
Results 1 to 12 of 12

Hybrid View

  1. #1
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    That is a bit wierd, because what I posted should've had a freq of about 36khz (73.5khz int rate, 20mhz/4=5Mhz instruction rate / 68 = 73.5khz toggling the pin).

    If anything, the freq should've dropped BELOW 36khz due to not reloading the timer with 'fixed' values and not compensating for the extra cycles in the interrupt loop.
    I get the feeling that the 'scope isn't being read right (i.e. only measuring half of the square wave, not the whole thing)

    And yes, I agree completely about DT_INT's vs. ON_Interrupt.

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    completely untested, should work anyway...
    Code:
            define OSC 20 
            
            include ".\include_routines\DT_INTS-14.bas"
            
    ASM
    INT_LIST  macro    ;  IntSource,   Label,  Type, ResetFlag?
            INT_Handler    TMR1_INT,  _SINUS,   ASM,  yes
        endm
        INT_CREATE
    
    endasm  
    
            
            '------- Configurações iniciais -------------------- 
            TRISA  = %00000000 ' PORTA
            TRISB  = %00000000 ' PORTB 
            TRISC  = %00000000 ' PORTC
            TRISD  = %00000000 ' PORTD 
            TRISE  = %00000000 ' PORTE 
            
            OPTION_REG = %00000000
            ADCON1 = %10001111  ' all digital
            T1CON = %00000000   ' TMR1 1:1 prescaler
            PIE1 = %00000001    ' Henable  TMR1 INT
    
    @TIMER1=TMR1L
            TIMER1      var word EXT
    
            INT         VAR     PIR1.0  ' OVERFLOW flag
            START       VAR     T1CON.0 ' START TMR1
            
            LOAD        CON     65404 '  INT. 36KHz
            
            TIMER1=LOAD
            START = 1 
    @       INT_ENABLE   TMR1_INT     
            PORTB.0 = 1
    MAIN:      
            GOTO MAIN    
    
    SINUS:  
            ASM
                    MOVE?CT  0, T1CON, TMR1ON ; Stop Timer1
                    MOVLW    LOW(_LOAD)       ; Reload timer1
                    ADDWF    TMR1L,F          ;   but add current Timer
                    BTFSC    STATUS,C         ;       value
                    INCF     TMR1H,F          ;
                    MOVLW    HIGH(_LOAD)      ;
                    ADDWF    TMR1H,F          ;
                    MOVE?CT  1, T1CON, TMR1ON ; Start Timer1                      
            ENDASM
            toggle PORTB.0
    @       INT_RETURN
    Last edited by mister_e; - 11th June 2008 at 20:34.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. ICSP and 16F684
    By onaclov2000 in forum Schematics
    Replies: 4
    Last Post: - 5th March 2009, 17:31
  2. ICSP from EPIC to Breadboard && 16f88
    By rdxbam in forum General
    Replies: 2
    Last Post: - 14th December 2008, 20:13
  3. Soic Icsp
    By earltyso in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 13th September 2008, 19:51
  4. Replies: 1
    Last Post: - 10th December 2007, 23:57
  5. ICSP Programming from a PDA
    By Ralph in forum Off Topic
    Replies: 2
    Last Post: - 11th November 2007, 22:22

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