My program must turn on 64 led connected to PIC with 4 mux 74HC154
This is my program but it don't work fine, i try to disable interrupt but ...
DEFINE OSC 4 'Definisco fre. osc. quarzo
' *****************************
' LIBRERIE
Include "modedefs.bas"
' ************************************
' IMPOSTA PORTE
TRISA = 0 ' Imposto la porta A come uscita
TRISB =%10000000 ' Imposto la porta B come uscita
OPTION_REG=%11010001
PIE1=%00000000
ADCON1=%00000111
' ************************************
'VARIABILI
TX var PORTB.6
RX var PORTB.7
Mode var PORTB.5
EN1 VAR PORTA.0
EN2 VAR PORTA.1
EN3 VAR PORTA.2
EN4 VAR PORTA.3
x var byte ' Definizione variabile tipo byte
k var byte
j var byte
led1 var byte
led2 var byte
stato var bit[64]
pos var byte
high EN1
high EN2
high EN3
high EN4
for k=0 to 63
stato[k]=0
next k
INTCON = %11100000
ON INTERRUPT GoTo interr
' **************************************
'PROGRAMMA PRINCIPALE
mainloop: 'label
intcon.5=0
SERIN RX,T9600,pos
intcon.5=1
stato[pos]=1 -----------------> Active led a position pos
GoTo mainloop ' ritorna allla label iniziale
'***********************
'GESTIONE DI INTERRUPT
Disable
interr:
'*********************
'Interrupt TMR0 -------------->>>' Routine to scan all 64 led
I can't interrupt it
If INTCON.2=1 then
for x=0 to 15
if stato[x]=1 then
portb.0=x.0[3]
portb.1=x.0[2]
portb.2=x.0[1]
portb.3=x.0[0]
low EN1
high EN2
high EN3
high EN4
pause 1
endif
next x
high EN1
high EN2
high EN3
high EN4
for x=0 to 15
j=x+16
if stato[j]=1 then
portb.0=x.0[3]
portb.1=x.0[2]
portb.2=x.0[1]
portb.3=x.0[0]
high EN1
low EN2
high EN3
high EN4
pause 1
endif
next x
high EN1
high EN2
high EN3
high EN4
for x=0 to 15
j=x+32
if stato[j]=1 then
portb.0=x.0[3]
portb.1=x.0[2]
portb.2=x.0[1]
portb.3=x.0[0]
high EN1
high EN2
low EN3
high EN4
pause 1
endif
next x
high EN1
high EN2
high EN3
high EN4
for x=0 to 15
j=x+48
if stato[j]=1 then
portb.0=x.0[3]
portb.1=x.0[2]
portb.2=x.0[1]
portb.3=x.0[0]
high EN1
high EN2
high EN3
low EN4
pause 1
endif
next x
high EN1
high EN2
high EN3
high EN4
INTCON.2=0
endif
Resume
Enable
thank you in advance for your availability and excuse me for my english
Christian




Bookmarks