MC95FG0128A
Aug 02, 2018 Ver.2.9
157
11.11.3 Calculator Library
11.11.3.1 Signed Multiplication
__sfr __at (0xF7) CAL_CNTR;
__sfr __at (0xEE) CAL_ADDR;
__sfr __at (0xEF) CAL_DATA;
#define CAL_DIV_START 0x01
#define CAL_DIV_DONE 0x02
#define CAL_DIV_BY_0 0x04
long L_mul( short a, short b ) {
long mul_o;
mul_o = 0;
CAL_ADDR = 0;
// currently point to MA[15:8]
CAL_DATA = a >> 8;
// MA[15:08]<-a[15:08], ADDR<-ADDR+1
CAL_DATA = a;
// MA[07:00]<-a[07:00], ADDR<-ADDR+1
CAL_DATA = b >> 8;
// MB[15:08]<-b[15:08], ADDR<-ADDR+1
CAL_DATA = b;
// MB[07:00]<-b[07:00], ADDR<-ADDR+1
// now ADDR points to MO[31:24],
// so just read it
mul_o = (unsigned long)CAL_DATA<<24; // MO[31:24], ADDR<-ADDR+1
mul_o |= (unsigned long)CAL_DATA<<16; // MO[23:16], ADDR<-ADDR+1
mul_o |= (unsigned long)CAL_DATA<<8; // MO[15:08], ADDR<-ADDR+1
mul_o |= (unsigned long)CAL_DATA; // MO[07:00], ADDR<-ADDR+1
return mul_o;
}
11.11.3.2 Signed Division
__sfr __at (0xF7) CAL_CNTR;
__sfr __at (0xEE) CAL_ADDR;
__sfr __at (0xEF) CAL_DATA;
#define CAL_DIV_START 0x01
#define CAL_DIV_DONE 0x02
Summary of Contents for MC95FG0128A
Page 26: ...MC95FG0128A 26 Aug 02 2018 Ver 2 9 4 Package Diagram Figure 4 1 100 pin LQFP package...
Page 27: ...MC95FG0128A Aug 02 2018 Ver 2 9 27 Figure 4 2 80 pin LQFP package...
Page 28: ...MC95FG0128A 28 Aug 02 2018 Ver 2 9 Figure 4 3 80 pin MQFP package...
Page 29: ...MC95FG0128A Aug 02 2018 Ver 2 9 29 Figure 4 4 64 pin LQFP package...
Page 30: ...MC95FG0128A 30 Aug 02 2018 Ver 2 9 Figure 4 5 64 pin LQFP14 package...