|
 |
Untitled Document
;******************************************
; Filename: ledriver.asm *
; Date: August 10, 1999 *
; File Version: *
; *
; Author: Lawrence Foltzer *
; Company: photons unlimited *
;******************************************
; Notes:
;
; Variable amplitude LED drive current pulse generator.
; this code generates a series of "N" pulses to a switching
; power supply that generates a supply voltage high enough
; to operate the laser driver in the avalanche mode.
; The "N" pulses are then followed by a trigger pulse to
; avalanche transistor, which then drive the LED.
; For details on the voltage generated versus the number of
; applied pulses, see the Mathcad file vc_vs_nt.mcd.
; Will use GPIO(0:2) for switcher drive pulses, and GPIO5
; as the avalanche trigger signal port.
; 50nsec pulses to 8 amps are generated.
;******************************************
list p=12c508 ; list directive to define processor
#include ; processor specific variable definitions
__CONFIG _CP_OFF & _WDT_OFF & _MCLRE_OFF & _IntRC_OSC
; constants
nn equ 0x64 ; 100 base 10 is number of pulses
delay equ 0x20
; variable storage
ORG 0x07
cntr res 1
;**********************************************************************
; ORG 0x1FF ; processor reset vector
; movlw 0x80
; Internal RC calibration value is placed at location 0x1FF by Microchip
; as a movlw k, where the k is a literal value.
; pseudocode
; pulse switcher "nn" times
; trigger avalanche driver
; wait a ms or so
; repeat.
ORG 0x000 ; coding begins here
movlw 0x80
start movwf OSCCAL
movlw 0x80
OPTION
clrf GPIO
movlw 0x08
tris GPIO
repeat movlw 0x32 ; 50 pulses please
movwf cntr
lp1 movlw 0x07
movwf GPIO ; pulse high
; nop
; nop
nop
movlw 0x00
movwf GPIO ; pulse low
nop
nop
; nop
decfsz cntr,1
goto lp1
movlw delay
movwf cntr
w8lp1 decfsz cntr,1
goto w8lp1
bsf GPIO,5 ; trigger avalanche transistor
bcf GPIO,5
dec1 decfsz cntr,1
goto dec1
movlw 0x64 ; 100 pulses please
movwf cntr
lp2 movlw 0x07
movwf GPIO ; pulse high
; nop
; nop
nop
movlw 0x00
movwf GPIO ; pulse low
; nop
nop
nop
decfsz cntr,1
goto lp2
movlw delay
movwf cntr
w8lp2 decfsz cntr,1
goto w8lp2
bsf GPIO,5 ; trigger avalanche transistor
bcf GPIO,5
dec2 decfsz cntr,1
goto dec2
movlw 0x96
movwf cntr
lp3 movlw 0x07
movwf GPIO ; pulse high
; nop
; nop
nop
movlw 0x00
movwf GPIO ; pulse low
; nop
nop
nop
decfsz cntr,1
goto lp3
movlw delay
movwf cntr
w8lp3 decfsz cntr,1
goto w8lp3
bsf GPIO,5 ; trigger avalanche transistor
bcf GPIO,5
dec3 decfsz cntr,1
goto dec3
goto repeat
ORG 0x01ff
movlw 0x80
END
>
|
 |