Hi  Acetronics,
I saw in the PBP manual the 32767 Hz limit but when I do
I get a straight 40KHz reading on the scope! could it be that it is a maximum suggested and that's why I burned my chip? Cause I would really like to figure out why I burned my chip.
I've rewrote my code but obviously not been able to test until I receive my order.
Does this make more sens?
	Code:
	@ __config _XT_OSC & _WDT_OFF & _MCLRE_ON & _LVP_OFF & _CP_OFF
clear
DEFINE OSC 4
FLAGS = 0
TRISA = %00111
TRISB = %00000001  
CMCON = %110
INTCON = %10011000
OPTION_REG = %10000000
TMR1H = 5535
TMR1L = 0
I var byte
tTime var word
INCLUDE "DT_INTS-14.bas"     ; Base Interrupt System
INCLUDE "ReEnterPBP.bas"     ; Include if using PBP interrupts
ASM
INT_LIST  macro    ; IntSource,        Label,  Type, ResetFlag?
        INT_Handler    INT_INT,  _SignalDetect,   PBP,  yes
        INT_Handler   TMR1_INT,  _SignalTimeOut,   PBP,  yes
        endm
    INT_CREATE               ; Creates the interrupt processor
ENDASM
@   INT_ENABLE   INT_INT     ; enable external (INT) interrupts
@   INT_ENABLE  TMR1_INT     ; Enable Timer 1 Interrupts 
;-------------------temp lcd display ----------------------------
LCD_DB4     VAR PORTB.4      ; Set port for 4 bits bus
LCD_DB5     VAR PORTB.5
LCD_DB6     VAR PORTB.6
LCD_DB7     VAR PORTB.7
LCD_RS      VAR PORTB.2      ; Set RS bit port
LCD_E       VAR PORTB.1      ; Set Enable bit port
LCD_Lines     CON 2          ; # of Lines on LCD,  1 or 2 (Note: use 2 for 4 lines)
LCD_DATAUS    CON 50         ; Data delay time in us 
LCD_COMMANDUS CON 2000       ; Command delay time in us 
INCLUDE "LCD_AnyPin.pbp"     ; Must go after LCD initialization 
Pause 500: LCDOUT $FE,1: pause 250   
LCDOUT $FE,$80,"Display test OK"
;------------------------lcd-------------------------------------- 
Goto main 
Main:
    hpwm 1,127,40000        ; Send burst, Ch1, D.Cycle50%, Freq 40Khz
    pauseus 169             ; length of burst.
    CCP1CON = 0             ; Stop sending HPWM
    pauseus 950             ; To prevent Rx from picking up local burst 
    T1CON.0 = 1             ; Start timer1
    for I = 1 to 65           ; Do not send another pulse until 65ms+ later.
        pause 1
    next
goto main
'---[INT - interrupt handler]-------Got Signal within 60mS
SignalDetect:
    T1CON.0 = 0             ; Stop timer1
    tTime = 255 * TMR1H + TMR1L
    LCDOUT $FE,$C0,dec tTime
    pause 1000
    LCDOUT $FE,$C0,"                "
    TMR1H = 5535
    TMR1L = 0
@ INT_RETURN
'---[TMR1 - interrupt handler]------TMR1 Overflow, got no signal
SignalTimeOut:
    T1CON.0 = 0             ; Stop timer1
    LCDOUT $FE,$C0,"No Signal"
    pause 1000
    LCDOUT $FE,$C0,"         " 
    TMR1H = 5535
    TMR1L = 0      
@ INT_RETURN
end
 
				
			
Bookmarks