Intelligent multi-wave plating power supply controller source program

MOS power IC full range
Passive 3225G 8MHZ 10MHZ
>;************************************************ ********************
Intelligent multi-wave plated power controller source program.
;************************************************* *******************
Listp=16f877
Include"p16F877.inc"
;------------------------------------------------- -------------------
H_byteequ10; BCD and binary conversion use the definition of the register.
L_byteequ11
R0equ12
R1equ13
R2equ14
H_tempequ15
L_tempequ16
CARRYequ0h
STATUSequ3h
;------------------------------------------------- -------------------
Keyequ20; register definition for keyboard and display.
Nkeyequ2d
LED0equ21
Led1equ22
Led2equ23
Led3equ24
Led4equ25
Led5equ26
Led6equ27
Led7equ28
Num0equ29
Num1equ2a
Num2equ2b
Num3equ2c
Cycleequ2e
Tstctequ30
Tstvaluequ31
Dispbitequ32
Count1equ33
Count2equ34
Data1equ35
Data2equ36
;************************************************* *******************
Org0x0000; start on page 0.
Nop

Org0x0005; The program starts.
Main
;bsfPCLATH,4; convert to the third page, call
;bsfPCLATH, 3; off display program.
;calloffled

bcfSTATUS, RP0
bcfSTATUS, RP1; Initializes the display PUT character.
MOVlw0x10
MOVwfled0
MOVlw0x11
MOVwfled1
MOVlw0x12
MOVwfled2
MOVlw0x13
MOVwfled3
MOVlw0x15
MOVwfled4
MOVlw0x09
MOVwfled5
MOVlw0x0a
MOVwfled6
MOVlw0x0f
MOVwfled7
MOVlw0x01
MOVwfcycle
bsfPCLATH, 4; convert to the third page
bsfPCLATH, 3
Callled

;########################################################################### ###################
; keyboard scanning and display begins.
;########################################################################### ###################

MOVlw0x08; Set the loop to display eight digits.
MOVwfdispbit
MOVlw0x01; Select the display bit.
MOVwfcycle

Wait
bsfPCLATH, 4
bcfPCLATH, 3
callkeysCAN; get the key value.

bcfPCLATH, 4; convert to page0.
bcfPCLATH, 3
MOVfkey, 0
bcfSTATUS, C
MOVlw0x0a
Subwfkey, 0; key value -10.
btfscSTATUS, C
Gotocommkey; there is a carry to the command key.
Numkey; no carry to the number key.
bcfSTATUS, RP1
bcfSTATUS, RP0
clrfPORTA
bsfSTATUS, RP0
MOVlw0x07
MOVwfADCON1
MOVlw0x00
MOVwfTRISA

MOVwfTRISD; Set PORTB as output.
MOVwfTRISC; Set PORTC to output.

bcfSTATUS, RP0

MOVlw0xff
MOVwfPORTA
;bsfPORTA,0; PORTA0,1,2 lose; high potential is to shield the keyboard.
;bsfPORTA,1
;bsfPORTA,2

MOVlw0x0f
MOVwfPORTC
MOVfcycle, 0
MOVwfPORTD

bsfPCLATH, 4
bsfPCLATH, 3; key value to send W display.
MOVfkey, 0
Calltable

MOVwfPORTC
Rlfcycle

MOVlw0x00
MOVwfPORTD

bcfPCLATH, 4
bcfPCLATH, 3
Decfszdispbit
Gotowait

MOVlw0x01; Set the loop initial value.
MOVwfcycle
MOVlw0x08; Set the initial value of the display digits.
MOVwfdispbit

Gotowait

Commkey; start command key processing
MOVlw0x09
Subwfkey; The key value is reduced by 10.
MOVlwprogram
Addwfkey,0
programMOVwfPCL; Go to the corresponding function handler below.
Gotobeilukey; Go to the rate handler.
Gotopulsedc; Go to the set pulse direction handler.
Gotoprog; Go to the Set Pulse Parameters program.
Gotoenter; go to the confirmation key handler.
Gotorun; go to the run key handler.
Gotopause; Go to the Pause Key Handler.


Beilukey; start rate processing
Nop; the actual application should be changed to NOP
Nop; required instructions
Nop
Nop
Nop
Gotomain; the rate is processed, transfer to the designated place

Pulsedc; start pulse direction processing
Nop; the actual application should be changed to NOP
Nop; the instruction required by pulsedc
Nop
Nop
Nop
Gotomain; pulse direction processing, transfer to designated place

Prog; start pulse parameter setting
Nop; the actual application should be changed to NOP
Nop; the instruction required by prog
Nop
Nop
Nop
Gotomain; after the pulse parameter is set, go to the designated place

Enter; start confirmation key processing
Nop; the actual application should be changed to NOP
Nop; instruction required by enter
Nop
Nop
Nop
Gotomain; confirm the key processing, transfer to the designated place

Run; start running key processing
Nop; the actual application should be changed to NOP
Nop; instruction required by run
Nop
Nop
Nop
Gotomain; run key processing, transfer to the designated place

Pause; start pausing key processing
Nop; the actual application should be changed to NOP
Nop; the instruction required by pause
Nop
Nop
Nop
Gotomain; pause key processing, transfer to the designated place

Org0x1000; page2 begins.

Keyscan; keyboard scanning begins.
Callkeyvalue; Get the key-value subroutine.
Comfkey,1
MOVlw0xff
bcfSTATUS, C
Addwfkey,0
btfssSTATUS, C; column 0 has a key pressed or not?
Gotokeyscan1; none, scan the next column

;calldelay
Calldelay10; delay, debounce

Callkeyvalue
Comfkey,1
MOVlw0xff
bcfSTATUS, C
Addwfkey,0
btfssSTATUS, C
Gotokeyscan1

Callnokey; wait for the button to pop up.
;calldelay
Calldelay10
Callnokey

;------------------------------------
Btfsskey, 0; is the 0th line key?
Gotoprocess00; No, scan the next line.
MOVlw0x00; Yes, the key value is sent to the key to save.
MOVwfkey; return.
Return
Process00
Btfsskey, 1; is the first row of keys?
Gotoprocess01; No, scan the next line.
MOVlw0x01; Yes, the key value is sent to the key.
MOVwfkey
Return
Process01
Btfsskey, 2; is the second line key?
Gotoprocess02; No, scan the next line.
MOVlw0x02
MOVwfkey; Yes, the key value is sent to the key.
Return
Process02
Btfsskey, 3; is the 3rd line key?
Gotoprocess03; No, scan the next line.
MOVlw0x03
MOVwfkey; Yes, the key value is sent to the key.
Return
Process03
Btfsskey, 4; is the 4th line key?
Gotoprocess04; No, scan the next line.
MOVlw0x04
MOVwfkey; Yes, the key value is sent to the key.
Return
Process04
Btfsskey, 5; is the 5th line key?
Gotoprocess05; No, scan the next line.
MOVlw0x05
MOVwfkey; Yes, the key value is sent to the key.
Return
Process05
Btfsskey,6; is the 6th line key?
Gotoprocess06; No, scan the next line.
MOVlw0x06
MOVwfkey; Yes, the key value is sent to the key.
Return
Process06
Btfsskey,7; is the 7th line key?
Gotokeyscan1; No, scan the next line.
MOVlw0x07
MOVwfkey; Yes, the key value is sent to the key.
Return
;------------------------------------
Keyscan1
Callkeyvalue1; scan column 1
Comfkey,1
MOVlw0xff
bcfSTATUS, C
Addwfkey,0
btfssSTATUS, C
Gotokeyscan2

;calldelay
Calldelay10

Callkeyvalue1
Comfkey,1
MOVlw0xff
bcfSTATUS, C
Addwfkey,0
btfssSTATUS, C
Gotokeyscan2

Callnokey1; wait for the keyboard to pop up.
;calldelay
Calldelay10
Callnokey1

;------------------------------------
Btfsskey, 0; loop scan line 0.
Gotoprocess10
MOVlw0x08
MOVwfkey; key value to send key.
Return
Process10
Btfsskey, 1; loop scan line 1.
Gotoprocess11
MOVlw0x09
MOVwfkey; key value to send key.
Return
Process11
Btfsskey, 2; loop scan line 2.
Gotoprocess12
MOVlw0x0a
MOVwfkey; key value to send key.
Return
Process12
Btfsskey, 3; loop scan line 3.
Gotoprocess13
MOVlw0x0b;
MOVwfkey; key value to send key.
Return
Process13
Btfsskey, 4; loop scan line 4.
Gotoprocess14
MOVlw0x0c
MOVwfkey; key value to send key.
Return
Process14
Btfsskey, 5; loop scan line 5.
Gotoprocess15
MOVlw0x0d;
MOVwfkey; key value to send key.
Return
Process15
Btfsskey, 6; loop scan line 6.
Gotoprocess16
MOVlw0x0e;
MOVwfkey; key value to send key.
Return
Process16
Btfsskey, 7; loop scan line 7.
Gotokeyscan2
MOVlw0x0f;
MOVwfkey; key value to send key.
Return
;------------------------------------
Keyscan2
Callkeyvalue2; scan the second column.
Comfkey,1
MOVlw0xff
bcfSTATUS, C
Addwfkey,0
btfssSTATUS, C
Gotokeyscan

;calldelay
Calldelay10

Callkeyvalue2
Comfkey,1
MOVlw0xff
bcfSTATUS, C
Addwfkey,0
btfssSTATUS, C
Gotokeyscan

Callnokey2; wait for the button to pop up.
;calldelay
Calldelay10
Callnokey2
;------------------------------------
Btfsskey, 0; scan line 0.
Gotoprocess20
MOVlw0x10;
MOVwfkey; key value to send key.
Return
Process20
Btfsskey, 1; scan line 1.
Gotoprocess21
MOVlw0x11;
MOVwfkey; key value to send key
Return
Process21
Btfsskey, 2; scan line 2.
Gotoprocess22
MOVlw0x12;
MOVwfkey; key value to send key.
Return
Process22
Btfsskey, 3; scan line 3.
Gotoprocess23
MOVlw0x13;
MOVwfkey; key value to send key.
Return
Process23
Btfsskey, 4; scan line 4.
Gotoprocess24
MOVlw0x14;
MOVwfkey; key value to send key.
Return
Process24
Btfsskey, 5; scan line 5.
Gotoprocess25
MOVlw0x15
MOVwfkey; key value to send key.
Return
Process25
Btfsskey, 6; scan line 6.
Gotoprocess26
MOVlw0x16
MOVwfkey; key value to send key.
Return
Process26
Btfsskey, 7; scan line 7.
Gotokeyscan;
MOVlw0x17
MOVwfkey; key value to send key.
Return
;------------------------------------

keyvaluebcfSTATUS, RP1
bcfSTATUS, RP0
clrfPORTA; clear PORTA.
bsfSTATUS, RP0
MOVlw0x07; Set porta as output.
MOVwfADCON1
MOVlw0x00
MOVwfTRISA

bcfSTATUS, RP0
MOVlw0xfe; select the A0 bit.
MOVwfPORTA

bsfSTATUS, RP0
MOVlw0x00
MOVwfTRISC

bcfSTATUS, RP0; set portc to high.
MOVlw0xff
MOVwfPORTC
;clrfPORTC

bsfSTATUS, RP0
MOVlw0xff
MOVwfTRISC

bcfSTATUS, RP0; read portc data.
MOVfPORTC, 0
MOVwfkey

clrfPORTA
bsfSTATUS, RP0
MOVlw0x07
MOVwfADCON1
MOVlw0x00
MOVwfTRISA

bcfSTATUS, RP0
MOVlw0xff
MOVwfPORTA; shield porta port.
;bsfPORTA,0

Return

Keyvalue1
bcfSTATUS, RP1
bcfSTATUS, RP0
clrfPORTA
bsfSTATUS, RP0
MOVlw0x07
MOVwfADCON1
MOVlw0x00
MOVwfTRISA

bcfSTATUS, RP0
MOVlw0xfd
MOVwfPORTA; select the A1 bit.

bsfSTATUS, RP0
MOVlw0x00
MOVwfTRISC

bcfSTATUS, RP0
MOVlw0xff
MOVwfPORTC
;clrfPORTC

bsfSTATUS, RP0
MOVlw0xff
MOVwfTRISC

bcfSTATUS, RP0
MOVfPORTC, 0
MOVwfkey
clrfPORTA
bsfSTATUS, RP0
MOVlw0x07
MOVwfADCON1
MOVlw0x00
MOVwfTRISA

bcfSTATUS, RP0
MOVlw0xff
MOVwfPORTA
;bsfPORTA,0
Return
Keyvalue2
bcfSTATUS, RP1
bcfSTATUS, RP0
clrfPORTA
bsfSTATUS, RP0
MOVlw0x07
MOVwfADCON1
MOVlw0x00
MOVwfTRISA
bcfSTATUS, RP0
MOVlw0xfb; select the A2 bit.
MOVwfPORTA

bsfSTATUS, RP0
MOVlw0x00
MOVwfTRISC

bcfSTATUS, RP0
MOVlw0xff
MOVwfPORTC
;clrfPORTC

bsfSTATUS, RP0
MOVlw0xff
MOVwfTRISC

bcfSTATUS, RP0
MOVfPORTC, 0
MOVwfkey

clrfPORTA
bsfSTATUS, RP0
MOVlw0x07
MOVwfADCON1
MOVlw0x00
MOVwfTRISA

bcfSTATUS, RP0
MOVlw0xff
MOVwfPORTA
;bsfPORTA,0
Return

Nokey
bcfSTATUS, RP1
bsfSTATUS, RP0
clrfPORTA
bsfSTATUS, RP0
MOVlw0x07
MOVwfADCON1
MOVlw0x00
MOVwfTRISA

bcfSTATUS, RP0; select the A0 bit.
MOVlw0xfe
MOVwfPORTA

bsfSTATUS, RP0
MOVlw0x00
MOVwfTRISC
bcfSTATUS, RP0; set portc to high.
MOVlw0xff
MOVwfPORTC
;clrfPORTC

bsfSTATUS, RP0
MOVlw0xff
MOVwfTRISC
bcfSTATUS, RP0; read portc data.
MOVfPORTC, 0
MOVwfnkey
Comfnkey

clrfPORTA
bsfSTATUS, RP0
MOVlw0x07
MOVwfADCON1
MOVlw0x00
MOVwfTRISA

bcfSTATUS, RP0
MOVlw0xff
MOVwfPORTA; shield porta port.
;bsfPORTA,0
MOVlw0xff
bcfSTATUS, C
Addwfnkey,0
btfscSTATUS, C
Gotonokey
Return

Nokey1
bcfSTATUS, RP1
bsfSTATUS, RP0
clrfPORTA
bsfSTATUS, RP0
MOVlw0x07
MOVwfADCON1
MOVlw0x00
MOVwfTRISA

bcfSTATUS, RP0; select the A0 bit.
MOVlw0xfd
MOVwfPORTA

bsfSTATUS, RP0
MOVlw0x00
MOVwfTRISC

bcfSTATUS, RP0; set portc to high.
MOVlw0xff
MOVwfPORTC
;clrfPORTC

bsfSTATUS, RP0
MOVlw0xff
MOVwfTRISC

bcfSTATUS, RP0; read portc data.
MOVfPORTC, 0
MOVwfnkey
Comfnkey

clrfPORTA
bsfSTATUS, RP0
MOVlw0x07
MOVwfADCON1
MOVlw0x00
MOVwfTRISA

bcfSTATUS, RP0
MOVlw0xff
MOVwfPORTA; shield porta port.
;bsfPORTA,0

MOVlw0xff
bcfSTATUS, C
Addwfnkey,0
btfscSTATUS, C
Gotonokey1
Return
Nokey2
bcfSTATUS, RP1
bsfSTATUS, RP0
clrfPORTA
bsfSTATUS, RP0
MOVlw0x07
MOVwfADCON1
MOVlw0x00
MOVwfTRISA

bcfSTATUS, RP0; select the A0 bit.
MOVlw0xfb
MOVwfPORTA

bsfSTATUS, RP0
MOVlw0x00
MOVwfTRISC

bcfSTATUS, RP0; set portc to high.
MOVlw0xff
MOVwfPORTC
;clrfPORTC

bsfSTATUS, RP0
MOVlw0xff
MOVwfTRISC

bcfSTATUS, RP0; read portc data.
MOVfPORTC, 0
MOVwfnkey
Comfnkey

clrfPORTA
bsfSTATUS, RP0
MOVlw0x07
MOVwfADCON1
MOVlw0x00
MOVwfTRISA

bcfSTATUS, RP0
MOVlw0xff
MOVwfPORTA; shield porta port.
;bsfPORTA,0

MOVlw0xff
bcfSTATUS, C
Addwfnkey,0
btfscSTATUS, C
Gotonokey2
Return
Delay
MOVlw0xf0
MOVwfcount1
MOVlw0xf0
MOVwfcount2
Delay1
Decfszcount1,1
Gotodelay2
Return

Delay2
Decfszcount2,1
Gotodelay2
MOVlw0x01
MOVwfcount2
Gotodelay1

delay10MOVlw0x0d
MOVwfdata1
lp0MOVlw0xff
MOVwfdata2
Lp1decfszdata2,1
Gotolp1
Decfszdata1,1
Gotolp0
Return

Org0x1800; the third page begins.
tableaddwfPCL, 1; The following is the display code table.
Retlw0x3F; "0"
Retlw0x06;"1"
Retlw0x5B; "2"
Retlw0x4F; "3"
Retlw0x66;"4"
Retlw0x6D; "5"
Retlw0x7D; "6"
Retlw0x07;"7"

Retlw0x7F; "8"
Retlw0x6F; "9"
Retlw0x77;"A"
Retlw0x7C; "B"
Retlw0x39;"C"
retlw0x5E; "D"
Retlw0x79;"E"
Retlw0x71;"F"
Retlw0x73;"P""0x10"
retlw0x3E;"U""0x11"
Retlw0x31;"T""0x12"
Retlw0x6E;"y""0x13"
Retlw0xFF; "full bright" "0x14"
Retlw0x00; "all off" "0x15"
Retlw0xC0; "0" "0x16"
Retlw0xC0;"0""0x17"
Led; LED eight-bit display program.
bsfSTATUS, RP0
MOVlw0x00
MOVwfTRISD
MOVwfTRISC
bcfTRISA,0
bcfSTATUS, RP0
bsfPORTA,0
MOVlw0x01
MOVwfcycle
MOVfcycle, 0
MOVwfPORTD
MOVfled0,0
Calltable
MOVwfPORTC

Rlfcycle
MOVfcycle, 0
MOVwfPORTD
MOVfled1,0
Calltable
MOVwfPORTC

Rlfcycle
MOVfcycle, 0
MOVwfPORTD
MOVfled2,0
Calltable
MOVwfPORTC

Rlfcycle
MOVfcycle, 0
MOVwfPORTD
MOVfled3,0
Calltable
MOVwfPORTC

Rlfcycle
MOVfcycle, 0
MOVwfPORTD
MOVfled4,0
Calltable
MOVwfPORTC

Rlfcycle
MOVfcycle, 0
MOVwfPORTD
MOVfled5,0
Calltable
MOVwfPORTC

Rlfcycle
MOVfcycle, 0
MOVwfPORTD
MOVfled6,0
Calltable
MOVwfPORTC
Rlfcycle
MOVfcycle, 0
MOVwfPORTD
MOVfled7,0
Calltable
MOVwfPORTC
MOVlw0x00
MOVwfPORTD
Return
Offled; display all off the program.
MOVlw0x15
MOVwfled0
MOVwfled1
MOVwfled2
MOVwfled3
MOVwfled4
MOVwfled5
MOVwfled6
MOVwfled7
Callled
Return
End

Fiber Optic Patch Panel

Fiber Optic Patch Panel,Fiber Patch Panel,Fiber Distribution Panel,Optical Patch Panel

Cixi Dani Plastic Products Co.,Ltd , https://www.dani-fiber-optic.com