News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

highlight.js for SMF

Started by Bugo, August 28, 2011, 01:18:09 PM

Previous topic - Next topic

gevv

Quote from: Bugo on April 14, 2012, 10:18:45 PM
Can you post this code here?



;ALARM415.ASM 12DEC02 - COPYRIGHT JOHN BECKER - EPE INTRUDER ALARM

;PIC16F877-4, 3.2768MHz, WDT OFF, POR ON, XTAL XS

;Config register bits
; CP1 CP0 DBG NIL WRT CPD LVP BOR CP1 CP0 POR WDT OS1 OS0
;  1   1   1   1   1   1   0   0   1   1   0   0   0   1
;N.B. Logic 1/0 do NOT necessarily mean that the function is On/Off
;respectively - refer to PIC '87 data sheet.

#DEFINE PAGE0   BCF 0x03,5
#DEFINE PAGE1   BSF 0x03,5

List P = PIC16F877, R=DEC;
       __CONFIG   h'3F31'

INDF    EQU 0x00  ;page 0, 1, 2, 3
OPTION_REG  EQU 0x01  ;page 1, 3
PCL     EQU 0x02  ;page 0, 1, 2, 3
STATUS  EQU 0x03  ;page 0, 1, 2, 3
FSR     EQU 0x04  ;page 0, 1, 2, 3

PORTA   EQU 0x05  ;page 0
TRISA   EQU 0x05  ;page 1
PORTB   EQU 0x06  ;page 0, 2
TRISB   EQU 0x06  ;page 1, 3
PORTC   EQU 0x07  ;page 0
TRISC   EQU 0x07  ;page 1
PORTD   EQU 0x08  ;page 0
TRISD   EQU 0x08  ;page 1
PORTE   EQU 0x09  ;page 0
TRISE   EQU 0x09  ;page 1

PCLATH  EQU 0x0A  ;page 0, 1, 2, 3
INTCON  EQU 0x0B  ;page 0, 1, 2, 3

EEDATA  EQU 0x0C  ;page 2
EECON1  EQU 0x0C  ;page 3
         
PIR2    EQU 0x0D  ;page 0
EEADR   EQU 0x0D  ;page 2
EECON2  EQU 0x0D  ;page 3

ADCON1  EQU 0x1F  ;page 1

SLOWIT   EQU 0x20        ; pause counter
CLKCNT   EQU 0x21
CLKSEC   EQU 0x22
CLKMIN   EQU 0x23
CLKHRS   EQU 0x24
LOOP     EQU 0x25
LOOPA    EQU 0x26
RSLINE   EQU 0x27
STORE    EQU 0x28
STORE1   EQU 0x29
STORE2   EQU 0x2A
STORE3   EQU 0x2B
ZONESVAL EQU 0x2C     ; current val of zones status
ALARMSTATUS EQU 0x2D  ; controls the following
                       ; bit 0 buzzer
                       ; bit 1 strobe
                       ; bit 2 bell
                       ; bit 3 -
                       ; bit 4 Panic flag
                       ; bit 5 passive entry zone (just turns on buzzer when entered)
                       ; bit 6 power interrupt flag
                       ; bit 7 alarm on flag

SWITCH1   EQU 0x2E   ; multiplex val for rows
SWVAL     EQU 0x2F   ; input val from RB0-RB3
COL       EQU 0x30   ; column counter (inc in decimal)
ROW       EQU 0x31   ; row counter (inc as matrix val)
ROWNUM    EQU 0x32   ; row counter (inc in decimal)
ALARMZONE EQU 0x33   ; holds status of which zone triggered
KEYPRESS  EQU 0x34   ; value of key pressed keypad1
PIN0      EQU 0x35   ; 1st pin number val FIRST KEYPAD
PIN1      EQU 0x36   ; 2nd pin number val
PIN2      EQU 0x37   ; 3rd pin number val
PIN3      EQU 0x38   ; 4th pin number val

EXITTIME  EQU 0x39   ; entry/exit delay
EXITZONE  EQU 0x3A   ; entry/exit zone
INCLZONE  EQU 0x3B   ; zones to be included in monitoring

BELLTIME      EQU 0x3C   ; bell on time value in BCD mins
FLASH        EQU 0x3D   ; flag for flashing buzzer LED when zone incorrectly open during alarm setting
ZONENORMAL   EQU 0x3E  ; normal zone logic
ENGINEERSET  EQU 0x3F ; flag to indicate if ENGINEER has been called
PREVALARMZONE EQU 0x40 ; previous alarm condition register
ENTRYDELAY   EQU 0x41 ; counter for entry/exit delay
PIN4         EQU 0x42   ; 1st pin number val FOR 2ND KEYPAD
PIN5         EQU 0x43   ; 2nd pin number val
PIN6         EQU 0x44   ; 3rd pin number val
PIN7         EQU 0x45   ; 4th pin number val
KEYPRESS2    EQU 0x46   ; value of key pressed keypad2
ENTRYTIME2   EQU 0x47   ; entry time for keypad2
ENTRYDELAY2  EQU 0x48   ; counter for keypad2 entry delay
CLKCNT2      EQU 0x49
STORED        EQU 0x4A   ; temp store for keypad2

COUNT0  EQU    0x50            ;lsb
COUNT1  EQU    0x51
COUNT2  EQU    0x52            ;msb
DIGIT1  EQU    0x53            ;lsd
DIGIT2  EQU    0x54
BITCNT  EQU    0x5B
DIGCNT  EQU    0x5C
STOREX EQU 0x60
STOREY EQU 0x61

          ; locations up to 0x7F are available

             ;************************************************************
             ;           Bit Definitions
             ;************************************************************

W      EQU 0
F      EQU 1
C      EQU 0
DC     EQU 1
Z      EQU 2

RP0    EQU 5           ;STATUS reg
RP1    EQU 6           ;STATUS reg
GIE    EQU 7           ;INTCON reg

RD     EQU 0  ;EECON1 reg eeprom read enable flag
WR     EQU 1  ;EECON1 reg eeprom write initiate flag
WREN   EQU 2  ;EECON1 reg eeprom write enable flag

EEPGD  EQU 7           ;EECON1 reg
EEIF   EQU 4           ;PIR2 reg

BUZZER EQU 0
STROBE EQU 1
BELL   EQU 2
PANIC  EQU 4
RBIF   EQU 0

;............. DATA EEPROM USE

                ; 0-3  PIN CODE
                ; 4    ZONES EXCLUDED
                ; 5    ENTRY/EXIT ZONE
                ; 6    ENTRY/EXIT DELAY
                ; 7    ZONES INTRUDED (AlarmZone)
                ; 8    ALARM ON/OFF & BELL, BUZZER, STROBE STATUS (AlarmStatus)
                ; 9    BELL ON TIME (MAX 15 MINS)
                ; 10   NORMAL ZONE STATUS
                ; 11-14 2ND PIN CODE
                ; 15   ENTRY DELAY VIA KEYPAD2

        ORG 0x0004      ;Interrupt vector address
        GOTO GIEOFF     ;Jump to interrupt routine on interrupt
        ORG 0x0005      ;Start of program memory

GIEOFF BCF INTCON,GIE  ;turn off global interrupts
        BTFSC INTCON,GIE
        goto GIEOFF
        goto START

TABLCD addwf PCL,F     ;LCD initialisation table
        retlw b'00110011' ;initialise lcd - first byte
        retlw b'00110011' ;2nd byte (repeat of first)
        retlw b'00110010' ;set for 4-bit operation
        retlw b'00101100' ;set for 2 lines
        retlw b'00000110' ;set entry mode to increment each address
        retlw b'00001100' ;set display on, cursor off, blink off
        retlw b'00000001' ;clear display
        retlw b'00000010' ;return home, cursor & RAM to zero
                        ;end inititalisation table

ALLOFF addwf PCL,F
        retlw 'A'
        retlw 'L'
        retlw 'L'
        retlw ' '
        retlw 'O'
        retlw 'F'
        retlw 'F'
        retlw ' '

MESSAGON addwf PCL,F
        retlw 'A'
        retlw 'L'
        retlw 'A'
        retlw 'R'
        retlw 'M'
        retlw ' '
        retlw 'O'
        retlw 'N'
        retlw ' '

MESSAG2 addwf PCL,F
        retlw ' '
        retlw ' '
        retlw 'E'
        retlw 'N'
        retlw 'T'
        retlw 'R'
        retlw 'Y'
        retlw ' '

CHKVAL addwf PCL,F
        retlw b'01011001' ;59 secs max
        retlw b'01011001' ;59 mins max
        retlw b'00100011' ;23 hours max

VALUE  ADDWF PCL,F       ;lookup table for key allocation
        retlw '1'
        retlw '2'
        retlw '3'
        retlw 'A'
        retlw '4'
        retlw '5'
        retlw '6'
        retlw 'B'
        retlw '7'
        retlw '8'
        retlw '9'
        retlw 'C'
        retlw '-'
        retlw '0'
        retlw 'E'
        retlw 'D'

BITVALUE ADDWF PCL,F       ;lookup table for decimal to bit conversion
        retlw .0
        retlw .1
        retlw .2
        retlw .4
        retlw .8
        retlw .16
        retlw .32
        retlw .64
        retlw .128

PINCODE ADDWF PCL,F       ; change pin code message
        retlw 'C'
        retlw 'H'
        retlw 'A'
        retlw 'N'
        retlw 'G'
        retlw 'E'
        retlw ' '
        retlw 'P'
        retlw 'I'
        retlw 'N'
        retlw ' '
        retlw 'C'
        retlw 'O'
        retlw 'D'
        retlw 'E'
        retlw ' '

PIN2MSG ADDWF PCL,F       ; change 2ND pin code message
        retlw 'S'
        retlw 'E'
        retlw 'T'
        retlw ' '
        retlw '2'
        retlw 'N'
        retlw 'D'
        retlw ' '
        retlw 'P'
        retlw 'I'
        retlw 'N'
        retlw ' '
        retlw 'C'
        retlw 'O'
        retlw 'D'
        retlw 'E'

ENTRYTIME ADDWF PCL,F       ; change ENTRY/EXIT time message
        retlw 'S'
        retlw 'E'
        retlw 'T'
        retlw ' '
        retlw 'I'
        retlw 'N'
        retlw '/'
        retlw 'O'
        retlw 'U'
        retlw 'T'
        retlw ' '
        retlw 'T'
        retlw 'I'
        retlw 'M'
        retlw 'E'
        retlw ' '

BELLTIMEMSG ADDWF PCL,F       ; change ENTRY/EXIT time message
        retlw 'S'
        retlw 'E'
        retlw 'T'
        retlw ' '
        retlw 'B'
        retlw 'E'
        retlw 'L'
        retlw 'L'
        retlw ' '
        retlw 'O'
        retlw 'N'
        retlw ' '
        retlw 'T'
        retlw 'I'
        retlw 'M'
        retlw 'E'

ENTRYZONE ADDWF PCL,F       ; set ENTRY/EXIT zone message
        retlw 'S'
        retlw 'E'
        retlw 'T'
        retlw ' '
        retlw 'I'
        retlw 'N'
        retlw '/'
        retlw 'O'
        retlw 'U'
        retlw 'T'
        retlw ' '
        retlw 'Z'
        retlw 'O'
        retlw 'N'
        retlw 'E'
        retlw ' '

MODEMSG ADDWF PCL,F       ; mode message
        retlw 'S'
        retlw 'E'
        retlw 'L'
        retlw 'E'
        retlw 'C'
        retlw 'T'
        retlw ' '
        retlw 'M'
        retlw 'O'
        retlw 'D'
        retlw 'E'
        retlw ' '
        retlw ' '
        retlw ' '
        retlw ' '
        retlw ' '

WATCHMSG ADDWF PCL,F       ; zones to be watched message
        retlw 'S'
        retlw 'E'
        retlw 'T'
        retlw ' '
        retlw 'W'
        retlw 'A'
        retlw 'T'
        retlw 'C'
        retlw 'H'
        retlw ' '
        retlw 'Z'
        retlw 'O'
        retlw 'N'
        retlw 'E'
        retlw 'S'
        retlw ' '

OPENZONE ADDWF PCL,F       ; zones incorrectly open when alarm is being set
        retlw 'C'
        retlw 'H'
        retlw 'E'
        retlw 'C'
        retlw 'K'
        retlw ' '
        retlw 'O'
        retlw 'P'
        retlw 'E'
        retlw 'N'
        retlw ' '
        retlw 'Z'
        retlw 'O'
        retlw 'N'
        retlw 'E'
        retlw 'S'

ZONELOGIC ADDWF PCL,F       ; assess zone logic message (i.e normally open or normally closed)
        retlw 'A'
        retlw 'U'
        retlw 'T'
        retlw 'O'
        retlw ' '
        retlw 'Z'
        retlw 'O'
        retlw 'N'
        retlw 'E'
        retlw ' '
        retlw 'A'
        retlw 'S'
        retlw 'S'
        retlw 'E'
        retlw 'S'
        retlw 'S'

SHOWLOGIC ADDWF PCL,F       ; assess zone logic message (i.e normally open or normally closed)
        retlw 'N'
        retlw 'O'
        retlw 'R'
        retlw 'M'
        retlw ' '
        retlw 'Z'
        retlw 'O'
        retlw 'N'
        retlw 'E'
        retlw ' '
        retlw 'L'
        retlw 'O'
        retlw 'G'
        retlw 'I'
        retlw 'C'
        retlw ' '

PASSIVEMSG ADDWF PCL,F       ; passive alarm message
        retlw 'M'
        retlw 'O'
        retlw 'N'
        retlw 'I'
        retlw 'T'
        retlw 'O'
        retlw 'R'
        retlw ' '

START  bcf STATUS,RP0
        bcf STATUS,RP1
        clrf PORTA
        clrf PORTB
        clrf PORTC
        clrf PORTD
        clrf PORTE
        PAGE1
        movlw b'11011111'     ;RB0-RB4, RB6-RB7 as input, RB5 as output
        movwf TRISB
        movlw b'00001111'     ;RC0-RC3 as input, RC4-RC7 as output
        movwf TRISC         
        movlw .255
        movwf TRISD         ;PORTD as input
        clrf TRISE          ;PORTE as output
        movlw b'00000111'     ;PORT A/E as digital
        movwf ADCON1        ;
        movlw b'11000000'     ;RA0-RA5 as outputs
        movwf TRISA

        movlw b'00000110'     ;timer 1128 (1/25th sec)
        movwf OPTION_REG
        PAGE0
        clrf INTCON
        call PAUSIT     ;1/5 sec delay

LCDSET clrf LOOP       ;clr LCD set-up loop
        clrf RSLINE     ;clear RS line for instruction send
LCDST2 movf LOOP,W     ;get table address
        call TABLCD     ;get set-up instruction
        call LCDOUT     ;perform it
        incf LOOP,F     ;inc loop
        btfss LOOP,3    ;has last LCD set-up instruction now been done?
        goto LCDST2     ;no
        call PAUSIT     ;1/5 sec delay

        clrf ENGINEERSET
        bsf ALARMSTATUS,6   ; set Power interruption flag

        call KEYPAD1    ; is ENGINEER code to be entered following power-up
        movf KEYPRESS,W ; with key 'D' pressed?
        xorlw 'D'
        btfss STATUS,Z
        goto SETCLK     ; no

        clrf ALARMZONE
        clrf ALARMSTATUS
        bsf ENGINEERSET,0
        bcf ALARMSTATUS,6   ; clear Power interruption flag

        movlw b'10000001' ; default set INCLZONE for zones 1 & 8
        movwf STORE1
        movlw .4
        call SETPRM

        movlw b'00000001' ; default set entry/exit zone
        movwf STORE1
        movlw .5
        call SETPRM

        movlw .30        ; default set EXITTIME to 30 secs in binary
        movwf STORE1
        movlw .6
        call SETPRM

        clrf STORE1     ; default clear INTRUDED status
        movlw .7
        call SETPRM
        clrf PORTE

        clrf STORE1     ; default clear ALARMSTATUS (bell etc)
        bcf STORE1,BELL
        movlw .8
        call SETPRM

        movlw b'00010101' ; default set bell switch-off time to 15 mins in BCD
        movwf STORE1
        movlw .9
        call SETPRM

        movlw b'00000000' ; default set for "normal" zone status - all open
        movwf STORE1
        movlw .10
        call SETPRM

        movlw .30        ; default set ENTRYTIME to 30 secs in binary for keypad2
        movwf STORE1
        movlw .15
        call SETPRM

        call ENGINEER   ; yes, set ENGINEER entry code and reset all defaults

SETCLK clrf CLKSEC     ;clear seconds counter
        clrf CLKMIN     ;clear minutes counter
        clrf CLKHRS     ;clear hours counter
        clrf PREVALARMZONE
        clrf ENTRYDELAY
        clrf ENTRYDELAY2

        movlw .25        ;initial basic CLKCNT val for secs timing
        movwf CLKCNT

        movlw .0         ; RECALL PIN CODE
        call PRMGET
        movwf PIN0
        movlw .1
        call PRMGET
        movwf PIN1
        movlw .2
        call PRMGET
        movwf PIN2
        movlw .3
        call PRMGET
        movwf PIN3

        movlw .4            ; RECALL INCLUDED/EXCLUDED ZONES
        call PRMGET
        movwf INCLZONE
        bsf INCLZONE,7     ; ensure bit 7 (1st PANIC zone) is always on

        movlw .5            ; RECALL ENTRY/EXIT ZONE
        call PRMGET
        movwf EXITZONE
        movlw .6            ; RECALL ENTRY/EXIT TIME
        call PRMGET
        movwf EXITTIME
        movlw .7            ; RECALL ALARMZONE STATUS
        call PRMGET
        movwf ALARMZONE
        movlw .8            ; RECALL ALARMSTATUS STATUS
        call PRMGET
        movwf ALARMSTATUS  ; and activate buzzer/strobe if needed (but not bell)
        andlw b'00000011'
        movwf PORTE
        movlw .9            ; RECALL BELL ON TIME
        call PRMGET
        movwf BELLTIME
        movlw .10           ; RECALL "NORMAL ZONE STATUS
        call PRMGET
        movwf ZONENORMAL

        movlw .11           ; RECALL PIN CODE 2
        call PRMGET
        movwf PIN4
        movlw .12
        call PRMGET
        movwf PIN5
        movlw .13
        call PRMGET
        movwf PIN6
        movlw .14
        call PRMGET
        movwf PIN7

        movlw .15           ; RECALL ENTRY TIME FOR KEYPAD2
        call PRMGET
        movwf ENTRYTIME2

        btfss ALARMSTATUS,7 ; is alarm on?
        goto ITSOFF
        call CHECKZONE2
        bsf ALARMSTATUS,6   ; set Power interruption flag
        goto MAIN

ITSOFF call ALARMOFF   ; show ALARM OFF message
        btfsc ENGINEERSET,0 ; has ENGINEER been called?
        goto MAIN       ;yes

        call LCD21      ;set address for line 1 cell 1
        bsf RSLINE,4    ;set RS for data send
        movlw 'P'
        call LCDOUT
        movlw 'O'
        call LCDOUT
        movlw 'W'
        call LCDOUT
        movlw 'E'
        call LCDOUT
        movlw 'R'
        call LCDOUT
        movlw ' '
        call LCDOUT
        movlw 'E'
        call LCDOUT
        movlw 'R'
        call LCDOUT
        movlw 'R'
        call LCDOUT
        movlw 'O'
        call LCDOUT
        movlw 'R'
        call LCDOUT
        clrf ENGINEERSET   ; clear ENGINEER flag

;............................ END OF SETUP

MAIN   call CHECKMODE
        call PINENTRY2
        movf ENTRYDELAY2,W  ; has entry2 delay timed out?
        btfss STATUS,Z
        call CONTINUEENTRY2 ; no, continue countdown of entry2
        goto MAIN

ALARMISON btfss ALARMSTATUS,7 ; is alarm on ?
        return            ; no
        call MONITOR      ; get current status of zones 1-8
        call CHECKZONE    ; compare current and preset zones status
        call SETBELLS
        call CLKIN
        return

PASSIVEALARM
        call MONITOR      ; get current status of zones 1-8
        call CHECKZONE    ; compare current and preset zones status
        movf ZONESVAL,W
        btfss STATUS,Z
        goto PAS1
        bcf PORTE,BUZZER
        goto PAS2
PAS1   bsf PORTE,BUZZER
PAS2   call LCD21          ;set address for line 1 cell 1
        bsf RSLINE,4       ;set RS for data send
        movf ZONESVAL,W
        movwf STORE1       ; store INTRUDED status
        call SHOWZONE
        return

;******* CHECK MODE

CHECKMODE call KEYPAD1   ; is key pressed?
        movf KEYPRESS,W
        btfsc STATUS,Z
        return            ; no, so return

CHECKM2 call WAITKEYPRESS
        movf KEYPRESS,W      ; is keypress = pin number?
        xorwf PIN0,W
        btfss STATUS,Z
        return

        call WAITKEYRELEASE
        call WAITKEYPRESS
        movf KEYPRESS,W      ; is keypress = pin number?
        xorwf PIN1,W
        btfss STATUS,Z
        return

        call WAITKEYRELEASE
        call WAITKEYPRESS
        movf KEYPRESS,W      ; is keypress = pin number?
        xorwf PIN2,W
        btfss STATUS,Z
        return

        call WAITKEYRELEASE
        call WAITKEYPRESS
        movf KEYPRESS,W      ; is keypress = pin number?
        xorwf PIN3,W
        btfss STATUS,Z
        return

        goto AMENDMODE       ; yes

;*********** AMEND MODE  **********

AMENDMODE clrf PORTE      ; turn off bell, buzzer, strobe
        btfss ALARMSTATUS,7  ; is alarm already in alarm mode?
        goto AMEND0     ; no
        goto AMEND2     

AMEND0 call LCD1       ;set address for line 1 cell 1
        bsf RSLINE,4    ;set RS for data send
        clrf LOOP       ;clear loop
        bsf RSLINE,4    ;set RS for data send
AMEND1 movf LOOP,W     ;get table address
        call MODEMSG    ;get message letter
        call LCDOUT     ;show it
        incf LOOP,F     ;inc loop
        btfss LOOP,4    ;has last LCD letter been sent?
        goto AMEND1     ;no
        call CLRLINE2

AMEND2 clrf ALARMSTATUS
        clrf ALARMZONE
        clrf PREVALARMZONE

        call WAITKEYRELEASE
        call WAITKEYPRESS

        movf KEYPRESS,W  ; is keypress = '0' - alarm on?
        xorlw '0'
        btfsc STATUS,Z
        goto ALARMON     ; yes, so set alarm on and exit

CHECK12 movf KEYPRESS,W ; is keypress = '-' - cancel?
        xorlw '-'
        btfsc STATUS,Z
        goto ALARMOFF    ; general return to normal off status

CHECK0 movf KEYPRESS,W  ; is keypress = '1' - change PIN code?
        xorlw '1'
        btfss STATUS,Z
        goto CHECK1
        call ENGINEER
        goto AMEND0

CHECK1 movf KEYPRESS,W  ; is keypress = '2' - change ENTRY/EXIT time?
        xorlw '2'
        btfss STATUS,Z
        goto CHECK2
        call CHANGEENTRY
        goto AMEND0

CHECK2 movf KEYPRESS,W  ; is keypress = '3' - change ENTRY/EXIT ZONE?
        xorlw '3'
        btfss STATUS,Z
        goto CHECK3
        call SETENTRY
        goto AMEND0

CHECK3 movf KEYPRESS,W  ; is keypress = '4' - select zones to monitored?
        xorlw '4'
        btfss STATUS,Z
        goto CHECK4
        call SETMONITOR
        goto AMEND0

CHECK4 movf KEYPRESS,W  ; is keypress = '5' - select bell on time (max 15 mins)
        xorlw '5'
        btfss STATUS,Z
        goto CHECK5
        call SETBELLTIME
        goto AMEND0

CHECK5 movf KEYPRESS,W  ; is keypress = '6' - assess normal zone logic
        xorlw '6'
        btfss STATUS,Z
        goto CHECK6
        call ASSESSLOGIC
        goto AMEND0

CHECK6 movf KEYPRESS,W  ; is keypress = '7' - preset normal zone logic
        xorlw '7'
        btfss STATUS,Z
        goto CHECK7
        call PRESETLOGIC
        goto AMEND0

CHECK7 movf KEYPRESS,W  ; is keypress = '8' - set 2nd pin code
        xorlw '8'
        btfss STATUS,Z
        goto CHECK8
        call PINCODE2
        goto AMEND0

CHECK8 movf KEYPRESS,W  ; is keypress = '9' - change ENTRY time for keypad2 ?
        xorlw '9'
        btfss STATUS,Z
        goto CHECK14
        call CHANGEENTRY2
        goto AMEND0

CHECK14 movf KEYPRESS,W  ; is keypress = '.' (coded 'E') - buzzer only monitor of entries
        xorlw 'E'
        btfss STATUS,Z
        goto CHECK15
        goto SETPASSIVE

CHECK15
        goto AMEND2


; ******** PASSIVE MODE

SETPASSIVE call LCD1  ;set LCD for line 1, cell 1
         bsf RSLINE,4   ;set LCD RS line high

        clrf LOOP       ;clear loop
SETP2  movf LOOP,W     ;get table address
        call PASSIVEMSG ;get message letter
        call LCDOUT     ;show it
        incf LOOP,F     ;inc loop
        btfss LOOP,3    ;has last LCD letter been sent?
        goto SETP2      ;no
        movlw 'M'
        call LCDOUT
        movlw '0'
        call LCDOUT
        movlw 'D'
        call LCDOUT
        movlw 'E'
        call LCDOUT
        bsf ALARMSTATUS,5
        return

;********* CHANGE ENTRY/EXIT TIME

CHANGEENTRY call LCD1  ;set LCD for line 1, cell 1
         bsf RSLINE,4   ;set LCD RS line high

        clrf LOOP       ;clear loop
ENT2   movf LOOP,W     ;get table address
        call ENTRYTIME  ;get message letter
        call LCDOUT     ;show it
        incf LOOP,F     ;inc loop
        btfss LOOP,4    ;has last LCD letter been sent?
        goto ENT2       ;no

        call CLRLINE2
        call LCD23      ;set LCD for line 2, cell 3
        bsf RSLINE,4    ;set LCD RS line high
        movlw ' '
        call LCDOUT
        movlw 'P'
        call LCDOUT
        movlw 'R'
        call LCDOUT
        movlw 'E'
        call LCDOUT
        movlw 'V'
        call LCDOUT
        movlw ' '
        call LCDOUT
        movf EXITTIME,W
        movwf COUNT0
        call BIN2DEC

        movf DIGIT2,W
        addlw .48
        call LCDOUT
        movf DIGIT1,W
        addlw .48
        call LCDOUT

        call LCD21      ;set LCD for line 2, cell 1
        bsf RSLINE,4    ;set LCD RS line high

        call WAITKEYRELEASE
ENT3   call WAITKEYPRESS ; get first value (tens)
        movf KEYPRESS,W ; is keypress = 12 - cancel?
        xorlw '-'
        btfsc STATUS,Z
        return          ; yes

        btfsc KEYPRESS,6 ; is it >= 'A'?
        goto ENT3        ; yes, so try again

        movf KEYPRESS,W
        andlw b'00001111'

        movwf COUNT1
        movwf COUNT2
        movf KEYPRESS,W
        call LCDOUT

        call WAITKEYRELEASE
ENT4   call WAITKEYPRESS   ; get 2nd val (units)
        movf KEYPRESS,W ; is keypress = 12 - cancel?
        xorlw '-'
        btfsc STATUS,Z
        return          ; yes

        btfsc KEYPRESS,6 ; is it >= 'A'?
        goto ENT4        ; yes, so try again

        movf KEYPRESS,W
        andlw b'00001111'
        movwf COUNT0
        addwf COUNT1,W   ; is total = 0?
        btfsc STATUS,Z
        goto ENT4        ; yes, so try again
        movf KEYPRESS,W
        call LCDOUT

ENT5   call WAITKEYRELEASE
        call WAITKEYPRESS
        movf KEYPRESS,W
        xorlw 'D'        ; is key = 15? - completion code number
        btfsc STATUS,Z
        goto ENT6        ; yes

        movf KEYPRESS,W
        xorlw '-'        ; is key = 12? - error in number so start again
        btfss STATUS,Z
        goto ENT5        ; no
        goto CHANGEENTRY ; yes

ENT6   call WAITKEYRELEASE
        bcf STATUS,C
        rlf COUNT1,F     ; convert decimal to binary
        rlf COUNT1,F
        rlf COUNT1,W
        addwf COUNT2,W
        addwf COUNT2,W
        addwf COUNT0,W
        movwf EXITTIME
        movf EXITTIME,W
        movwf STORE1
        movlw .6
        call SETPRM
        call STORIT
        return

;********* MONITOR ZONES   *********

MONITOR swapf PORTC,W   ; get RC0-RC3, store it as MS nibble
         andlw b'11110000'
         movwf ZONESVAL
         movf PORTD,W    ; get RD0-RD3, store it as LS nibble
         andlw b'00001111'
         iorwf ZONESVAL,F
         return

; ********* compare current and preset zones status

CHECKZONE movf ENTRYDELAY2,W  ; has entry2 delay timed out?
        btfss STATUS,Z
        call CONTINUEENTRY2 ; no, continue countdown       

        movf ZONESVAL,W    ; get current zones val
        xorwf ZONENORMAL,W ; XOR with normal zones status
        btfss STATUS,Z     ; has a zone status been changed?
        goto ZCH2          ; yes
        movf ALARMZONE,W   ; have any zones been triggered?
        btfsc STATUS,Z     ;
        return             ; no

ZCH2   movwf ZONESVAL     ; yes
        andwf INCLZONE,W   ; is it a required zone?
        btfsc STATUS,Z
        return             ; no

        movwf ZONESVAL
        btfsc ALARMSTATUS,5 ; yes, is alarm in passive status (just sets buzzer)?
        return              ; yes

        iorwf ALARMZONE,W  ; no, OR answer with previous zones triggered value
        movwf ALARMZONE

        btfsc ALARMSTATUS,STROBE  ; has alarm already been triggered?
        goto ZONEB          ; yes

        movf ALARMZONE,W
        andwf EXITZONE,W   ; has entry zone been triggered?
        btfsc STATUS,Z
        goto ZONEB         ; no

        movf ENTRYDELAY,W   ; yes, has entry delay timed out?
        btfsc STATUS,Z
        goto ZONEB         ; yes

        bsf ALARMSTATUS,BUZZER ; no so continue countdown
        call CONTINUEENTRY ;

        call LCD21          ;set address for line 1 cell 1
        bsf RSLINE,4       ;set RS for data send
        movlw 'E'
        call LCDOUT
        movlw 'N'
        call LCDOUT
        movlw 'T'
        call LCDOUT
        movlw 'R'
        call LCDOUT
        movlw 'Y'
        call LCDOUT
        return

ZONEB  movf ALARMZONE,W
        xorwf PREVALARMZONE,W  ; is it same as previous alarm zone setting?
        btfsc STATUS,Z
        return               ; yes

        movf ALARMZONE,W
        movwf PREVALARMZONE

        movwf STORE1       ; store INTRUDED status
        movlw .7
        call SETPRM

CHECKZONE2                ; called also from power up entry
        call LCD1          ;set address for line 1 cell 1
        bsf RSLINE,4       ;set RS for data send
        movf ALARMZONE,W
        movwf STORE1       ; store INTRUDED status
        call SHOWZONE

        clrf LOOP       ;clear loop
        bsf RSLINE,4    ;set RS for data send
        btfss ALARMSTATUS,PANIC
        goto LCDMS3     ; ...... TRIG
        movlw 'P'
        call LCDOUT

LCDMS3 movf LOOP,W     ;get table address
        call MESSAG2    ;get ENTERED message letter
        call LCDOUT     ;show it
        incf LOOP,F     ;inc loop
        btfss LOOP,3    ;has last LCD letter been sent?
        goto LCDMS3     ;no

TRIG   btfss ALARMSTATUS,STROBE    ; has alarm already been triggered?
        bsf ALARMSTATUS,BELL        ; no, so trigger bell
        bsf ALARMSTATUS,BUZZER
        bsf ALARMSTATUS,STROBE

        movf ALARMSTATUS,W          ; store ALARMSTATUS (but with bell off) to eeprom
        movwf STORE1
        bcf STORE1,BELL
        movlw .8
        call SETPRM
        return

; ****** SETS BELL BUZZER STROBE with ALARMSTATUS value

SETBELLS movf ALARMSTATUS,W
        andlw b'00000111'
        movwf PORTE
        return

;********* CLOCK UPDATING

CLKIN  btfss ALARMSTATUS,STROBE  ; clock only used if strobe active
        return                    ; allowing elapsed time since first zone triggered to be shown
        btfss INTCON,2            ; has timer rollover occurred?
        return                    ; no

        BCF INTCON,2     ; yes, clear timer flag
        decfsz CLKCNT,F  ; increment clock routine. Is it = 0?
        return           ; no

CLKADD movlw .25         ; reset start value of CLKCNT
        movwf CLKCNT

SECCLK movlw CLKSEC
        movwf FSR
        movlw .3
        movwf LOOPA

ADDCLK incf INDF,F     ;inc units
        movlw .6
        addwf INDF,W    ;if 6 is added is there a digit carry?
        btfss STATUS,DC
        goto CHK15      ;no
        movwf INDF      ;yes
        movlw .160
        addwf INDF,W    ;if 160 is added is there a carry
        btfss STATUS,C  ;(adding 160 checks if tens of units = 6)
        goto CHK15      ;no
        clrf INDF       ;yes
        incf FSR,F
        decfsz LOOPA,F
        goto ADDCLK

CHK15  movf CLKMIN,W         ; has bell been on for set number of mins?
        xorwf BELLTIME,W      ; mins in BCD (max 20)
        btfsc STATUS,Z
        bcf ALARMSTATUS,BELL

CLKSHW call LCD21      ;set address for line 1 cell 9
        bsf RSLINE,4    ;set RS for data send
        movf CLKHRS,W   ;get hrs
        call LCDFRM     ;format and send it
        movlw ' '       ;insert colon
        call LCDOUT
        movf CLKMIN,W   ;get mins
        call LCDFRM
        movlw '.'       ;insert colon
        call LCDOUT
        movf CLKSEC,W   ;get secs
        call LCDFRM
        btfss ALARMSTATUS,6 ; has there been a power interruption?
        return          ;no

        movlw ' '       ; yes
        call LCDOUT
        movlw 'P'
        call LCDOUT
        movlw 'S'
        call LCDOUT
        movlw 'U'
        call LCDOUT
        movlw ' '
        call LCDOUT
        movlw 'E'
        call LCDOUT
        movlw 'R'
        call LCDOUT
        movlw 'R'
        call LCDOUT
        return

;..........GET KEYPAD 1 VAL ROUTINE........

KEYPAD1 clrf KEYPRESS
         btfss INTCON,RBIF    ; has Panic been pushed
         goto KP2             ; no
         call PANICSET

KP2     btfsc ALARMSTATUS,7  ; is alarm on?
         call ALARMISON       ; yes
         btfsc ALARMSTATUS,5  ; is alarm on?
         call  PASSIVEALARM   ; yes

;         goto KEYPAD2

         movlw b'00001111'
         movwf PORTC
         movwf STORE
         nop              ;pause to allow PORTC to stabilise
         comf PORTB,W     ;get & invert PORTB
         andlw b'00001111'  ;isolate bits 0-3
         btfsc STATUS,Z   ;is result NOT zero (keys pressed)?
         return           ;no, so return to main prog

         movlw b'10000000'  ;yes, a key is pressed so get it
         movwf SWITCH1    ;initial val for RC4-7
         movlw .3          ;initial val for COL
         movwf COL
         clrf ROW         ;initial val for ROW

GETIT   comf SWITCH1,W   ;get and invert val for PORTC
         iorwf STORE,W
         movwf PORTC      ;output to PORTC
         nop              ;pause to allow PORTC to stabilise
         comf PORTB,W     ;get and invert val from PORTB
         andlw .15         ;isolate bits 0-3
         btfss STATUS,Z   ;is it zero?
         goto GET2        ;no, so goto analysis routine
         decf COL,F       ;dec col val
         bcf STATUS,C     ;clear carry flag
         rrf SWITCH1,F    ;divide RC7-4 val by 2
         movf SWITCH1,W   ;
         andlw b'11110000'
         btfss STATUS,C   ;is it zero?
         goto GETIT       ;no, so continue loop
         return           ;yes, so return to main program

GET2    movwf SWVAL      ;store PORTB val
         clrf ROW         ;clear row count
         clrf ROWNUM      ;clear row number count

GET3    rrf SWVAL,F      ;rotate right PORTB store val
         btfsc STATUS,C   ;is carry flag set?
         goto SUMIT       ;yes so key pressed, go & finish answer
         movlw .4
         addwf ROW,F      ;add matrix val to ROW count
         incf ROWNUM,F    ;inc row number count
         btfss ROWNUM,2
         goto GET3

SUMIT   movf ROW,W       ;sum up results to single answer
         addwf COL,W      ;add ROW to COL (total of 0-15)
         call VALUE
         movwf KEYPRESS   ; store result into KEYPRESS
         call DEBOUNCE
         return           ;return to main program

;********* SET ENGINEER'S PIN CODE

ENGINEER call LCD1       ;set LCD for line 1, cell 1
         bsf RSLINE,4     ;set LCD RS line high

        clrf LOOP       ;clear loop
ENG2   movf LOOP,W     ;get table address
        call PINCODE    ;get message letter
        call LCDOUT     ;show it
        incf LOOP,F     ;inc loop
        btfss LOOP,4    ;has last LCD letter been sent?
        goto ENG2       ;no

        call CLRLINE2
        call LCD21      ;set LCD for line 2, cell 1
        bsf RSLINE,4    ;set LCD RS line high

        movlw PIN0
        movwf FSR
        clrf LOOP

ENG3   call WAITKEYRELEASE
        call WAITKEYPRESS

        movf KEYPRESS,W
        xorlw '-'        ; is key = 12? - error in number so start again
        btfss STATUS,Z   ; ... c
        goto ENG4        ; ... ENG
ElkArte is a modern, powerful community building forum software. https://www.elkarte.net/

Bugo

I have no problem with this.

sangham.net

#22
Dear mod-master,

thanks a lot for your mod! Works fine. Suki brought me here in my "Display layout for [ code ] BBC in notepad++ style" request and the "desire" to make the outlook a little more html friendly. So I just try to bring it into the usual notepad style.
I could not see trough it in regard of splitting certain text parts in different colors. Especially the text part of htmls. Is there one special id included which serves this part?

Much gratitude for your service.

* Johann B edited, because nearly forgot:

German "formal-utf8"

<?php

$txt
['ch_title'] = 'Syntax Hervorhebung: Highlight';
$txt['ch_settings'] = 'Highlight Einstellungen';
$txt['ch_desc'] = 'In diesem Bereich können Sie die Hervorhebungen aktivieren/deaktivieren, ein bevorzugtes Theme wählen, usw.';
$txt['ch_enable'] = 'Aktivieren von Syntax Highlighting';
$txt['ch_style'] = 'Hervorhebungsstile (Theme)';
$txt['ch_style_set'] = array(
'arta' => 'Arta',
'ascetic' => 'Ascetic',
'brown_paper' => 'Brown Paper',
'dark' => 'Dark',
'default' => 'Default',
'far' => 'FAR',
'github' => 'GitHub',
'googlecode' => 'Google Code',
'hemisu-light' => 'Hemisu Light',
'idea' => 'IDEA',
'ir_black' => 'IR_Black',
'magula' => 'Magula',
'monokai' => 'Monokai',
'pojoaque' => 'Pojoaque',
'rainbow' => 'Rainbow',
'school_book' => 'School Book',
'solarized_dark' => 'Solarized Dark',
'solarized_light' => 'Solarized Light',
'sunburst' => 'Sunburst',
'tomorrow' => 'Tomorrow',
'tomorrow-night' => 'Tomorrow Night',
'tomorrow-night-blue' => 'Tomorrow Night Blue',
'tomorrow-night-bright' => 'Tomorrow Night Bright',
'tomorrow-night-eighties' => 'Tomorrow Night Eighties',
'vs' => 'Visual Studio',
'xcode' => 'XCode',
'zenburn' => 'Zenburn'
);
$txt['ch_tab'] = 'Anzahl der Zeichen zwischen den Kolonnen';
$txt['ch_fontsize'] = 'Schriftgröße';
$txt['ch_example'] = 'Vorschau';

?>

Dhayzon

works with version 2.1? :C

alexetgus

#24
Made translation into French and French-utf8.

Added CSS property for bug correcting in longs lines:
word-wrap: break-word;


Download here : code_highlighting.zip

Please add these languages and CSS correction to the mod, please, and then remove this post.





Traduction française effectuée vers french et french-utf8

Ajout d'une propriété CSS pour corriger un bug en cas le lignes longues sans espaces :
word-wrap: break-word;

Téléchargez ici : code_highlighting.zip

Merci d'ajouter ces langues et la correction CSS au mod, SVP, et de supprimer ce post ensuite.




Miker1029

#25
Just had a quick question, Is there a SIZE LIMIT, Character wise??   When I did the Install/Test I just so happened to have Subs.php in Notepad++ and cut and pasted it in and the bottom half was cut off and the {/code} was omitted due to the cut off which pretty much breaks the {code}/{/code} structure...

Other wise love the MOD!

Also I've Downloaded the highlight.js from the link provided on page 1, And I Found the Java File, But Can't find "/css/highlight/" Directory to add the styles that came with the Download from Highlight.js??

Should I just make it??   I see you have styles in yours and can't locate them anywhere...
Mike

alexetgus

#26
Salut,

Sorry, i'm not speak english.
I speak french...

Les fichiers de style sont chargés à distance sur la plateforme web http://cdnjs.cloudflare.com  (The style files are loaded remotely on the web platform cloudflare.com)
Tu trouveras dans le fichier /sources/Subs-Highlight.php à la ligne 72. (You will find in the file line 72)

Cette procédure ne m'a pas fait plaisir quand je l'ai remarqué. (This procedure I was not pleased when I noticed it.)
J'ai donc copié tous les fichiers css stockés chez cloudflare.com pour les installer sur mon site. (I then copied all the css files that are stored in cloudflare.com for install on my site.)
Il suffit juste de modifier la ligne 72 pour qu'elle charge le css depuis ton site. (Simply just change line 72 so it loads the css from your site.)

Original :

<link rel="stylesheet" type="text/css" href="http://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/' . $modSettings['ch_style'] . '.min.css" />


Modified : (css stocké dans le dossier /Themes/css/highlight/)

<link rel="stylesheet" type="text/css" href="'. $settings['default_theme_url']. '/css/highlight/'. $modSettings['ch_style'] . '.min.css" />


Si tu veux tous les fichiers CSS, tu peux les télécharger ici : (If you want all the CSS files, you can download them here:)
http://ovh.to/ZkmqXC (this directory is protected with a index.php)

Install the directory /highlight/ in /Themes/default/css/

Enjoy ! ;)


EDIT
Translate French to English attempt... :-[

Miker1029

Ok, Google Translate est notre ven

Qui fonctionne bien, et de très bonnes informations, merci!

mike

FOR OTHERS:

QuoteHi,

Sorry, i'm not speak English.
I speak french ...

Style files are loaded remotely on the web platform http://cdnjs.cloudflare.com (The style files are loaded remotely on the web platform cloudflare.com)
You will find in the /sources/Subs-Highlight.php file in line 72. (You will find in the file line 72)

This procedure does not make me happy when I noticed. (This procedure I Was not pleased when i Noticed it.)
So I copied all the css files stored in cloudflare.com to install on my site. (Then I copied all the css files are Stored in That cloudflare.com for install on my site.)
You just have to change the line 72 so that it loads the CSS from your site. (Just 72 Simply change line so it loads the CSS from your site.)

Original:
Code: [Select]
<Link rel = "stylesheet" type = "text / css" href = "http://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/ '. $ ModSettings [' ch_style '].' .min.css "/>

Modified (CSS stored in the / Themes / css / highlight /)
Code: [Select]
<Link rel = "stylesheet" type = "text / css" href = "'. $ Settings [' default_theme_url '].' / Css / highlight / '. $ ModSettings [' ch_style '].' .min.css" / >

If you want all the CSS files, you can download them here: (If you want all the CSS files, you can download 'em here :)
http://ovh.to/ZkmqXC (this directory is protected with a index.php)

Install the directory / highlight / in / Themes / default / css /

Enjoy! ;)

Miker1029

Quote from: alexetgus on August 05, 2015, 06:58:38 PM
Salut,

Sorry, i'm not speak english.
I speak french...

Les fichiers de style sont chargés à distance sur la plateforme web http://cdnjs.cloudflare.com  (The style files are loaded remotely on the web platform cloudflare.com)
Tu trouveras dans le fichier /sources/Subs-Highlight.php à la ligne 72. (You will find in the file line 72)

Cette procédure ne m'a pas fait plaisir quand je l'ai remarqué. (This procedure I was not pleased when I noticed it.)
J'ai donc copié tous les fichiers css stockés chez cloudflare.com pour les installer sur mon site. (I then copied all the css files that are stored in cloudflare.com for install on my site.)
Il suffit juste de modifier la ligne 72 pour qu'elle charge le css depuis ton site. (Simply just change line 72 so it loads the css from your site.)

Original :

<link rel="stylesheet" type="text/css" href="http://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/' . $modSettings['ch_style'] . '.min.css" />


Modified : (css stocké dans le dossier /Themes/css/highlight/)

<link rel="stylesheet" type="text/css" href="'. $settings['default_theme_url']. '/css/highlight/'. $modSettings['ch_style'] . '.min.css" />


Si tu veux tous les fichiers CSS, tu peux les télécharger ici : (If you want all the CSS files, you can download them here:)
http://ovh.to/ZkmqXC (this directory is protected with a index.php)

Install the directory /highlight/ in /Themes/default/css/

Enjoy ! ;)


EDIT
Translate French to English attempt... :-[

LOL, n'a pas vu ce que vous avez traduit que vous êtes allé Désolé.

Je essayé cela et cela n'a pas fonctionné, perdu toute évidence et il n'a même pas montrer de nouvelles Css en menu déroulant, je ai même essayé de coder en dur l'URL et il ne fonctionne toujours pas, a bien fonctionné quand je remets le lien original cloudflare ....

Des Idées ??

mike

LOL, Didn't see that you translated as you went Sorry.

I tried this and it didn't work, Lost all Highlighting and It didn't even show new .css in drop down,  I even tried HARD-CODING the URL and it still didn't work, Worked fine when I put it back to the original cloudflare link....

Any Ideas??

Mike

Miker1029

Quote from: Miker1029 on August 05, 2015, 11:00:26 AM
Just had a quick question, Is there a SIZE LIMIT, Character wise??   When I did the Install/Test I just so happened to have Subs.php in Notepad++ and cut and pasted it in and the bottom half was cut off and the {/code} was omitted due to the cut off which pretty much breaks the {code}/{/code} structure...

Other wise love the MOD!

Also I've Downloaded the highlight.js from the link provided on page 1, And I Found the Java File, But Can't find "/css/highlight/" Directory to add the styles that came with the Download from Highlight.js??

Should I just make it??   I see you have styles in yours and can't locate them anywhere...
Mike

BUMP?

alexetgus

#30
Salut !
On va retenter.

- Télécharge les fichiers CSS ici : http://ovh.to/ZkmqXC

- Extrait le contenu du fichier zip dans le répertoire : /Themes/default/css/
Tu obtiendras un répertoire : /Themes/default/css/highlight/

- Ouvre avec un éditeur de texte le fichier : /sources/Subs-Highlight.php

Recherche la ligne :
<link rel="stylesheet" type="text/css" href="http://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/' . $modSettings['ch_style'] . '.min.css" />

Et remplace la par :
<link rel="stylesheet" type="text/css" href="'. $settings['default_theme_url']. '/css/highlight/'. $modSettings['ch_style'] . '.min.css" />

- Enregistre.

- Vide le cache de ton navigateur.

Et voilà ! :)


! EDIT !
Ne touche pas le fichier /Themes/default/css/highlight.css !

Miker1029

Quote from: alexetgus on August 21, 2015, 03:34:51 PM
Salut !
On va retenter.

- Télécharge les fichiers CSS ici : http://ovh.to/ZkmqXC

- Extrait le contenu du fichier zip dans le répertoire : /Themes/default/css/
Tu obtiendras un répertoire : /Themes/default/css/highlight/

- Ouvre avec un éditeur de texte le fichier : /sources/Subs-Highlight.php

Recherche la ligne :
<link rel="stylesheet" type="text/css" href="http://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/' . $modSettings['ch_style'] . '.min.css" />

Et remplace la par :
<link rel="stylesheet" type="text/css" href="'. $settings['default_theme_url']. '/css/highlight/'. $modSettings['ch_style'] . '.min.css" />

- Enregistre.

- Vide le cache de ton navigateur.

Et voilà ! :)

Ya je l'ai fait, mais je suis allé sur le site qui contient le nouveau code de surligneur, et ils ont un .ZIP là qui a des couleurs de surbrillance Plus, qui pourrait être le problème, mais je ne faire tout cela, et comme je l'ai dit, il ne fonctionne pas avec le thème TOUT clou ...

Donc je suppose que je vais essayer à partir du lien de DL que vous avez fournis et de lui donner un coup de feu à nouveau, Parce que je ne l'aime vraiment 3ème intervention d'un tiers ...

Je vous le ferai savoir, et peut-être peux comprendre un moyen d'obtenir les nouveaux points forts dans ...

Merci!

Mike

Ya I Did that but, I went to the website that contained the new Highlighter code, and they have a .ZIP in there that has MORE Highlight colors, which could be the issue, But I did do all that, and as I said, It didn't work with ANY highlight theme ...

So I guess I'll try it from the DL link you provided and give it a shot again, Because I really don't like 3rd party intervention...

I'll let you know, and maybe can figure a way to get the new highlights in...

Thanks!

Mike

alexetgus

Le code que je te donne n'est pas pour le nouveau mod.

Donne moi des nouvelles. ;)

-----------

The code that I give you is not for the new mod on the website.

Give me the news. ;)

alexetgus

No news ? Bah...


Hi,

This mod load CSS and JS on all pages. It's bad for site performance.
JS and CSS should be loaded only on messages, not elsewhere.

To load CSS and JS only in the messages, open the file /Sources/Subs-Highlight.php

Search (line 71 to 81) :

$context['html_headers'] .= '
<link rel="stylesheet" type="text/css" href="http://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/' . $modSettings['ch_style'] . '.min.css" />
<link rel="stylesheet" type="text/css" href="' . $settings['default_theme_url'] . '/css/highlight.css" />';

if (isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'showoperations')
return;

if (!WIRELESS && !in_array($context['current_action'], array('helpadmin', 'printpage')))
$context['insert_after_template'] .= '
<script type="text/javascript" src="' . $settings['default_theme_url'] . '/scripts/highlight.pack.js"></script>
<script type="text/javascript">hljs.tabReplace = "' . $tab . '"; hljs.initHighlightingOnLoad();</script>';


Replace for :

$hl = preg_match('/topic|msg|action=recent|action=unreadreplies|action=admin/i', $_SERVER['REQUEST_URI']) ? TRUE : FALSE;
       
        if($hl) $context['html_headers'] .= '
    <link rel="stylesheet" type="text/css" href="http://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/' . $modSettings['ch_style'] . '.min.css" />
    <link rel="stylesheet" type="text/css" href="'. $settings['default_theme_url']. '/css/highlight/highlight.css" />';
   
        if (isset($_REQUEST['sa']) && $_REQUEST['sa'] == 'showoperations')
            return;
   
        if (!WIRELESS && !in_array($context['current_action'], array('helpadmin', 'printpage')))
            if($hl)
            {
                $context['insert_after_template'] .= '
        <script type="text/javascript" src="' . $settings['default_theme_url'] . '/scripts/highlight.pack.js"></script>
        <script type="text/javascript">hljs.tabReplace = "' . $tab . '"; hljs.initHighlightingOnLoad();</script>';
            }


From now on, the mod will not be charged on all pages. :)


PS :
If the CSS is hosted on your site as explained above.
REPLACE line :


<link rel="stylesheet" type="text/css" href="http://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.4/styles/' . $modSettings['ch_style'] . '.min.css" />


For :

<link rel="stylesheet" type="text/css" href="'. $settings['default_theme_url']. '/css/highlight/'. $modSettings['ch_style'] . '.min.css" />




Sorry for my english. I not speak english. I'm french... :-[

alexetgus

Recall.

Directory /highlight/ contened CSS files for local storage in your website.
https://copy.com/1roGnaxqHSaqE71p

Mod translated into French and French-utf8
https://copy.com/eeRnYYPOfwblSNtx

Enjoy ! :)

Bugo

Thanks for translation and your suggestions :)

alexetgus


T-Bone225

I am not sure if this was answered in here before, part of posts is in other languages, but I have a tiny problem
After I installed this addon if worked fine, but when I do commenting of the code with two backslashes it doesn't seem to work, as it greys out everything in the next lines past the comments too.


Is there a fix for this?

alexetgus

@T-Bone225
The responsible is the JavaScript...


Fix error in PHP 7.x => "Parameter 1 to ch_buffer() expected to be a reference, value given"


Open file /Sources/Subs-Highlight.php in your text editor.

Search : (line 109 in version 1.1)
function ch_buffer(&$buffer)


Replace with :
function ch_buffer($buffer)

Enjoy! :)

T-Bone225

Quote from: alexetgus on May 23, 2017, 07:05:52 AM
@T-Bone225
The responsible is the JavaScript...


Fix error in PHP 7.x => "Parameter 1 to ch_buffer() expected to be a reference, value given"


Open file /Sources/Subs-Highlight.php in your text editor.

Search : (line 109 in version 1.1)
function ch_buffer(&$buffer)


Replace with :
function ch_buffer($buffer)

Enjoy! :)


I tried just that, didn't seem to resolve the issue. Nothing changed.
But thanks for attempt to help :)

Advertisement: