Please Identify the type of code............Pleaase

Status
Not open for further replies.
Joined
May 1, 2010
Messages
119
Helped
5
Reputation
10
Reaction score
5
Trophy points
1,308
Location
India, Kerala, Moolamattom
Visit site
Activity points
0
Hi All

Please Identify which type of Code is this....Machine language or Asembly language or Somthing else?


This is the code

Code:
; Source created with Parsic Version 3.x

; at              : 25.05.2008 01:00:29


; Project File    : D:\PARSÝC\trafo spir sayýcý\spirsay.PIC

; Project Version : 1.0.17

; Created         : 20.05.2008 23:37:00

; Last change     : 25.05.2008 01:00:27

	PROCESSOR 16F628

	INCLUDE P16F628.INC

	RADIX DEC


	__IDLOCS H'0100'

	__CONFIG _CP_OFF & _PWRTE_OFF & _WDT_OFF & _BODEN_OFF & _XT_OSC & _LVP_OFF & _MCLRE_ON

; Diverses

ZERO	EQU Z	; ZERO-Flag
CARRY	 EQU C	; CARRY-Flag


; Variable

ZV1	= 32	; located in Bank 0
ZV1_HI	= 33	; located in Bank 0
ZV1_FD	= 34	; located in Bank 0
MF1	= 35	; located in Bank 0
MF1_HI	= 36	; located in Bank 0
MF1_FD	= 37	; located in Bank 0
S2	= 38	; located in Bank 0
S0	= 39	; located in Bank 0
MF2	= 40	; located in Bank 0
MF2_HI	= 41	; located in Bank 0
TR1	= 42	; located in Bank 0
TR1_HI	= 43	; located in Bank 0
MF3	= 44	; located in Bank 0
MF3_HI	= 45	; located in Bank 0
MF3_FD	= 46	; located in Bank 0
ZV2	= 47	; located in Bank 0
ZV2_HI	= 48	; located in Bank 0
ZV2_FD	= 49	; located in Bank 0
S1	= 50	; located in Bank 0
OS1_FD	= 51	; located in Bank 0
MF4	= 52	; located in Bank 0
MF4_HI	= 53	; located in Bank 0
MF4_FD	= 54	; located in Bank 0
MF5	= 55	; located in Bank 0
MF5_HI	= 56	; located in Bank 0
MF5_FD	= 57	; located in Bank 0
MF6	= 58	; located in Bank 0
MF6_HI	= 59	; located in Bank 0
MF6_FD	= 60	; located in Bank 0
LT1_FD	= 61	; located in Bank 0
LT2_FD	= 62	; located in Bank 0
TR2	= 63	; located in Bank 0
TR2_HI	= 64	; located in Bank 0
LT3_FD	= 65	; located in Bank 0
LT4_FD	= 66	; located in Bank 0
SR1	= 67	; located in Bank 0
SR1_FD	= 68	; located in Bank 0
MF7	= 69	; located in Bank 0
MF7_HI	= 70	; located in Bank 0
MF7_FD	= 71	; located in Bank 0
TR3	= 72	; located in Bank 0
TR3_HI	= 73	; located in Bank 0
LT5_FD	= 74	; located in Bank 0
LT6_FD	= 75	; located in Bank 0
RAM	= 76	; located in Bank 0
SYS_WSAV	= 112	; located in Bank 0, 1, 2, 3
SYS_SSAV	= 113	; located in Bank 0, 1, 2, 3
SYS_TMP1	= 114	; located in Bank 0, 1, 2, 3
SYS_TMP2	= 115	; located in Bank 0, 1, 2, 3
SYS_TMP3	= 116	; located in Bank 0, 1, 2, 3
SYS_TMP4	= 117	; located in Bank 0, 1, 2, 3
SYS_TMP5	= 118	; located in Bank 0, 1, 2, 3
SYS_TMP6	= 119	; located in Bank 0, 1, 2, 3
SYS_TMP9	= 120	; located in Bank 0, 1, 2, 3
SYS_TMP10	= 121	; located in Bank 0, 1, 2, 3

	ERRORLEVEL -302	; disable warning (Bankswitching)
	ERRORLEVEL -306	; disable warning (Pageswitching)
 

It is part of an assembly language program written for the Microchip PIC16F628 processor and coded to work with their MPLAB assembler program.

It is not complete and even the small section you show has some strange code in it.

Brian.
 

It is part of an assembly language program written for the Microchip PIC16F628 processor and coded to work with their MPLAB assembler program.

It is not complete and even the small section you show has some strange code in it.

Brian.

Thank Brian for the valuable help.

I get the circuit from an Egyption site.....

This is the full code

Code:
; Source created with Parsic Version 3.x

; at              : 25.05.2008 01:00:29


; Project File    : D:\PARSÝC\trafo spir sayýcý\spirsay.PIC

; Project Version : 1.0.17

; Created         : 20.05.2008 23:37:00

; Last change     : 25.05.2008 01:00:27

	PROCESSOR 16F628

	INCLUDE P16F628.INC

	RADIX DEC


	__IDLOCS H'0100'

	__CONFIG _CP_OFF & _PWRTE_OFF & _WDT_OFF & _BODEN_OFF & _XT_OSC & _LVP_OFF & _MCLRE_ON

; Diverses

ZERO	EQU Z	; ZERO-Flag
CARRY	 EQU C	; CARRY-Flag


; Variable

ZV1	= 32	; located in Bank 0
ZV1_HI	= 33	; located in Bank 0
ZV1_FD	= 34	; located in Bank 0
MF1	= 35	; located in Bank 0
MF1_HI	= 36	; located in Bank 0
MF1_FD	= 37	; located in Bank 0
S2	= 38	; located in Bank 0
S0	= 39	; located in Bank 0
MF2	= 40	; located in Bank 0
MF2_HI	= 41	; located in Bank 0
TR1	= 42	; located in Bank 0
TR1_HI	= 43	; located in Bank 0
MF3	= 44	; located in Bank 0
MF3_HI	= 45	; located in Bank 0
MF3_FD	= 46	; located in Bank 0
ZV2	= 47	; located in Bank 0
ZV2_HI	= 48	; located in Bank 0
ZV2_FD	= 49	; located in Bank 0
S1	= 50	; located in Bank 0
OS1_FD	= 51	; located in Bank 0
MF4	= 52	; located in Bank 0
MF4_HI	= 53	; located in Bank 0
MF4_FD	= 54	; located in Bank 0
MF5	= 55	; located in Bank 0
MF5_HI	= 56	; located in Bank 0
MF5_FD	= 57	; located in Bank 0
MF6	= 58	; located in Bank 0
MF6_HI	= 59	; located in Bank 0
MF6_FD	= 60	; located in Bank 0
LT1_FD	= 61	; located in Bank 0
LT2_FD	= 62	; located in Bank 0
TR2	= 63	; located in Bank 0
TR2_HI	= 64	; located in Bank 0
LT3_FD	= 65	; located in Bank 0
LT4_FD	= 66	; located in Bank 0
SR1	= 67	; located in Bank 0
SR1_FD	= 68	; located in Bank 0
MF7	= 69	; located in Bank 0
MF7_HI	= 70	; located in Bank 0
MF7_FD	= 71	; located in Bank 0
TR3	= 72	; located in Bank 0
TR3_HI	= 73	; located in Bank 0
LT5_FD	= 74	; located in Bank 0
LT6_FD	= 75	; located in Bank 0
RAM	= 76	; located in Bank 0
SYS_WSAV	= 112	; located in Bank 0, 1, 2, 3
SYS_SSAV	= 113	; located in Bank 0, 1, 2, 3
SYS_TMP1	= 114	; located in Bank 0, 1, 2, 3
SYS_TMP2	= 115	; located in Bank 0, 1, 2, 3
SYS_TMP3	= 116	; located in Bank 0, 1, 2, 3
SYS_TMP4	= 117	; located in Bank 0, 1, 2, 3
SYS_TMP5	= 118	; located in Bank 0, 1, 2, 3
SYS_TMP6	= 119	; located in Bank 0, 1, 2, 3
SYS_TMP9	= 120	; located in Bank 0, 1, 2, 3
SYS_TMP10	= 121	; located in Bank 0, 1, 2, 3

	ERRORLEVEL -302	; disable warning (Bankswitching)
	ERRORLEVEL -306	; disable warning (Pageswitching)

;****************************************
;Programmanfang
;****************************************

	ORG 0

	CLRF STATUS	; switch to RAM-Bank 0
	GOTO SYS_INIT
	NOP
	NOP

;****************************************
;Interrupt-Adress
;****************************************

	MOVWF SYS_WSAV	; save register
	SWAPF STATUS,W
	CLRF STATUS	; bank 0
	MOVWF SYS_SSAV

	BCF INTCON,T0IF	; Interrupt quitieren

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	INCFSZ MF1,F
	GOTO SYS_INT_LABEL_0
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	INCF MF1_HI,F

SYS_INT_LABEL_0
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	INCFSZ MF2,F
	GOTO SYS_INT_LABEL_1
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	INCF MF2_HI,F

SYS_INT_LABEL_1
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	INCFSZ TR1,F
	GOTO SYS_INT_LABEL_2
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	INCF TR1_HI,F

SYS_INT_LABEL_2
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	INCFSZ MF3,F
	GOTO SYS_INT_LABEL_3
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	INCF MF3_HI,F

SYS_INT_LABEL_3
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	INCFSZ MF4,F
	GOTO SYS_INT_LABEL_4
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	INCF MF4_HI,F

SYS_INT_LABEL_4
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	INCFSZ MF5,F
	GOTO SYS_INT_LABEL_5
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	INCF MF5_HI,F

SYS_INT_LABEL_5
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	INCFSZ MF6,F
	GOTO SYS_INT_LABEL_6
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	INCF MF6_HI,F

SYS_INT_LABEL_6
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	INCFSZ TR2,F
	GOTO SYS_INT_LABEL_7
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	INCF TR2_HI,F

SYS_INT_LABEL_7
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	INCFSZ MF7,F
	GOTO SYS_INT_LABEL_8
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	INCF MF7_HI,F

SYS_INT_LABEL_8
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	INCFSZ TR3,F
	GOTO SYS_INT_LABEL_9
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	INCF TR3_HI,F

SYS_INT_LABEL_9

EXITINT

	SWAPF SYS_SSAV,W	; Register zurück
	MOVWF STATUS
	SWAPF SYS_WSAV,F
	SWAPF SYS_WSAV,W

	RETFIE	; RETurn From Interrupt and Enable GIE


;****************************************
; Subroutines
;****************************************

;***************************************************
; Subroutines for LB1
;***************************************************

LCD_LB1_INIT
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BCF PORTB,4	; ir-register
LCD_LB1_L1
	CALL LCD_LB1_OUT4
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	DECFSZ SYS_TMP1,F
	GOTO LCD_LB1_L1

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVFW PORTB
	ANDLW H'F0'
	IORLW B'0011'	; Function Set
	MOVWF PORTB

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF PORTB,5	; write
	BCF PORTB,5

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF SYS_TMP1,5	; wait
LCD_LB1_L2
	CALL LCD_LB1_OUT4
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	DECFSZ SYS_TMP1,F
	GOTO LCD_LB1_L2

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF PORTB,5	; write
	BCF PORTB,5

	CALL LCD_LB1_OUT4

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF PORTB,5	; write
	BCF PORTB,5

	CALL LCD_LB1_OUT4

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BCF PORTB,0	; 4-Bit Interface

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF PORTB,5	; write
	BCF PORTB,5

	CALL LCD_LB1_OUT4

	MOVLW B'00101000'	; Function Set 4-Bit,2-Lines
	CALL LCD_LB1_OUT

	MOVLW B'00001100'	; Display on, Cursor off, Blink off
	CALL LCD_LB1_OUT

	MOVLW B'00000110'	; Entrymode set
	CALL LCD_LB1_OUT

LCD_LB1_CLR
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BCF PORTB,4	; ir-register
	MOVLW B'00000001'	; Display clear
	CALL LCD_LB1_OUT

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF SYS_TMP1,5	; wait
LCD_LB1_L3
	CALL LCD_LB1_OUT4
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	DECFSZ SYS_TMP1,F
	GOTO LCD_LB1_L3
	GOTO LCD_LB1_OUT4

;***************************************************

LCD_LB1_GOTOXY
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BCF PORTB,4	; ir-register
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVLW H'40'
	BTFSC SYS_TMP2,0	; Ypos
	ADDWF SYS_TMP1,F
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF SYS_TMP1,7	; select dd-ram
	GOTO LCD_LB1_OUT1

;***************************************************

LCD_LB1_WRITESTR
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF PORTB,4	; dd-ram
LCD_LB1_WRITESTR1
	CALL LCD_LB1_CHAROUT
	BSF INTCON,GIE
	ANDLW H'FF'	; last is zero
	BTFSC STATUS,ZERO
	RETURN

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVWF SYS_TMP1
	CALL LCD_LB1_OUT1
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	INCFSZ SYS_TMP4,F	; next char
	GOTO LCD_LB1_WRITESTR1
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	INCF SYS_TMP5,F	; next page
	GOTO LCD_LB1_WRITESTR1

LCD_LB1_CHAROUT
	BCF INTCON,GIE
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVFW SYS_TMP5
	MOVWF PCLATH
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVFW SYS_TMP4
	MOVWF PCL

;***************************************************

LCD_LB1_DEZO10000

	MOVLW LOW 10000
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVWF SYS_TMP1
	MOVLW HIGH 10000
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVWF SYS_TMP2

	CALL LCD_LB1_CONVERTDEZ
	MOVF SYS_TMP9,F
	BTFSS STATUS,ZERO
	GOTO LCD_LB1_DEZO1000
	CALL LCD_LB1_CHECKNULL

LCD_LB1_DEZO1000

	MOVLW LOW 1000
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVWF SYS_TMP1
	MOVLW HIGH 1000
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVWF SYS_TMP2

	CALL LCD_LB1_CONVERTDEZ
	MOVF SYS_TMP9,F
	BTFSS STATUS,ZERO
	GOTO LCD_LB1_DEZO100
	CALL LCD_LB1_CHECKNULL

LCD_LB1_DEZO100

	MOVLW LOW 100
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVWF SYS_TMP1
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	CLRF SYS_TMP2

	CALL LCD_LB1_CONVERTDEZ
	MOVF SYS_TMP9,F
	BTFSS STATUS,ZERO
	GOTO LCD_LB1_DEZO10
	CALL LCD_LB1_CHECKNULL

LCD_LB1_DEZO10

	MOVLW LOW 10
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVWF SYS_TMP1
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	CLRF SYS_TMP2

	CALL LCD_LB1_CONVERTDEZ
	MOVF SYS_TMP9,F
	BTFSS STATUS,ZERO
	GOTO LCD_LB1_DEZO1
	CALL LCD_LB1_CHECKNULL

LCD_LB1_DEZO1
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVLW 48
	ADDWF SYS_TMP4,W
	GOTO LCD_LB1_WRITECHAR

;***************************************************

LCD_LB1_CONVERTDEZ
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVF SYS_TMP9,F
	BTFSS STATUS,ZERO
	DECF SYS_TMP9,F
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	CLRF SYS_TMP6
LCD_LB1_CONVERTDEZ2
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	INCF SYS_TMP6,F

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVFW SYS_TMP1
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	SUBWF SYS_TMP4,F

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVFW SYS_TMP2
	BTFSS STATUS,CARRY
	INCFSZ SYS_TMP2,W
	SUBWF SYS_TMP5,F
	BTFSC STATUS,CARRY
	GOTO LCD_LB1_CONVERTDEZ2

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVFW SYS_TMP2
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	ADDWF SYS_TMP5,F
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVFW SYS_TMP1
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	ADDWF SYS_TMP4,F
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSC STATUS,CARRY
	INCF SYS_TMP5,F

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	DECF SYS_TMP6,W
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS STATUS,ZERO
	BSF SYS_TMP10,0
	RETURN

;***************************************************

LCD_LB1_CONVERTHEX
	ANDLW 15
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVWF SYS_TMP1
	MOVLW 48
	ADDWF SYS_TMP1,F
	MOVLW 58
	SUBWF SYS_TMP1,W
	BTFSS STATUS,CARRY
	GOTO $+3
	MOVLW 7
	ADDWF SYS_TMP1,F
	MOVFW SYS_TMP1

;***************************************************

LCD_LB1_WRITECHAR
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF PORTB,4	; dd-ram

;***************************************************

LCD_LB1_OUT
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVWF SYS_TMP1	; store
LCD_LB1_OUT1
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	CLRF SYS_TMP3	; LCDWriteStr (first nibble)
LCD_LB1_OUT2
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	SWAPF SYS_TMP1,W	;high nibble
LCD_LB1_OUT3
	ANDLW H'0F'	; mask
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVWF SYS_TMP2	; store
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVFW PORTB	; load port
	ANDLW H'F0'	; mask
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	IORWF SYS_TMP2,W	; add cmd
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVWF PORTB	; out

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF PORTB,5	; E high
	BCF PORTB,5	; E low

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSC SYS_TMP3,3	; ready ?
	GOTO LCD_LB1_OUT4	; yes
	BSF SYS_TMP3,3	; second nibble
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVFW SYS_TMP1
	GOTO LCD_LB1_OUT3	; next nibble

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
LCD_LB1_OUT4
LCD_LB1_OUTV
	DECFSZ SYS_TMP3,F
	GOTO LCD_LB1_OUTV
	RETURN

;***************************************************

LCD_LB1_CHECKNULL
	BTFSS STATUS,ZERO
	DECF SYS_TMP9,F
	MOVWF SYS_TMP1
	BTFSS STATUS,ZERO
	BSF SYS_TMP10,0
	MOVLW 48
	BTFSC SYS_TMP10,0
	ADDWF SYS_TMP1,f
	MOVLW 32
	BTFSS SYS_TMP10,0
	ADDWF SYS_TMP1,F
	MOVFW SYS_TMP1
	GOTO LCD_LB1_WRITECHAR
; 016B

;****************************************
;Initialisierung
;****************************************


SYS_INIT

	MOVLW B'00100000'
	MOVWF INTCON

; Ausgangs-Pegel setzen, bevor die Richtung gesetzt wird

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVLW B'00000000'
	MOVWF PORTA

	MOVLW B'00000000'
	MOVWF PORTB

	MOVLW 143
	BSF STATUS,RP0	; Bank 1
	BCF STATUS,RP1	; Bank 1
	MOVWF OPTION_REG


; Richtung setzen

	MOVLW B'11111111'
	MOVWF TRISA

	MOVLW B'01000000'
	MOVWF TRISB

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVLW 7	; Comparators off
	MOVWF CMCON
; init vars


; Clear RAM

	BCF STATUS,IRP
	MOVLW 32
	MOVWF FSR
CR1
	CLRF INDF
	INCF FSR,F
	BTFSS FSR,7
	GOTO CR1
	BSF FSR,5
CR2
	CLRF INDF
	INCF FSR,F
	MOVLW H'F0'
	SUBWF FSR,W
	BTFSS STATUS,ZERO
	GOTO CR2
	BSF STATUS,IRP
	MOVLW 32
	MOVWF FSR
CR3
	CLRF INDF
	INCF FSR,F
	MOVLW H'50'
	SUBWF FSR,W
	BTFSS STATUS,ZERO
	GOTO CR3


;***************************************************
; Init LCD -> LB1
;***************************************************

	CALL LCD_LB1_INIT

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	CLRF TMR0
	BCF INTCON,T0IF
	BSF INTCON,GIE	; Interrupt freigeben

;**********************************
;******* Haupt-Programm ***********
;**********************************

MAIN

;***************************************************
; Zähler -> ZV1
;***************************************************

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS S0,7	; Reset ?
	GOTO LABEL_ZV1_COUNT
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	CLRF ZV1
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	CLRF ZV1_HI
	GOTO LABEL_ZV1_SETOUT

LABEL_ZV1_COUNT

; Test auf positive Flanke

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS S0,3
	GOTO LABEL_ZV1_SETFD
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSC ZV1_FD,0
	GOTO LABEL_ZV1_SETFD

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF ZV1_FD,0


	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSC S0,4	; Vorwärts oder Rückwärts ?
	GOTO LABEL_ZV1_BACKWARD

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	INCFSZ ZV1,F
	GOTO LABEL_ZV1_SETOUT
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	INCF ZV1_HI,F
	GOTO LABEL_ZV1_SETOUT

LABEL_ZV1_BACKWARD
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	DECF ZV1,F
	INCFSZ ZV1,W
	GOTO LABEL_ZV1_SETOUT
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	DECF ZV1_HI,F

LABEL_ZV1_SETOUT


LABEL_ZV1_SETFD

; Test auf negative Flanke

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSC S0,3
	GOTO LABEL_ZV1_EXIT
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BCF ZV1_FD,0

LABEL_ZV1_EXIT

;***************************************************
; Mono-Flop -> MF1
;***************************************************

; Läuft der Impuls ?

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSC MF1_FD,1
	GOTO LABEL_MF1_CHKTIME

; Test auf positive Flanke

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSC MF1_FD,0
	GOTO LABEL_MF1_SETFD
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS PORTA,3
	GOTO LABEL_MF1_SETFD


LABEL_MF1_RESET

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	CLRF MF1
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	CLRF MF1_HI
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF MF1_FD,1
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF S2,3

LABEL_MF1_CHKTIME

	MOVLW 0
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	SUBWF MF1_HI,W
	BTFSS STATUS,ZERO
	GOTO LABEL_MF1_CHECK
	MOVLW 78
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	SUBWF MF1,W
LABEL_MF1_CHECK
	BTFSS STATUS,CARRY
	GOTO LABEL_MF1_SETFD
LABEL_MF1_TO

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BCF MF1_FD,1
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BCF S2,3

LABEL_MF1_SETFD

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS PORTA,3
	GOTO LABEL_MF1_CLR
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF MF1_FD,0
	GOTO LABEL_MF1_ENDE
LABEL_MF1_CLR
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BCF MF1_FD,0

LABEL_MF1_ENDE

;***************************************************
; ODER - Gatter -> LG1
;***************************************************

LABEL_LG1_1
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSC S2,3
	GOTO LABEL_LG1_TRUE
LABEL_LG1_2
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSC S0,2
	GOTO LABEL_LG1_TRUE
LABEL_LG1_3
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSC S0,4
	GOTO LABEL_LG1_TRUE
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0

LABEL_LG1_FALSE
	BCF S0,3
	GOTO LABEL_LG1_ENDE
LABEL_LG1_TRUE
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF S0,3
LABEL_LG1_ENDE
;***************************************************
; Anzug-Verzögerung -> MF2
;***************************************************

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSC PORTA,3	; Eingang auf High ?
	GOTO LABEL_MF2_CHKTIME	; Ja

; RESET

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	CLRF MF2
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	CLRF MF2_HI
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BCF S0,0
	GOTO LABEL_MF2_EXIT	; raus

LABEL_MF2_CHKTIME

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSC S0,0	; Ausgang schon auf High ?
	GOTO LABEL_MF2_EXIT	; Ja

	MOVLW 30
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	SUBWF MF2_HI,W
	BTFSS STATUS,CARRY
	GOTO LABEL_MF2_EXIT

	MOVLW 132
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	SUBWF MF2,W
	BTFSS STATUS,CARRY
	GOTO LABEL_MF2_EXIT

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF S0,0
LABEL_MF2_EXIT

;***************************************************
; UND - Gatter -> LG2
;***************************************************

LABEL_LG2_1
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS S0,0
	GOTO LABEL_LG2_FALSE
LABEL_LG2_2
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS S0,1
	GOTO LABEL_LG2_FALSE

LABEL_LG2_TRUE
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF S0,2
	GOTO LABEL_LG2_ENDE
LABEL_LG2_FALSE
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BCF S0,2
LABEL_LG2_ENDE
;***************************************************
; Timer -> TR1
;***************************************************

	MOVLW 0	; Test auf >=
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	SUBWF TR1_HI,W	;F-W -> W
	BTFSS STATUS,ZERO
	GOTO LABEL_TR1_CHECK
	MOVLW 20
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	SUBWF TR1,W	;F-W -> W
LABEL_TR1_CHECK
	BTFSS STATUS,CARRY
	GOTO LABEL_TR1_ENDE

LABEL_TR1_RESET
	MOVLW 0	; Test auf >=
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	SUBWF TR1_HI,F	;F-W -> F
	MOVLW 20
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	SUBWF TR1,F	;F-W -> F
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS STATUS,CARRY
	DECF TR1_HI,F

LABEL_TR1_SET	; toggel output
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSC S0,1
	GOTO LABEL_TR1_CLR
	BSF S0,1
	GOTO LABEL_TR1_ENDE
LABEL_TR1_CLR
	BCF S0,1
LABEL_TR1_ENDE

;***************************************************
; Mono-Flop -> MF3
;***************************************************

; Läuft der Impuls ?

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSC MF3_FD,1
	GOTO LABEL_MF3_CHKTIME

; Test auf positive Flanke

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSC MF3_FD,0
	GOTO LABEL_MF3_SETFD
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS PORTA,2
	GOTO LABEL_MF3_SETFD


LABEL_MF3_RESET

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	CLRF MF3
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	CLRF MF3_HI
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF MF3_FD,1
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF S2,4

LABEL_MF3_CHKTIME

	MOVLW 1
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	SUBWF MF3_HI,W
	BTFSS STATUS,ZERO
	GOTO LABEL_MF3_CHECK
	MOVLW 135
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	SUBWF MF3,W
LABEL_MF3_CHECK
	BTFSS STATUS,CARRY
	GOTO LABEL_MF3_SETFD
LABEL_MF3_TO

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BCF MF3_FD,1
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BCF S2,4

LABEL_MF3_SETFD

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS PORTA,2
	GOTO LABEL_MF3_CLR
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF MF3_FD,0
	GOTO LABEL_MF3_ENDE
LABEL_MF3_CLR
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BCF MF3_FD,0

LABEL_MF3_ENDE

;***************************************************
; Zähler -> ZV2
;***************************************************

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS S0,7	; Reset ?
	GOTO LABEL_ZV2_COUNT
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	CLRF ZV2
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	CLRF ZV2_HI
	GOTO LABEL_ZV2_SETOUT

LABEL_ZV2_COUNT

; Test auf positive Flanke

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS S1,4
	GOTO LABEL_ZV2_SETFD
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSC ZV2_FD,0
	GOTO LABEL_ZV2_SETFD

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF ZV2_FD,0


	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSC S1,6	; Vorwärts oder Rückwärts ?
	GOTO LABEL_ZV2_BACKWARD

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	INCFSZ ZV2,F
	GOTO LABEL_ZV2_SETOUT
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	INCF ZV2_HI,F
	GOTO LABEL_ZV2_SETOUT

LABEL_ZV2_BACKWARD
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	DECF ZV2,F
	INCFSZ ZV2,W
	GOTO LABEL_ZV2_SETOUT
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	DECF ZV2_HI,F

LABEL_ZV2_SETOUT


LABEL_ZV2_SETFD

; Test auf negative Flanke

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSC S1,4
	GOTO LABEL_ZV2_EXIT
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BCF ZV2_FD,0

LABEL_ZV2_EXIT

;***************************************************
; One Shot -> OS1
;***************************************************


	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS PORTA,4
	GOTO LABEL_OS1_1
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSC OS1_FD,0
	GOTO LABEL_OS1_1
	BSF OS1_FD,0
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF S1,5
	GOTO LABEL_OS1_2
LABEL_OS1_1
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BCF S1,5
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSC PORTA,4
	GOTO LABEL_OS1_2
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BCF OS1_FD,0
LABEL_OS1_2
;***************************************************
; Vergleich -> IF1
;***************************************************

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVFW ZV2_HI
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	SUBWF ZV1_HI,W	; F - W -> W

	BTFSS STATUS,ZERO	; Wenn ZERO gesetzt LOW-Byte testen
	GOTO LABEL_IF1_CHECK
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVFW ZV2
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	SUBWF ZV1,W	; F - W -> W

LABEL_IF1_CHECK
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS STATUS,ZERO	; Test auf -> =
	GOTO LABEL_IF1_FALSE

LABEL_IF1_TRUE
	BSF S0,5
	GOTO LABEL_IF1_EXIT

LABEL_IF1_FALSE
	BCF S0,5

LABEL_IF1_EXIT
;***************************************************
; RS-FLIP-FLOP -> RS1
;***************************************************

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSC S1,0
	GOTO LABEL_RS1_RESET
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS S0,6
	GOTO LABEL_RS1_ENDE
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF S1,2	; Ausgang setzen
	GOTO LABEL_RS1_ENDE
LABEL_RS1_RESET
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BCF S1,2	; Ausgang zurücksetzen
LABEL_RS1_ENDE

;***************************************************
; Mono-Flop -> MF4
;***************************************************

; Läuft der Impuls ?

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSC MF4_FD,1
	GOTO LABEL_MF4_CHKTIME

; Test auf positive Flanke

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSC MF4_FD,0
	GOTO LABEL_MF4_SETFD
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS PORTA,0
	GOTO LABEL_MF4_SETFD


LABEL_MF4_RESET

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	CLRF MF4
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	CLRF MF4_HI
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF MF4_FD,1
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF S0,7

LABEL_MF4_CHKTIME

	MOVLW 0
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	SUBWF MF4_HI,W
	BTFSS STATUS,ZERO
	GOTO LABEL_MF4_CHECK
	MOVLW 78
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	SUBWF MF4,W
LABEL_MF4_CHECK
	BTFSS STATUS,CARRY
	GOTO LABEL_MF4_SETFD
LABEL_MF4_TO

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BCF MF4_FD,1
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BCF S0,7

LABEL_MF4_SETFD

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS PORTA,0
	GOTO LABEL_MF4_CLR
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF MF4_FD,0
	GOTO LABEL_MF4_ENDE
LABEL_MF4_CLR
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BCF MF4_FD,0

LABEL_MF4_ENDE

;***************************************************
; Mono-Flop -> MF5
;***************************************************

; Läuft der Impuls ?

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSC MF5_FD,1
	GOTO LABEL_MF5_CHKTIME

; Test auf positive Flanke

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSC MF5_FD,0
	GOTO LABEL_MF5_SETFD
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS PORTA,1
	GOTO LABEL_MF5_SETFD


LABEL_MF5_RESET

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	CLRF MF5
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	CLRF MF5_HI
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF MF5_FD,1
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF S0,6

LABEL_MF5_CHKTIME

	MOVLW 0
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	SUBWF MF5_HI,W
	BTFSS STATUS,ZERO
	GOTO LABEL_MF5_CHECK
	MOVLW 78
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	SUBWF MF5,W
LABEL_MF5_CHECK
	BTFSS STATUS,CARRY
	GOTO LABEL_MF5_SETFD
LABEL_MF5_TO

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BCF MF5_FD,1
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BCF S0,6

LABEL_MF5_SETFD

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS PORTA,1
	GOTO LABEL_MF5_CLR
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF MF5_FD,0
	GOTO LABEL_MF5_ENDE
LABEL_MF5_CLR
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BCF MF5_FD,0

LABEL_MF5_ENDE

;***************************************************
; ODER - Gatter -> LG3
;***************************************************

LABEL_LG3_1
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSC S1,1
	GOTO LABEL_LG3_TRUE
LABEL_LG3_2
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSC S0,7
	GOTO LABEL_LG3_TRUE
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0

LABEL_LG3_FALSE
	BCF S1,0
	GOTO LABEL_LG3_ENDE
LABEL_LG3_TRUE
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF S1,0
LABEL_LG3_ENDE
;***************************************************
; Mono-Flop -> MF6
;***************************************************

; Läuft der Impuls ?

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSC MF6_FD,1
	GOTO LABEL_MF6_CHKTIME

; Test auf positive Flanke

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSC MF6_FD,0
	GOTO LABEL_MF6_SETFD
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS S0,5
	GOTO LABEL_MF6_SETFD


LABEL_MF6_RESET

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	CLRF MF6
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	CLRF MF6_HI
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF MF6_FD,1
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF S1,1

LABEL_MF6_CHKTIME

	MOVLW 0
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	SUBWF MF6_HI,W
	BTFSS STATUS,ZERO
	GOTO LABEL_MF6_CHECK
	MOVLW 78
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	SUBWF MF6,W
LABEL_MF6_CHECK
	BTFSS STATUS,CARRY
	GOTO LABEL_MF6_SETFD
LABEL_MF6_TO

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BCF MF6_FD,1
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BCF S1,1

LABEL_MF6_SETFD

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS S0,5
	GOTO LABEL_MF6_CLR
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF MF6_FD,0
	GOTO LABEL_MF6_ENDE
LABEL_MF6_CLR
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BCF MF6_FD,0

LABEL_MF6_ENDE

;***************************************************
; LCD -> LT1
;***************************************************

; test of positiv edge

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSC LT1_FD,0
	GOTO LABEL_LT1_SETFD
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS S1,3
	GOTO LABEL_LT1_SETFD


	MOVLW 0
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVWF SYS_TMP1
	MOVLW 0
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVWF SYS_TMP2

	CALL LCD_LB1_GOTOXY

	MOVLW LOW TAB_LT1
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVWF SYS_TMP4
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVLW HIGH TAB_LT1
	MOVWF SYS_TMP5


	CALL LCD_LB1_WRITESTR

LABEL_LT1_SETFD

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS S1,3
	GOTO LABEL_LT1_SETFD2
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF LT1_FD,0
	GOTO LABEL_LT1_END
LABEL_LT1_SETFD2
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BCF LT1_FD,0
LABEL_LT1_END

;***************************************************
; LCD -> LT2
;***************************************************

; test of positiv edge

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSC LT2_FD,0
	GOTO LABEL_LT2_SETFD
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS S1,3
	GOTO LABEL_LT2_SETFD


	MOVLW 0
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVWF SYS_TMP1
	MOVLW 1
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVWF SYS_TMP2

	CALL LCD_LB1_GOTOXY

	MOVLW LOW TAB_LT2
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVWF SYS_TMP4
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVLW HIGH TAB_LT2
	MOVWF SYS_TMP5


	CALL LCD_LB1_WRITESTR

LABEL_LT2_SETFD

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS S1,3
	GOTO LABEL_LT2_SETFD2
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF LT2_FD,0
	GOTO LABEL_LT2_END
LABEL_LT2_SETFD2
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BCF LT2_FD,0
LABEL_LT2_END

;***************************************************
; Timer -> TR2
;***************************************************

	MOVLW 0	; Test auf >=
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	SUBWF TR2_HI,W	;F-W -> W
	BTFSS STATUS,ZERO
	GOTO LABEL_TR2_CHECK
	MOVLW 39
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	SUBWF TR2,W	;F-W -> W
LABEL_TR2_CHECK
	BTFSS STATUS,CARRY
	GOTO LABEL_TR2_ENDE

LABEL_TR2_RESET
	MOVLW 0	; Test auf >=
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	SUBWF TR2_HI,F	;F-W -> F
	MOVLW 39
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	SUBWF TR2,F	;F-W -> F
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS STATUS,CARRY
	DECF TR2_HI,F

LABEL_TR2_SET	; toggel output
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSC S1,3
	GOTO LABEL_TR2_CLR
	BSF S1,3
	GOTO LABEL_TR2_ENDE
LABEL_TR2_CLR
	BCF S1,3
LABEL_TR2_ENDE

;***************************************************
; LCD -> LT3
;***************************************************

; test of positiv edge

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSC LT3_FD,0
	GOTO LABEL_LT3_SETFD
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS S1,3
	GOTO LABEL_LT3_SETFD


	MOVLW 7
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVWF SYS_TMP1
	MOVLW 0
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVWF SYS_TMP2

	CALL LCD_LB1_GOTOXY

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVFW ZV1
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVWF SYS_TMP4
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVFW ZV1_HI
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVWF SYS_TMP5

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF SYS_TMP10,0
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVLW 2
	MOVWF SYS_TMP9
	CALL LCD_LB1_DEZO10000
LABEL_LT3_SETFD

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS S1,3
	GOTO LABEL_LT3_SETFD2
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF LT3_FD,0
	GOTO LABEL_LT3_END
LABEL_LT3_SETFD2
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BCF LT3_FD,0
LABEL_LT3_END

;***************************************************
; LCD -> LT4
;***************************************************

; test of positiv edge

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSC LT4_FD,0
	GOTO LABEL_LT4_SETFD
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS S1,3
	GOTO LABEL_LT4_SETFD


	MOVLW 7
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVWF SYS_TMP1
	MOVLW 1
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVWF SYS_TMP2

	CALL LCD_LB1_GOTOXY

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVFW ZV2
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVWF SYS_TMP4
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVFW ZV2_HI
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVWF SYS_TMP5

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF SYS_TMP10,0
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVLW 2
	MOVWF SYS_TMP9
	CALL LCD_LB1_DEZO10000
LABEL_LT4_SETFD

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS S1,3
	GOTO LABEL_LT4_SETFD2
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF LT4_FD,0
	GOTO LABEL_LT4_END
LABEL_LT4_SETFD2
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BCF LT4_FD,0
LABEL_LT4_END

;***************************************************
; UND - Gatter -> LG4
;***************************************************

LABEL_LG4_1
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS S1,5
	GOTO LABEL_LG4_FALSE
LABEL_LG4_2
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS PORTB,7
	GOTO LABEL_LG4_FALSE
LABEL_LG4_3
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSC S2,1
	GOTO LABEL_LG4_FALSE

LABEL_LG4_TRUE
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF S1,4
	GOTO LABEL_LG4_ENDE
LABEL_LG4_FALSE
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BCF S1,4
LABEL_LG4_ENDE
;***************************************************
; GND
;***************************************************

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BCF S1,6	; immer Low

;***************************************************
; Schieberegister -> SR1
;***************************************************

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS S2,0	; Reset ?
	GOTO LABEL_SR1_SHIFT
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	CLRF SR1
	GOTO LABEL_SR1_SETOUT

LABEL_SR1_SHIFT

; Test auf positive Flanke

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSC SR1_FD,0
	GOTO LABEL_SR1_SETFD
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS S1,7
	GOTO LABEL_SR1_SETFD
	BCF STATUS,CARRY
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSC S1,7
	BSF STATUS,CARRY

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	RLF SR1,F

LABEL_SR1_SETOUT

; Output Q0

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS SR1,0
	GOTO LABEL_SR1_SETOUT0
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF S2,1
	GOTO LABEL_SR1_SETOUT0_END
LABEL_SR1_SETOUT0
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BCF S2,1
LABEL_SR1_SETOUT0_END

; Output Q1

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS SR1,1
	GOTO LABEL_SR1_SETOUT1
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF S2,0
	GOTO LABEL_SR1_SETOUT1_END
LABEL_SR1_SETOUT1
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BCF S2,0
LABEL_SR1_SETOUT1_END

LABEL_SR1_SETFD

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS S1,7
	GOTO LABEL_SR1_SETFD2
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF SR1_FD,0
	GOTO LABEL_SR1_END
LABEL_SR1_SETFD2
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BCF SR1_FD,0
LABEL_SR1_END

;***************************************************
; Mono-Flop -> MF7
;***************************************************

; Läuft der Impuls ?

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSC MF7_FD,1
	GOTO LABEL_MF7_CHKTIME

; Test auf positive Flanke

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSC MF7_FD,0
	GOTO LABEL_MF7_SETFD
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS PORTB,6
	GOTO LABEL_MF7_SETFD


LABEL_MF7_RESET

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	CLRF MF7
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	CLRF MF7_HI
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF MF7_FD,1
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF S1,7

LABEL_MF7_CHKTIME

	MOVLW 0
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	SUBWF MF7_HI,W
	BTFSS STATUS,ZERO
	GOTO LABEL_MF7_CHECK
	MOVLW 78
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	SUBWF MF7,W
LABEL_MF7_CHECK
	BTFSS STATUS,CARRY
	GOTO LABEL_MF7_SETFD
LABEL_MF7_TO

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BCF MF7_FD,1
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BCF S1,7

LABEL_MF7_SETFD

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS PORTB,6
	GOTO LABEL_MF7_CLR
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF MF7_FD,0
	GOTO LABEL_MF7_ENDE
LABEL_MF7_CLR
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BCF MF7_FD,0

LABEL_MF7_ENDE

;***************************************************
; UND - Gatter -> LG5
;***************************************************

LABEL_LG5_1
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSC S2,1
	GOTO LABEL_LG5_FALSE
LABEL_LG5_2
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS S1,2
	GOTO LABEL_LG5_FALSE

LABEL_LG5_TRUE
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF PORTB,7
	GOTO LABEL_LG5_ENDE
LABEL_LG5_FALSE
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BCF PORTB,7
LABEL_LG5_ENDE
;***************************************************
; Vergleich -> IF2
;***************************************************

	MOVLW 0
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	SUBWF ZV1,W	; F - W -> W

LABEL_IF2_CHECK
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS STATUS,ZERO	; Test auf -> =
	GOTO LABEL_IF2_FALSE

LABEL_IF2_TRUE
	BSF S2,2
	GOTO LABEL_IF2_EXIT

LABEL_IF2_FALSE
	BCF S2,2

LABEL_IF2_EXIT
;***************************************************
; UND - Gatter -> LG6
;***************************************************

LABEL_LG6_1
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS S2,4
	GOTO LABEL_LG6_FALSE
LABEL_LG6_2
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSC S2,2
	GOTO LABEL_LG6_FALSE

LABEL_LG6_TRUE
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF S0,4
	GOTO LABEL_LG6_ENDE
LABEL_LG6_FALSE
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BCF S0,4
LABEL_LG6_ENDE
;***************************************************
; Timer -> TR3
;***************************************************

	MOVLW 7	; Test auf >=
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	SUBWF TR3_HI,W	;F-W -> W
	BTFSS STATUS,ZERO
	GOTO LABEL_TR3_CHECK
	MOVLW 161
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	SUBWF TR3,W	;F-W -> W
LABEL_TR3_CHECK
	BTFSS STATUS,CARRY
	GOTO LABEL_TR3_ENDE

LABEL_TR3_RESET
	MOVLW 7	; Test auf >=
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	SUBWF TR3_HI,F	;F-W -> F
	MOVLW 161
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	SUBWF TR3,F	;F-W -> F
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS STATUS,CARRY
	DECF TR3_HI,F

LABEL_TR3_SET	; toggel output
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSC S2,5
	GOTO LABEL_TR3_CLR
	BSF S2,5
	GOTO LABEL_TR3_ENDE
LABEL_TR3_CLR
	BCF S2,5
LABEL_TR3_ENDE

;***************************************************
; UND - Gatter -> LG7
;***************************************************

LABEL_LG7_1
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS S2,1
	GOTO LABEL_LG7_FALSE
LABEL_LG7_2
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS S2,5
	GOTO LABEL_LG7_FALSE

LABEL_LG7_TRUE
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF S2,6
	GOTO LABEL_LG7_ENDE
LABEL_LG7_FALSE
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BCF S2,6
LABEL_LG7_ENDE
;***************************************************
; LCD -> LT5
;***************************************************

; test of positiv edge

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSC LT5_FD,0
	GOTO LABEL_LT5_SETFD
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS S2,6
	GOTO LABEL_LT5_SETFD


	MOVLW 14
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVWF SYS_TMP1
	MOVLW 0
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVWF SYS_TMP2

	CALL LCD_LB1_GOTOXY

	MOVLW LOW TAB_LT5
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVWF SYS_TMP4
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVLW HIGH TAB_LT5
	MOVWF SYS_TMP5


	CALL LCD_LB1_WRITESTR

LABEL_LT5_SETFD

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS S2,6
	GOTO LABEL_LT5_SETFD2
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF LT5_FD,0
	GOTO LABEL_LT5_END
LABEL_LT5_SETFD2
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BCF LT5_FD,0
LABEL_LT5_END

;***************************************************
; LCD -> LT6
;***************************************************

; test of negative edge

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS LT6_FD,0
	GOTO LABEL_LT6_SETFD
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSC S2,6
	GOTO LABEL_LT6_SETFD


	MOVLW 14
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVWF SYS_TMP1
	MOVLW 0
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVWF SYS_TMP2

	CALL LCD_LB1_GOTOXY

	MOVLW LOW TAB_LT6
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVWF SYS_TMP4
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	MOVLW HIGH TAB_LT6
	MOVWF SYS_TMP5


	CALL LCD_LB1_WRITESTR

LABEL_LT6_SETFD

	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BTFSS S2,6
	GOTO LABEL_LT6_SETFD2
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BSF LT6_FD,0
	GOTO LABEL_LT6_END
LABEL_LT6_SETFD2
	BCF STATUS,RP0	; Bank 0
	BCF STATUS,RP1	; Bank 0
	BCF LT6_FD,0
LABEL_LT6_END

;****************************************

	GOTO MAIN


TAB_LT1
	RETLW 65	; A
	RETLW 46	; .
	RETLW 83	; S
	RETLW 112	; p
	RETLW 105	; i
	RETLW 114	; r
	RETLW 58	; :
	RETLW 0	; end


TAB_LT2
	RETLW 83	; S
	RETLW 46	; .
	RETLW 83	; S
	RETLW 112	; p
	RETLW 105	; i
	RETLW 114	; r
	RETLW 58	; :
	RETLW 0	; end






TAB_LT5
	RETLW 80	; P
	RETLW 0	; end


TAB_LT6
	RETLW 32	;  
	RETLW 0	; end


	END



and this is the LCD Display.






I need to change "Target" insted of "A.Spir" and "Done" insted of "S.Spir".


So how can i change the code and how to get the hex file too....

Regards
 

Changing the code is easy. Just look at the very end of the program and you can see the letters are stored by their ASCII numbers in decimal. Use an ASCII character table to find the numbers for the new letters and substitute them after the RETLW instruction. For example, to change 'A' to 'T' you change 'RETLW 65' to RETLW '84'. Just make sure there is a 'RETLW 0' at the end of the new word, it is used to tell the program thee are no more characters to display.

To recreate the HEX file you need an assembler. Microchip currently have two free assemblers you can download but for this program I suggest you use the older MPLAB version rather than MPLABX. You can find it (version 8.91) at this web page: **broken link removed** near the bottom of the page. It's a big file I'm afraid.

Install it on your computer then use it to load and open your file, edit the words, then press F10 to assemble a new HEX file. The instructions in the program are very good.

Brian.
 




Hi Brian......

Its a huge help for me......I dont have words to express my happy .......Thank you....thank you.....thank you.................Waw.

thanks again and thanks.

I have the MPLAB 8.0. is it work for me?

*** bless you always and your family

Regards Manoj Soorya
 
Last edited:

The program was written a long time ago (16F628 is now obsolete) so MPLAB 8.0 should work. The latest 8.91 version is better though.

Brian.

NOW it is working Dear Brian. Great Help.

Thank you very much for your valuable HELP.

I will upload the video in youtube and I will give you the link .

Thank you and I hope your help again in future.
 

Got me (this time) Keith!
Their web site still shows 8.91 as the latest release but the download page has 8.92. I hope they fix the bugs in MPLABX soon so I can dump Windows for good. MPLAB is one of the few programs holding me back.

Brian.
 

I am still hanging on to MPLAB, but that is because the three times I have tried various versions of MPLAB X it has been disaster. At least the XC8/16/32 compilers work under MPLAB.

Keith.
 

Agreed, although MPLABX is improving. I'm eagerly awaiting the next release of XC8, the 1.20 version has a nasty bug in 24/32 bit arithmetic which stops one of my programs working properly. They have confirmed it and have it fixed in 1.21 but haven't given a release date yet.

Brian.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…