Multitester en PIC
Multitester en PIC
Multitester en PIC
Prueba lgica
PULS Generador de
pulsos lgicos
Freq
Frecuencmetro
Cnt
Contador de
eventos
Cap
Medida de
condensadores
Medida de
inductancias
SIG
Generador de
seal
ntSC
Patrn de vdeo
NTSC
9600
Midi
Nota MIDI
R/C.i
Entrada de
pruebas para
servos de R/C
[]
Onda cuadrada
noiS
Generador
pseudoaleatorio
ir38
LED IR
Esta es la parte de las pistas, en mi caso de los cablecitos. Los 4 transistores que
he aadido estn montados en superficie (SMD?) y las resistencias limitadoras de
corriente de la base de 10K son de tipo chip, no se aprecian en la foto, recicladas
de un disco duro.
El programa del PIC est escrito en ensamblador, he trabajado sobre esta versin
V35: SUPMP.ASM adaptada al ensamblador MPASM. He aadido los cambios
necesarios desde esta otra V36: SUPER.SRC para tener una versin actualizada y
compilable con MPLAB V8 de microchip. Estos son los fuentes en ASM de
la versin V42. Las mejoras son:
1. La salida de los nodos est invertida de nivel lgico respecto del diseo
original, para que pueda trabajar correctamente con los transistores que he
aadido. En los fuentes existe una lnea #define INVERT_A que realiza
esa inversin por software, si se va a usar el hardware original sin
transistores basta con comentarla y ensamblar de nuevo el programa.
2. He corregido las velocidades del generador de seales serie (modo "ser")
para que sean mas precisas, y he aadido 4 nuevas velocidades 19200,
38400, 57600 y 115200 baudios.
3. En el modo de generacin de ruido pseudoaleatorio he cambiado el
mensaje original "prn" por "noiS" que creo que es mas representativo.
Este montaje es muy sencillo y barato, con la cantidad de funciones que tiene
resulta muy til en el taller y por lo compacto es muy sencillo de manejar y
puede llevarse siempre en la caja de herramientas. Algunas de las funciones
como el generador de seal R/C, el generador PWM, o el medidor de ancho de
pulso para son muy agradecidas (y no son frecuentes en otros aparatos) a la hora
de hacer pruebas con robots, coches R/C etc...
CODIGO
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
Logic Pulser
Serial Generator (4 rates)
Midi Generator
r/c servo pulse
Square Wave
20khz digital noise
38KHz burst
29
29
30
31
32
33
34
35
list
p=16f870
processor
#include <p16f870.inc>
definitions
errorlevel -302
radix dec
__CONFIG _CP_OFF & _WDT_OFF & _BODEN_OFF & _PWRTE_ON & _HS_OSC &
_LVP_OFF & _DEBUG_OFF & _CPD_OFF
#define VERS
035
#define LPTIME
42990
#define MAXMODE
17
#define
#define
#define
#define
#define
#define
#define
#define
PORTA,5
PORTA,0
PORTA,1
PORTA,4
PORTA,2
PORTC,7
PORTC,6
PORTA,3
;clamp input to T0
;20 ohm direct feed
;100 ohms
;470 ohms
;150
;10k
;10k
;100k feed to input
CLAMP
R20
R100
R470
R150
R10K
R10KA
R100K
#define BLACK
#define WHITE
#define SOUT
R150
R100
R20
#define BUT1
#define BUT2
PORTC,4
PORTC,5
wsave
ssave
icount
flag
org
20h
equ
equ
equ
equ
20H
21H
22H
23H
;button 1
;button 2
count
scount
csave
ddata
sdata
temp
ontime
oftime
isrvec
qtime
timer
freq
pwmp
mode
rate
baud
midic
pmode
hi
lo
rand
acc
xacc
digits
dignr
dp
ftimer
segmask
dela
bcd
pto
pti
cnt
ii
frame
equ
equ
equ
equ
equ
equ
equ
equ
equ
equ
equ
equ
equ
equ
equ
equ
equ
equ
equ
equ
equ
equ
equ
equ
equ
equ
equ
equ
equ
equ
equ
equ
equ
equ
equ
#define
#define
#define
#define
#define
HOLD
DIR
SAVE
RUN
SWIT
isr
24H
25H
26H
27H
28H
29H
2BH
2CH
2DH
2EH
30H
33H
35H
36H
37H
38H
39H
3AH
3BH
3CH
3DH
40H
44H
48H
4CH
4DH
4EH
50H
51H
54H
59H
5AH
5BH
5CH
5DH
; was data
;midi channel
; was low
;32 bit register
;aux 32 bit value
;segment data for LED
flag,0
flag,1
flag,2
flag,3
flag,4
org
goto
start
org
movwf
swapf
movwf
clrf
wsave
STATUS,w
ssave
STATUS
movf
addwf
isrvec,w
PCL,f
isrx
goto
goto
pwmi
sqri
swapf
movwf
swapf
swapf
retfie
ssave,w
STATUS
wsave,f
wsave,w
digseg addwf
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
PCL,f
3fh
6h
5bh
4fh
66h
6dh
7dh
7h
7fh
67h
getano addwf
retlw
retlw
retlw
retlw
PCL,f
1
2
4
8
;
;
;
;
bit
bit
bit
bit
decimal point
flash decimal
dp location
starting digit from bcd buffer
getdp
addwf
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
PCL,f
03h
03h
03h
03h
94h
0A5h
0C6h
0D7h
0E8h
0F9h
dpcap
addwf
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
PCL,f
01h
01h
84h
84h
84h
95h
0A6h
0B7h
0C8h
0D9h
7
6
5,4
3-0
dpuls
addwf
retlw
retlw
retlw
retlw
PCL,f
170
55
17
5
srq
movf
incf
addwf
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
temp,w
temp,f
PCL,f
low 1380
high 1380
low 680
high 680
low 330
high 330
low 160
high 160
;1200
;1200
;2400
;2400
;4800
;4800
;9600
;9600
movf
incf
addwf
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
temp,w
temp,f
PCL,f
73h
50h
5ch
7ch
73h
3eh
38h
6dh
3eh
5ch
38h
78h
05eh
4
5ch
05eh
71h
50h
79h
6fh
0
39h
54h
78h
0
39h
77h
73h
39h
5ch
4
38h
0
6dh
6
3dh
;Prob
;Prob
;Prob
;Prob
;PULS
;PULS
;PULS
;PULS
;VoLt
;VoLt
;VoLt
;VoLt
;diod
;diod
;diod
;diod
;FrEq
;FrEq
;FrEq
;FrEq
; Cnt
; Cnt
; Cnt
; Cnt
; CAP
; CAP
; CAP
; CAP
;CoiL
;CoiL
;CoiL
;CoiL
; SIG
; SIG
; SIG
; SIG
modes
vbase
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
54h
78h
6dh
39h
00h
6dh
79h
50h
15h
4
5eh
4
21h
52h
58h
0
39h
0fh
00h
0
73h
50h
54h
0
04h
50h
4fh
7fh
73h
2ah
15h
0
;ntSC
;ntSC
;ntSC
;ntSC
; SEr
; SEr
; SEr
; SEr
;Midi
;Midi
;Midi
;Midi
;r/c
;r/c
;r/c
;r/c
;[]
;[]
;[]
;[]
;Prn
;Prn
;Prn
;Prn
;ir38
;ir38
;ir38
;ir38
;PWm
;PWm
;PWm
;PWm
vpuls
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
0
0
0
6dh
0
0
6dh
3fh
0
6dh
3fh
3fh
0
0
0edh
3fh
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
vbaud
retlw
retlw
retlw
retlw
retlw
retlw
retlw
06h
5bh
3fh
3fh
5bh
66h
3fh
;1200
;1200
;1200
;1200
;2400
;2400
;2400
5
5
5
5
50
50
50
50
500
500
500
500
5.0
5.0
5.0
5.0
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw
3fh
66h
7fh
3fh
3fh
67h
7dh
3fh
3fh
;2400
;4800
;4800
;4800
;4800
;9600
;9600
;9600
;9600
start
movf
addwf
goto
goto
goto
goto
goto
goto
goto
goto
goto
goto
goto
goto
goto
goto
goto
goto
goto
mode,w
PCL,f
lp1
pulse
volt
diode
fcount
dcount
cap
induct
sig
vgen
s9600
midi
radcon
square
noise
ir38
pwm
bsf
movlw
movwf
movlw
movwf
movlw
movwf
movlw
movwf
bcf
movlw
movwf
clrf
bsf
clrf
call
call
movlw
movwf
movlw
movwf
movlw
movwf
STATUS,5
b'00111111'
TRISA
0
TRISB
b'10110000'
TRISC
b'10001000'
OPTION_REG
STATUS,5
4
T2CON
segmask
segmask,0
dignr
getset
signon
low 1000
freq
high 1000
freq+1
48
pwmp
;logic probe
;logic pulser
;voltmeter
;doide voltage
;frequency count
;event count
;cap meter
;inducance meter
;signal generator
;video generator
;serial out
;midi out
;servo pulse
;square wave
;digital noise
;38 khz test signal
;variable pulse width
putset
cycle
bcf
movf
call
INTCON,GIE
mode,w
setmode
call
movlw
call
btfsc
goto
btfss
goto
segout
10
delay
BUT1
c4
BUT2
c2
call
movlw
call
btfsc
goto
btfsc
goto
decf
movlw
btfsc
movwf
goto
segout
10
delay
BUT1
doexec
BUT2
c5
mode,f
MAXMODE-1
mode,7
mode
cycle
call
movlw
call
btfsc
goto
btfsc
goto
incf
movf
xorlw
btfsc
clrf
goto
segout
10
delay
BUT2
doexec
BUT1
c4
mode,f
mode,w
MAXMODE
STATUS,Z
mode
cycle
c2
c5
c4
doexec call
call
goto
putset
clreg
exec
clreg
STATUS,RP0
R20
R100
R470
R150
R10K
R10KA
R100K
CLAMP
6
bsf
bsf
bsf
bsf
bsf
bsf
bsf
bsf
bsf
movlw
;run display
;still held down?
;no
;underflow?
movwf
ADCON1
bcf
STATUS,RP0
return
; save current setup in eeprom
putopt btfss
return
bcf
putset clrf
clrf
movf
call
incf
movf
call
incf
movf
call
incf
movf
call
return
SAVE
SAVE
hi
lo
mode,w
eewrite
lo,f
pmode,w
eewrite
lo,f
midic,w
eewrite
lo,f
baud,w
eewrite
hi
lo
eeread
mode
mode,w
-MAXMODE
STATUS,C
mode
lo,f
eeread
pmode
pmode,w
-4
STATUS,C
pmode
lo,f
eeread
midic
-15
STATUS,C
midic
lo,f
eeread
baud
baud,w
-4
STATUS,C
baud
;restore
;next location
;pulse mode
;next location
;pulse mode
temp
STATUS,C
temp,f
temp,f
modes
digits
modes
digits+1
modes
digits+2
modes
digits+3
VERS
wtod
0
digits
sign
mode,w
setmode
sign
;put version nr
;blank.
clrf
call
movlw
call
decfsz
goto
return
count
segout
15
delay
count,f
x1
off
on
bcf
btfss
goto
bcf
bcf
movf
movwf
goto
bsf
bsf
movf
movwf
goto
INTCON,T0IF
SWIT
on
SWIT
R20
oftime,w
TMR0
isrx
SWIT
R20
ontime,w
TMR0
isrx
bsf
bcf
movlw
movwf
bcf
STATUS,RP0
R20
b'10000010'
OPTION_REG
STATUS,RP0
movlw
movwf
bsf
bsf
0
isrvec
INTCON,T0IE
INTCON,GIE
movf
addlw
call
movf
sublw
movwf
movf
sublw
sublw
movwf
movlw
call
call
movlw
call
call
decfsz
goto
movlw
movwf
movlw
call
call
btfss
goto
btfss
goto
clrf
goto
pwmp,w
2
wtod
pwmp,w
0
ontime
pwmp,w
96
0
oftime
10
delay
segout
10
delay
segout
timer,f
p4
25
timer
5
delay
segout
BUT1
dn
BUT2
up
timer
p3
dn
btfss
goto
decfsz
decf
incf
goto
BUT2
cycle
pwmp,f
pwmp,f
pwmp,f
p2
up
btfss
goto
incf
movf
xorlw
btfsc
BUT1
cycle
pwmp,f
pwmp,w
96
STATUS,Z
p2
p4
p3
;/32 TMR0
decf
goto
pwmp,f
p2
ir38
bsf
bcf
bcf
STATUS,RP0
R20
STATUS,RP0
ir2
call
movlw
movwf
call
movlw
call
decfsz
goto
call
btfsc
goto
btfsc
goto
goto
brst
5
count
segout
9
delay
count,f
ir4
segoff
BUT1
ir2
BUT2
ir2
cycle
movlw
movwf
bsf
movlw
movwf
decfsz
goto
nop
nop
nop
bcf
movlw
movwf
decfsz
goto
nop
decfsz
goto
return
38
count
R20
20
dela
dela,f
b3
ir4
brst
b2
b3
b5
R20
20
dela
dela,f
b5
count,f
b2
n2
bsf
bcf
bcf
movlw
movwf
call
btfsc
bsf
btfss
bcf
STATUS,RP0
R20
STATUS,RP0
55h
rand
pseudo
rand,0
R20
rand,0
R20
n4
call
movlw
movwf
decfsz
goto
btfsc
goto
btfsc
goto
goto
pseudo movf
addwf
movwf
addwf
movwf
bcf
rrf
btfsc
bsf
addwf
return
segout
65
dela
dela,f
n4
BUT2
n2
BUT1
n2
cycle
rand,w
rand+1,w
rand+1
rand+2,w
rand+2
STATUS,C
rand,f
STATUS,C
rand,7
rand,f
STATUS,RP0
R20
STATUS,RP0
low 1500
timer
high 1500
timer+1
timer,w
acc
timer+1,w
acc+1
acc+2
acc+3
b2bcd
format
50
count
segout
10
delay
count,f
rc3
timer,w
lo
timer+1,w
hi
segoff
rcpls
BUT1
rcdn
rcup
rcup2
rcdn
rcdn2
rcpls
rc4
rc5
btfss
goto
goto
BUT2
rcup
rc2
btfss
goto
movlw
addwf
btfsc
incf
movf
xorlw
btfsc
goto
goto
BUT1
cycle
10
timer,f
STATUS,C
timer+1,f
timer+1,w
9
STATUS,Z
rcdn2
rc1
btfss
goto
movlw
addwf
btfss
decf
movf
xorlw
btfsc
goto
goto
BUT2
cycle
-10
timer,f
STATUS,C
timer+1,f
timer+1,w
2
STATUS,Z
rcup2
rc1
incf
incf
bsf
nop
nop
decfsz
goto
decfsz
goto
bcf
return
hi,f
lo,f
R20
lo,f
rc4
hi,f
rc5
R20
bcf
movf
addwf
movf
btfsc
incfsz
addwf
btfss
bcf
btfsc
bsf
movlw
addwf
goto
INTCON,T0IF
freq,w
timer,f
freq+1,w
STATUS,C
freq+1,w
timer+1,f
timer+1,7
R20
timer+1,7
R20
-73
TMR0,f
isrx
STATUS,RP0
R20
b'10001000'
OPTION_REG
STATUS,RP0
1
isrvec
INTCON,GIE
INTCON,T0IE
sqhl
movf
movwf
movf
movwf
clrf
clrf
call
call
freq,w
acc
freq+1,w
acc+1
acc+2
acc+3
b2bcd
format
sq2
movf
movwf
call
movlw
call
decfsz
goto
movlw
addwf
movf
addlw
btfsc
goto
movlw
movwf
btfss
goto
btfss
goto
clrf
goto
rate,w
count
segout
10
delay
count,f
sqs1
-5
rate,f
rate,w
-5
STATUS,C
sq4
6
rate
BUT1
sqdn
BUT2
squp
rate
sq2
squp
btfss
goto
incf
btfsc
incf
goto
BUT1
cycle
freq,f
STATUS,Z
freq+1,f
sqhl
sqdn
btfss
goto
movlw
addwf
btfss
BUT2
cycle
-1
freq,f
STATUS,C
sqs1
sq4
;/32 clock
;timer-0 interrupt on
decf
btfss
goto
clrf
clrf
goto
freq+1,f
freq+1,7
sqhl
freq
freq+1
sqhl
; logic pulser
pulse
bsf
movlw
movwf
bcf
STATUS,RP0
6
ADCON1
STATUS,RP0
ppp2
movf
addlw
call
movf
call
movwf
goto
pmode,w
;get pulse mode
(vpuls-vbase)/4 ;NOTE: = (vpuls-vbase)/4 in this assember
setmode
pmode,w
;now, get delay factor
dpuls
timer
ppp3
ppp5
bsf
bcf
nop
bsf
bcf
bsf
goto
STATUS,RP0
R20
R20
STATUS,RP0
digits,6
ppp8
;end of pulse
bsf
btfsc
bcf
movlw
btfsc
movlw
movwf
movf
call
movlw
call
btfsc
goto
btfsc
goto
goto
R20
R470
R20
8
R20
1
digits
timer,w
delsq
2
delsq
BUT1
ppp4
BUT2
ppp5
cycmode
btfsc
goto
movlw
call
call
call
btfss
goto
btfss
goto
BUT2
ppp3
10
delay
blank
segout
BUT1
cycmode
BUT2
ppp4x
;only button 2 ?
;no - set pulse direction
ppp3
ppp8
ppp4
ppp4x
;all digital on ra
;activate pulse
;exit?
;yes - and save params
incf
movf
sublw
btfss
clrf
goto
pmode,f
pmode,w
3
STATUS,C
pmode
ppp2
sis3
sis4
sis8
sis9
bsf
bcf
bcf
movlw
movwf
bcf
bcf
bcf
clrf
movlw
call
movwf
movlw
call
movwf
movwf
STATUS,RP0
R10K
R100K
6
ADCON1
STATUS,RP0
R10K
R100K
digits
5
digseg
digits+1
0
digseg
digits+2
digits+3
btfss
bsf
bsf
call
incf
btfsc
bcf
bcf
call
btfsc
goto
btfsc
goto
goto
timer,6
digits,6
R100K
sis8
timer,f
timer,6
digits,6
R100K
sis8
BUT1
sis4
BUT2
sis3
cycle
movlw
movwf
call
movlw
call
decfsz
goto
return
32
count
segout
14
short
count,f
sis9
; do short delays
short
shs2
movwf
nop
dela
;run diplay
nop
nop
nop
nop
decfsz dela,f
goto
shs2
return
cac2
cac7
cahit
bsf
bcf
bcf
bsf
bcf
bsf
STATUS,RP0
R100K
STATUS,RP0
R100K
R20
HOLD
call
clrf
clrf
clrf
clrf
bsf
bsf
bcf
nop
nop
nop
nop
nop
nop
segoff
acc
acc+1
acc+2
acc+3
STATUS,RP0
R20
STATUS,RP0
;release clamp
;compensate
;for stray
;capacitance
nop
nop
nop
nop
nop
nop
nop
nop
nop
btfsc
goto
incfsz
goto
incfsz
goto
incfsz
goto
incfsz
goto
R20
cahit
acc,f
cac7
acc+1,f
cac7
acc+2,f
cac7
acc+3,f
cac7
bsf
bcf
bcf
STATUS,RP0
R20
STATUS,RP0
;discharge cap
cac6
call
call
call
btfsc
goto
btfsc
goto
goto
b2bcd
cform
show2
BUT1
cac6
BUT2
cac2
cycle
STATUS,RP0
R100
STATUS,RP0
R100
HOLD
inc2
call
movlw
call
clrf
clrf
clrf
clrf
bsf
segoff
80
delay
acc
acc+1
acc+2
acc+3
R100
inc7
btfss
goto
incfsz
goto
incfsz
goto
incfsz
goto
incfsz
goto
R20
inhit
acc,f
inc7
acc+1,f
inc7
acc+2,f
inc7
acc+3,f
inc7
inhit
bcf
call
movlw
call
bsf
call
btfsc
goto
btfsc
goto
goto
R100
b2bcd
3
xform
digits+2,7
show2
BUT1
inc6
BUT2
inc2
cycle
inc6
digits
PORTC,0
PORTC,1
PORTC,2
PORTC,3
;clear accum
;start voltage
;check direct (a/d) input
lpx1
lpx2
lpflo
lphi
lplow
lphl
lpno
bsf
bcf
bcf
movlw
movwf
movlw
movwf
bcf
bsf
bcf
movlw
movwf
clrf
movlw
movwf
STATUS,RP0
R10K
R10KA
b'10101000'
OPTION_REG
0Eh
ADCON1
STATUS,RP0
R10K
R10KA
81h
ADCON0
dp
0ffh
TMR0
btfsc
goto
btfsc
goto
goto
call
movf
sublw
btfsc
goto
movf
sublw
btfss
goto
movlw
goto
movlw
goto
movlw
call
btfss
goto
bcf
movlw
movwf
clrf
movlw
movwf
call
incf
movf
btfsc
clrf
goto
BUT1
lpx2
BUT2
lpx2
cycle
atod
hi,w
40
STATUS,C
lplow
hi,w
180
STATUS,C
lphi
40h
lphl
76h
lphl
38h
letter
INTCON,T0IF
lpno
INTCON,T0IF
0ffh
TMR0
timer
73h
digits+1
show1
timer,f
timer,f
STATUS,Z
digits+1
lpx1
;'-'
;'H'
;'L'
;counter overflow?
show2
show1
show
shos2
clrf
goto
clrf
bsf
goto
clrf
bsf
call
call
movlw
call
decfsz
goto
return
count
shos2
count
count,7
shos2
count
count,6
segout
flash
10
delay
count,f
shos2
;show digits
;add dp
digits
blnk2
digits
digits+1
digits+2
digits+3
movwf
clrf
clrf
clrf
call
call
return
acc
acc+1
acc+2
acc+3
b2bcd
format
bsf
bcf
goto
STATUS,RP0
R10K
vdx
vov2
bsf
movlw
movwf
bcf
bsf
movlw
movwf
STATUS,RP0
8Eh
ADCON1
STATUS,RP0
R10K
81h
ADCON0
call
bcf
atod
STATUS,C
vov4
rrf
rrf
movf
movwf
movf
movwf
clrf
clrf
call
call
bsf
movlw
movwf
call
movlw
call
decfsz
goto
btfsc
goto
btfsc
goto
goto
hi,f
lo,f
lo,w
acc
hi,w
acc+1
acc+2
acc+3
b2bcd
format
digits+1,7
200
count
segout
10
delay
count,f
vov4
BUT1
vov2
BUT2
vov2
cycle
;scale to 9 bits
bsf
nop
nop
btfsc
goto
bsf
movf
bcf
movwf
movf
movwf
return
ADCON0,2
ADCON0,2
adchk
STATUS,RP0
ADRESL,w
STATUS,RP0
lo
ADRESH,w
hi
STATUS,RP0
CLAMP
R10K
R150
R100K
R20
b'10101000'
OPTION_REG
6
ADCON1
STATUS,RP0
R10K
dcic2
TMR0
clrf
;disable clamp
;use 10k only
;disconect other 10k
;no 100k feed
;float direct resistor
;no prescale on TMR0
;all ra is digital
;use 10k pullup
;clear hardware timer
dcic3
dcic5
dcic9
clrf
clrf
clrf
clrf
call
call
movlw
call
call
call
btfss
goto
btfss
goto
goto
btfss
goto
call
call
movlw
goto
xacc
xacc+1
xacc+2
xacc+3
xfer
b2bcd
3
xform
segout
icup
BUT1
dcic9
BUT2
dcic2
dcic3
BUT2
cycle
xfer
b2bcd
7
dcic5
movf
movwf
btfss
return
bcf
incfsz
return
incfsz
return
incf
return
TMR0,w
xacc
INTCON,T0IF
INTCON,T0IF
xacc+1,f
xacc+2,f
xacc+3,f
movf
movwf
movf
movwf
movf
movwf
movf
movwf
return
xacc,w
acc
xacc+1,w
acc+1
xacc+2,w
acc+2
xacc+3,w
acc+3
STATUS,RP0
CLAMP
R10K
R150
fcf2
fcf7
fcfx
fcf4
bcf
bsf
movlw
movwf
movlw
movwf
bcf
bcf
clrf
clrf
clrf
clrf
call
call
btfsc
goto
btfss
goto
movlw
call
call
call
call
goto
R100K
R20
b'10100111'
OPTION_REG
6
ADCON1
STATUS,RP0
R150
acc
acc+1
acc+2
acc+3
b2bcd
format
BUT1
fcf4
BUT2
cycle
3
xform
cnton
onesec
cntoff
fcf2
;both buttons?
bcf
clrf
clrf
clrf
clrf
clrf
bsf
bsf
bcf
return
CLAMP
TMR0
acc
acc+1
acc+2
acc+3
STATUS,RP0
CLAMP
STATUS,RP0
CLAMP
STATUS,RP0
CLAMP
STATUS,RP0
TMR0,w
acc+1
acc
acc,f
CLAMP
CLAMP
TMR0,w
acc+1,w
STATUS,Z
cnc2
fno
swapf
andlw
addlw
movwf
btfsc
bsf
incf
btfsc
incf
btfss
goto
btfsc
bcf
return
nop
return
dp,w
3
digits
FSR
dp,7
0,7
ftimer,f
STATUS,Z
ftimer+1,f
ftimer+1,5
fno
dp,6
0,7
;flash mode?
;flash back off
low LPTIME
timer
high LPTIME
timer+1
;100 cycle loop count
ffill
segout
flash
dotime
timer,f
osx1
timer+1,f
osx2
8
timer
dotime
timer,f
osx5
movlw
movwf
decfsz
goto
nop
nop
return
16
temp
temp,f
fif2
;time filler
;show last data
;include decimal
;check for TMR0 overflow
INTCON,T0IF
dno
INTCON,T0IF
acc+2,f
STATUS,Z
acc+3,f
;overflow?
;clear the flag
;increment next byte
;and next on rollover
movwf
movwf
movf
movwf
call
decfsz
goto
decfsz
goto
return
dela+1
dela+2
dela+2,w
dela
segout
dela,f
dlsd0
dela+1,f
dlsd1
movwf
movwf
movwf
decfsz
goto
decfsz
goto
decfsz
goto
return
dela+2
dela+1
dela
dela,f
dld0
dela+1,f
dld1
dela+2,f
dld2
call
movf
call
movwf
andlw
movwf
goto
first
count,w
dpcap
dp
0fh
count
ff5
vgen
bsf
bcf
bcf
bcf
bcf
bcf
bcf
bcf
movlw
movwf
STATUS,RP0
BLACK
WHITE
R100
STATUS,RP0
R100
PORTC,2
PORTC,3
0BFh
PORTB
vgv2
call
movlw
movwf
nop
call
decfsz
goto
movlw
movwf
call
call
call
call
call
call
call
call
call
call
call
call
call
nop
decfsz
goto
movlw
movwf
call
nop
decfsz
goto
call
btfsc
goto
goto
vsync
40
count
movlw
movwf
bcf
call
bsf
movlw
call
decfsz
goto
6
count
BLACK
dla10
BLACK
46
vdela
count,f
vv2
vc1
vc2
vc3
vsync
vv2
bline
count,f
vc1
15
count
dline
dline4
dline4
bline4
bline4
bline4
bline4
bline4
bline4
bline4
bline4
bline4
bline4
count,f
vc2
17
count
bline
count,f
vc3
zline4
BUT2
vgv2
cycle
vv3
vv4
movlw
movwf
bcf
movlw
call
bsf
call
decfsz
goto
6
count
BLACK
46
vdela
BLACK
dla8
count,f
vv3
movlw
movwf
bcf
call
bsf
movlw
call
decfsz
goto
return
6
count
BLACK
dla10
BLACK
46
vdela
count,f
vv4
zline4 call
zline
bcf
call
call
bsf
call
movlw
call
nop
return
dla4
BLACK
dla16
dla7
BLACK
vseg
89
vdela
bline4 call
bline
bcf
call
call
bsf
movlw
call
nop
return
dla4
BLACK
dla16
dla7
BLACK
93
vdela
dline4 call
dline
bcf
call
call
bsf
call
call
movlw
movwf
bd2
nop
nop
nop
nop
dla4
BLACK
dla16
dla7
BLACK
dla18
dla18
19
temp
;start h-sync
;start h-sync
;start h-sync
nop
nop
bsf
nop
bcf
decfsz
goto
movlw
call
return
WHITE
WHITE
temp,f
bd2
5
vdela
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
return
vdela
vd2
movwf
temp
decfsz temp,f
goto
vd2
return
incf
bcf
bcf
btfss
bsf
btfsc
bsf
nop
return
frame,f
PORTC,0
PORTC,1
frame,0
PORTC,0
frame,0
PORTC,1
movlw
0F0h
andwf
PORTC,f
return
;count frames
0F0h
PORTC,f
dignr,w
digits
FSR
0,w
segmask,w
0ffh
PORTB
dignr,w
getano
PORTC,f
STATUS,C
segmask,f
STATUS,C
nseg
segmask,0
dignr,f
dignr,2
dignr
;rotate
;overflow?
movwf
goto
count
ff5
first
count,w
getdp
dp
0fh
count
ff9
digits
ff9
digits+1
ff9
digits+2
ff9
digits+3
return
ff9
movf
decf
call
call
return
count,w
count,f
getbd
digseg
movlw
movwf
movf
call
xorlw
btfss
return
decfsz
goto
return
9
count
count,w
getbd
0
STATUS,Z
count,f
ff2
movwf
clrw
btfsc
return
bcf
rrf
movf
rlf
addlw
movwf
movf
movwf
btfsc
swapf
movf
andlw
return
temp
;save digit nr
temp,7
;negative value?
;zero if negative.
STATUS,C
temp,f
temp,w
temp,f
bcd
FSR
0,w
ddata
temp,0
ddata,f
ddata,w
0fh
movlw
movwf
clrf
clrf
clrf
clrf
clrf
b2bcd2 movlw
32
ii
bcd
bcd+1
bcd+2
bcd+3
bcd+4
; 32-bits
; make cycle counter
; clear result area
bcd
; make pointer
movwf
movlw
movwf
FSR
5
cnt
; Mike's routine:
b2bcd3 movlw
addwf
btfsc
andlw
btfsc
andlw
subwf
incf
decfsz
goto
rlf
rlf
rlf
rlf
rlf
rlf
rlf
rlf
rlf
decfsz
goto
return
33h
0,f
0,3
0f0h
0,7
0fh
0,f
FSR,f
cnt,f
b2bcd3
acc+0,f
acc+1,f
acc+2,f
acc+3,f
bcd+0,f
bcd+1,f
bcd+2,f
bcd+3,f
bcd+4,f
ii,f
b2bcd2
;
;
;
;
;
;
;
; all done?
; no, loop
bcf
bsf
movlw
movwf
movlw
movwf
bsf
nop
nop
btfsc
goto
bcf
bcf
return
EECON1,EEPGD
EECON1,WREN
55h
EECON2
0AAh
EECON2
EECON1,WR
s9600
call
bsf
bsf
bcf
movf
movwf
bcf
rlf
call
movwf
call
movwf
movlw
addwf
call
clear
STATUS,RP0
SOUT
;set to input
STATUS,RP0
baud,w
temp
STATUS,C
temp,f
srq
;get low byte
qtime
srq
qtime+1
(vbaud-vbase)/4
baud,w
setmode
ss5
call
btfss
goto
btfsc
goto
btfss
goto
call
movlw
movwf
movlw
movwf
segout
BUT2
ss8
BUT1
ss5
BUT2
cycle
setdir
'A'
sdata
26
scount
ss2
movf
call
incf
movlw
call
decfsz
goto
sdata,w
serout
sdata,f
43
delsq
scount,f
ss2
movlw
call
movlw
call
13
serout
100
delsq
ee2
EECON1,WR
ee2
STATUS,RP0
STATUS,RP1
ss8
midi
ms5
ms6
movlw
call
movlw
call
btfss
goto
goto
10
serout
220
delsq
BUT1
ss5
s9600
call
movlw
call
btfss
goto
btfss
goto
incf
bcf
bsf
goto
clear
20
delay
BUT1
cycle
BUT2
ss8
baud,f
baud,2
SAVE
s9600
movf
addlw
call
movlw
movwf
movlw
movwf
bsf
bsf
bcf
call
btfss
goto
btfsc
goto
call
movlw
movwf
clrf
movf
iorlw
call
movlw
call
movlw
call
movlw
call
btfss
goto
movf
iorlw
call
movlw
call
movlw
midic,w
1
wtod
39h
digits
76h
digits+1
STATUS,RP0
SOUT
STATUS,RP0
segout
BUT2
madj
BUT1
ms5
setdir
45
qtime
qtime+1
midic,w
90h
serout
60
serout
40
serout
20
delsq
BUT1
ms6
midic,w
90h
serout
60
serout
0
;limit 0-3
;31250 baud
;get midi chan nr.
;add note on command.
;note on
;middle C
;velocity
;wait for button release
madj
call
call
movlw
call
goto
movlw
call
btfss
goto
btfss
goto
bsf
incf
movlw
andwf
goto
serout
putopt
250
delsq
midi
100
delsq
BUT1
cycle
BUT2
madj
SAVE
midic,f
0fh
midic,f
midi
DIR
SOUT
DIR
STATUS,RP0
SOUT
STATUS,RP0
;set to output
count
count,3
ddata
zero
full
ddata,0
one
ddata,0
zero
ddata,f
count,f
sers2
full
one
full
full
full
;bit count
;count=8
zero
DIR
SOUT
DIR
SOUT
btfss
bcf
btfsc
bsf
return
;start bit
one
btfss
bsf
btfsc
bcf
return
DIR
SOUT
DIR
SOUT
full
movf
movwf
movf
movwf
incf
incf
decfsz
goto
decfsz
goto
return
qtime+1,w
temp+1
qtime,w
temp
temp+1,f
temp,f
temp,f
ff3
temp+1,f
ff3
ff3
end