Quote Originally Posted by lissajous View Post
Thanks for the post

I correct them, but it still doesn't work.
I don't read your language, but I get the idea of the program (I think)...a few problems noted, no enable in the program for the interrupts, moved some blocks around, did some re-writing of the code...check it out.

Code:
DEFINE OSC 4
DEFINE I2C_HOLD 1
Define LCD_DREG PORTB		'LCD definialasa
Define LCD_DBIT 4		'kezdo adatbit
Define LCD_RSREG PORTB		'PORTB.3:RSbit
Define LCD_RSBIT 3
Define LCD_EREG PORTB		'Ebit:PORTB.2
Define LCD_EBIT 2
Define LCD_BITS 4		'LCD bus meret
Define LCD_LINES 2		'2 soros

Buttontemp var Byte:h var Byte:b var byte:c var byte:t var byte:m1 var byte:m2 var byte:m3 var byte:m4 var byte:mb1 var byte:mb2 var byte:mt1 var byte
mt2 var byte:d1 var byte:I2Cdev var byte:SDA var PORTC.4:SCL var PORTC.3:I2Caddr var word

goto skip_on_int

On interrupt goto delay_5s	'megszakitasi rutin

disable			'megszakitas felfüggesztese
delay_5s:	d1=d1+1:INTCON.2=0
	if d1>77 then 		'5s=5000ms=65ms*77
		d1=0:INTCON=0	: goto kiirhe		'hangero kiirasa
	endif			'ha nem,vissza
	resume

enable
	
skip_on_int:

m1=0:m2=$40:m3=$80:m4=$c0:TRISC=$e7:TRISD=$f:TRISA=0:TRISB=0:I2Cdev=$50:I2Caddr=0:h=0:b=0:c=31:t=31:PORTA=63:high portd.4:ADCON0=0:ADCON1=7:CMCON=7:SSPCON=0
pause 500:lcdout $fe,1:pause 100:lcdout "   Udvozollek":pause 200:I2CWRITE SDA,SCL,I2Cdev,I2Caddr,[$1f,$5f,$9f,$df]:pause 100:OPTION_REG=7:INTCON=$a0

'*************************** A foprogram *****************************

main:	button PORTC.1,0,0,0,buttontemp,1,novelhe:button PORTC.6,0,0,0,buttontemp,1,csokkenthe:button PortC.5,0,0,0,buttontemp,1,bemnov
	button PORTd.3,0,0,0,buttontemp,1,bemcsokk:button PORTC.0,0,0,0,buttontemp,1,bassn:button PORTD.1,0,0,0,buttontemp,1,basscs
	button PORTc.7,0,0,0,buttontemp,1,tren:button PORTd.2,0,0,0,buttontemp,1,trecs:Goto main

'****************** A hangero-szabalyozo rutinjai ********************

novelhe:	if h<63 THEN h = h + 1

	if ( h < 16 ) OR ( h > 31 and h < 48 ) then
		portA = h + 16 : goto kiirhe
	endif
	if ( h > 15 and h < 32 ) OR ( h > 47 and h < 64) then
		porta = h - 16 : goto kiirhe
	endif

	Goto kiirhe

csokkenthe:	if h>0 then h= h - 1

	if ( h < 16 ) OR ( h > 31 and h < 48 ) then
		portA = h + 16 : goto kiirhe
	endif
	if ( h > 15 and h < 32 ) OR ( h > 47 and h < 64) then
		porta = h - 16 : goto kiirhe
	endif

	Goto kiirhe

'******************** A hangszinszabalyozo rutinjai ****************** 

bassn:	if c<63 THEN c = c + 2
	mb1=c & m1:mb2=c & m4:I2CWRITE SDA,SCL,I2Cdev,I2Caddr,[mb1,mb2]:pause 200:goto kiirmely

basscs: if c>1 then c= c - 2
	mb1 = c & m1:mb2 = c & m4:I2CWRITE SDA,SCL,I2Cdev,I2Caddr,[mb1,mb2]:pause 200:goto kiirmely

tren:	if t<63 THEN t = t + 2
	mt1 = t & m2:mt2 = t & m3:I2CWRITE SDA,SCL,I2Cdev,I2Caddr,[mt1,mt2]:Pause 200:goto kiirmely

trecs:	if t>1 THEN t = t - 2
	mt1 = t & m2:mt2 = t & m3:I2CWRITE SDA,SCL,I2Cdev,I2Caddr,[mt1,mt2]:Pause 200:goto kiirmely
	
'************************ A hangero cimkei ***************************
'replaced as shown above	

'************************ A hangero kiiratasa ************************

kiirhe:	lcdout $fe,1:pause 100:lcdout "  Hangero:  ",#h:pause 250:b=b+1:lcdout $fe,$c0:pause 100:lcdout "  Bemenet:  ",#b:pause 250:b=b-1:goto main

'*********************** A dB-ertekek kiiratasa **********************

kiirmely:	mb1=0:mb2=0

LOOKUP c,[0,20,0,15,0,9,0,8,0,7,0,6,0,5,0,4,0,4,0,3,0,2,0,2,0,1,0,1,0,0,0,0,0,0,0,1,0,1,0,2,0,2,0,3,0,4,0,4,0,5,0,6,0,7,0,8,0,9,0,15,0,20,0,20],mb1

LOOKUP c,[0,0,0,0,0,8,0,4,0,3,0,3,0,5,0,6,0,0,0,4,0,8,0,2,0,6,0,0,0,5,0,0,0,5,0,0,0,6,0,2,0,8,0,4,0,0,0,6,0,5,0,3,0,3,0,4,0,8,0,0,0,0,0,0],mb2	

	if c<32 then kiirmep			'pozitiv ertek eseten
	if c>32	then kiirmen			'negativ eseten

kiirmen: 	lcdout $fe,1:pause 100:lcdout " Mely:  ","-",#mb1,",",#mb2,"dB":goto kiirmag

kiirmep:	lcdout $fe,1:pause 100:lcdout " Mely:  "," ",#mb1,",",#mb2,"dB":goto kiirmag

kiirmag:	pause 250 : mb1=0:mb2=0
	
LOOKUP t,[0,20,0,15,0,9,0,8,0,7,0,6,0,5,0,4,0,4,0,3,0,2,0,2,0,1,0,1,0,0,0,0,0,0,0,1,0,1,0,2,0,2,0,3,0,4,0,4,0,5,0,6,0,7,0,8,0,9,0,15,0,20,0,20],mb1

LOOKUP t,[0,0,0,0,0,8,0,4,0,3,0,3,0,5,0,6,0,0,0,4,0,8,0,2,0,6,0,0,0,5,0,0,0,5,0,0,0,6,0,2,0,8,0,4,0,0,0,6,0,5,0,3,0,3,0,4,0,8,0,0,0,0,0,0],mb2

	if t<32 then kiirmap
	if t>32	then kiirman

kiirman:	lcdout $fe,$c0:pause 100:lcdout " Magas: ","-",#mb1,",",#mb2,"dB":pause 250:TMR0=0:d1=0:INTCON=%10100000:goto main

kiirmap:	lcdout $fe,$c0:pause 100:lcdout " Magas: "," ",#mb1,",",#mb2,"dB":pause 250:TMR0=0:d1=0:INTCON=%10100000:goto main	

'********************* A bemenetvalaszto rutinjai ********************

bemnov:	if b<3 then b=b+1
	goto new1

bemcsokk:	if b>0 then b=b-1
	goto new1

new1:	low portd.7:low portd.6:low portd.5:low portd.4 : high portd.0[ bem + 4 ] : goto kirrhe

'********************** 5 masodperces delay rutin  *******************	
'moved to near start of program
End