I change the code but i don't know if it is correct
Code:
DEFINE LCD_DREG PORTB
DEFINE LCD_DBIT 0
DEFINE LCD_RSREG PORTA
DEFINE LCD_RSBIT 2
DEFINE LCD_EREG PORTA
DEFINE LCD_EBIT 3
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2
DEFINE I2C_SCLOUT 1
SCL var PORTA.1
SDA var PORTA.0
UP var PORTB.6
DOWN var PORTB.7
CH_PAS var PORTB.5
Input UP
Input DOWN
Input CH_PAS
b1 var Byte
b2 var Byte
b3 var Byte
b5 var Byte
F1 var Word
F2 var Word
F3 var Word
ADDR1 VAR Byte
ADDR2 VAR Byte
LOCK VAR Byte
TMP VAR Word
TMP_LO VAR TMP.LowByte
TMP_HI VAR TMP.HighByte
PLLBASE VAR Word
PLL VAR Word
LO VAR PLL.LowByte
HI VAR PLL.HighByte
PAS VAR Byte
' Initialize interrupts
On Interrupt Goto loop
INTCON = $88 ' enable interrupts on RB4 through RB7
MAIN:
PLL = PLLBASE + TMP
I2CWRITE SDA,SCL,ADDR1,[HI,LO,$8E] 'Sending of the data to the module
GoSub CALCUL 'calculate the frequency for posting
GoSub AFFICHAGE 'post the frequency
PAUSE 200
@SLEEP
loop:
Button UP,1,10,2,b1,1,MONTE
Button DOWN,1,10,2,b2,1,DESCEND
Button CH_PAS,1,255,0,b3,1, CHOIX
PAUSE 100
I2CREAD SDA,SCL,ADDR2,[LOCK]
GoSub AFFICHAGE
INTCON.1 = 0 ' clear the interrupt flag
Resume ' end of interrupt service routine
Enable ' allow interrupts again
GoTo loop
MONTE:
.....
.....
GoTo MAIN
DESCEND:
.....
.....
GoTo MAIN
CHOIX:
.....
.....
GoTo MAIN
Bookmarks