/*
 * DIV.c
 *
 *  Created on: 2019-8-28
 *      Author: charles_cai
 */
#include"main.h"

#ifndef DIV_C_
#define DIV_C_

/*
 * 程序功能：返回 a/b，余数放入全局变量中。
 */
unsigned int Div_A_B(unsigned int a,unsigned int b)
{
	unsigned int value;
	DIVAH = a>>8;
	DIVAL = a& 0xFF;

	DIVBH = b>>8;
	DIVBL = b& 0xFF;

	DIVEN =1;
	while(!DIVOEN);

	value = DIVQH <<8;
	value +=DIVQL;

	last =DIVRH<<8;
	last +=DIVRL;

	DIVEN =0;

	return value;
}

#endif /* DIV_C_ */
