Our
company offers rubber, and specialty seal and o-ring for molding electronic and electrical Connectors, both circular
and rectangular types. We have in house capabilities and quick turn
around.
Cable Grommets with various Grommet Shapes, Rib Styles, Slot Shapes, Inner Flanges,
and Colors - To have access to our 3D Cable Grommet Design Tool
processor16C54
radixDEC
CarryEQU0
Zero_EQU2
arg1EQU0x08
arg2EQU0x0A
resEQU0x0B
rmEQU0x0C
counterEQU0x07
;FILEtest\div16_8.c
;/*
;DIVISION: 16bitDIV8bit
;===========================
;This routine performs a 16-bit division by an 8-bit number in just 97 cycles (97 microseconds at 4MHz).
;It requires that the result fits into an 8-bit value, and it also returns the remainder.
;Optimized for both speed and code size.
;*/
;
;uns16arg1; // 16-bit unsigned argument
;uns8arg2; // 8-bit unsigned argument
;uns8res; // 8-bit unsigned result
;uns8rm; // 8-bit unsigned remainder
;
;
;charuDiv16_8(void)
;//res, rm = arg1 / arg2
;//CYCLES: 11*8 + 10 - 1 = 97 + CALL & RETURN
;//INSTRUCTIONS: 27
;{
uDiv16_8
;
;if(arg1.high8 >= arg2)
MOVFarg2, W
SUBWFarg1+1, W
BTFSC0x03, Carry
;
;return 0; /* overflow or zero divide */
RETLW.0
;
;char counter = 8;
MOVLW.8
MOVWFcounter
;
;rm = arg1.high8;
MOVFarg1+1, W
MOVWFrm
;
;res = rl(arg1.low8);
RLFarg1, W
MOVWFres
;
;do {
;LOOP:
;rm = rl(rm);
m001 RLFrm, 1
;
;W = arg2;
MOVFarg2, W
;
;if (!Carry) {
BTFSC0x03, Carry
GOTOm002
;
;W = rm - W;
SUBWFrm, W
;
;if (Carry)
BTFSC0x03, Carry
;
;rm = W;
MOVWFrm
;
;res = rl(res);
RLFres, 1
;
;if (--counter == 0)
DECFSZcounter, 1
GOTOm001
;
;return 1;
RETLW.1
;
;goto LOOP;
;
;}
;
;rm -= W;
m002 SUBWFrm, 1
;
;Carry = 1;
BSF0x03, Carry
;
;res = rl(res);
RLFres, 1
;
;} while (--counter > 0);
DECFSZcounter, 1
GOTOm001
;
;return 1; // OK
RETLW.1
;}
;
;
;
;void main(void)
;{
Main
;
;arg1 = 2000;
MOVLW.208
MOVWFarg1
MOVLW.7
MOVWFarg1+1
;
;arg2 = 200;
MOVLW.200
MOVWFarg2
;
;
;while (arg1 > arg2) {
m003 MOVFarg1+1, W
BTFSS0x03, Zero_
GOTOm004
MOVFarg1, W
SUBWFarg2, W
BTFSC0x03, Carry
GOTOm005
;
;if (!uDiv16_8())
m004 CALLuDiv16_8
XORLW.0
BTFSC0x03, Zero_
;
;nop();
NOP
;
;arg1 -= 11;
MOVLW.11
SUBWFarg1, 1
BTFSS0x03, Carry
DECFarg1+1, 1
;
;}
GOTOm003
;
;m005 SLEEP
ORG0x01FF
GOTOmain
END
Silicone Rubber Products,Cable Silicone O-Ring,Rubber Seal,Custom Silicone Seal,Waterproofing O-Ring,Tpe Grommet
ETOP WIREHARNESS LIMITED , https://www.etopwireharness.com