📄 lib.h
字号:
}
case 4:
{
ExtSpeedSet--;
LibEepromReProgWord(ExtSpeedSet,2054);
ExtLcdPost=1;
break;
}
case 5:
{
ExtPWM23Set=ExtPWM23Set-30;
LibEepromReProgWord(ExtPWM23Set,2056);
ExtLcdPost=1;
break;
}
case 6:
{
ExtPk=*((uint *)2050);
ExtPk--;
LibEepromReProgWord(ExtPk,2050);
ExtLcdPost=1;
break;
}
case 7:
{
ExtPd=*((uint *)2052);
ExtPd--;
LibEepromReProgWord(ExtPd,2052);
ExtLcdPost=1;
break;
}
case 8:
{
ExtOSSystemStart=2;
ExtLcdPost=1;
break;
}
}
break;
}
case 4 :
{
switch (ExtMenu)
{
case 8:
{
ExtOSSystemStart=1;
ExtLcdPost=1;
break;
}
}
break;
}
}
//for(;PTJ!=0b11000011;)
//{
//PORTB=~PORTB;
// }
// PORTB=~PORTB;
}
}
/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/
/*----------------------------------LibSCITransmit(uchar TransmitData)----------------------------------*/
void LibSCITransmit(uchar TransmitData)
{
while(!SCI0SR1_TDRE);//wait for transmit over
SCI0DRL=TransmitData;//write data to transmit register
}
/*----------------------------------LibSCIRecive(uchar ReciveData)----------------------------------*/
uchar LibSCIRecive()
{
uchar ReciveData;
while(!SCI0SR1_RDRF);//wait for recive end
ReciveData=SCI0DRL;//read data for recive register
return ReciveData;
}
/*----------------------------------LibPCSendMsg(char CHAR[])----------------------------------*/
void LibPCSendMsg(char CHAR[])
{
char *p;
p=CHAR;
//Lib_PC_LINE_CHG();
LibSCITransmit(' ');
for(;;)
{
LibSCITransmit(*p);
p++;
if(*p=='/')
{
break;
}
}
}
/*----------------------------------LibPCNumChgPost(unsigned int num)----------------------------------*/
void LibPCNumChgPost(unsigned int num)
{
unsigned char temp;
if(num<10)
{
temp=ExtNumTbl[num];
LibSCITransmit(temp);
LibSCITransmit(' ');
}
else if(num>9 & num<100)
{
temp=ExtNumTbl[num/10];//十
LibSCITransmit(temp);
temp=ExtNumTbl[num%10];//个
LibSCITransmit(temp);
LibSCITransmit(' ');
}
else if(num>99 & num<1000)
{
temp=ExtNumTbl[num/100];//百
LibSCITransmit(temp);
temp=ExtNumTbl[(num%100)/10];//十
LibSCITransmit(temp);
temp=ExtNumTbl[num%10];//个
LibSCITransmit(temp);
LibSCITransmit(' ');
}
else if(num>999 & num<10000)
{
temp=ExtNumTbl[num/1000];//千
LibSCITransmit(temp);
temp=ExtNumTbl[(num%1000)/100];//百
LibSCITransmit(temp);
temp=ExtNumTbl[(num%100)/10];//十
LibSCITransmit(temp);
temp=ExtNumTbl[num%10];//个
LibSCITransmit(temp);
LibSCITransmit(' ');
}
else if(num>9999)
{
temp=ExtNumTbl[num/10000];//万
LibSCITransmit(temp);
temp=ExtNumTbl[(num%10000)/1000];//千
LibSCITransmit(temp);
temp=ExtNumTbl[(num%1000)/100];//百
LibSCITransmit(temp);
temp=ExtNumTbl[(num%100)/10];//十
LibSCITransmit(temp);
temp=ExtNumTbl[num%10];//个
LibSCITransmit(temp);
LibSCITransmit(' ');
}
}
/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/
//************************************************************************/
// MicroC/Os-II The Real-Time Kernel /
// /
//************************************************************************/
#if OS_CPU_HOOKS_EN
/*
*********************************************************************************************************
* TASK CREATION HOOK
*
* Description: This function is called when a task is created.
*
* Arguments : ptcb is a pointer to the task control block of the task being created.
*
* Note(s) : 1) Interrupts are disabled during this call.
*********************************************************************************************************
*/
void OSTaskCreateHook (OS_TCB *ptcb)
{
}
/*
*********************************************************************************************************
* TASK DELETION HOOK
*
* Description: This function is called when a task is deleted.
*
* Arguments : ptcb is a pointer to the task control block of the task being deleted.
*
* Note(s) : 1) Interrupts are disabled during this call.
*********************************************************************************************************
*/
void OSTaskDelHook (OS_TCB *ptcb)
{
}
/*
*********************************************************************************************************
* TASK SWITCH HOOK
*
* Description: This function is called when a task switch is performed. This allows you to perform other
* operations during a context switch.
*
* Arguments : none
*
* Note(s) : 1) Interrupts are disabled during this call.
* 2) It is assumed that the global pointer 'OSTCBHighRdy' points to the TCB of the task that
* will be 'switched in' (i.e. the highest priority task) and, 'OSTCBCur' points to the
* task being switched out (i.e. the preempted task).
*********************************************************************************************************
*/
void OSTaskSwHook (void)
{
}
/*
*********************************************************************************************************
* STATISTIC TASK HOOK
*
* Description: This function is called every second by uC/OS-II's statistics task. This allows your
* application to add functionality to the statistics task.
*
* Arguments : none
*********************************************************************************************************
*/
void OSTaskStatHook (void)
{
}
/*
*********************************************************************************************************
* TICK HOOK
*
* Description: This function is called every tick.
*
* Arguments : none
*
* Note(s) : 1) Interrupts may or may not be ENABLED during this call.
*********************************************************************************************************
*/
void OSTimeTickHook (void)
{
}
void OSTaskIdleHook(void)
{
}
void OSInitHookBegin(void)
{
LibSysClkInit();
LibPortInit();
LibPWM16Init();
LibADInit();
LibEepromInit();
LibLCDInit();
Lib_PC_LINE_CHG();
PORTB=~PORTB;
}
void OSInitHookEnd(void)
{
while(ExtOSSystemStart<1)
{
LibLCDInfoDis();
}
PORTB=~PORTB;
if(ExtOSSystemStart==1)
{
PWMDTY23=*((uint *)2048);
ExtPk=*((uint *)2050);
ExtPd=*((uint *)2052);
ExtSpeedSet=*((uint *)2054);
ExtPWM23Set=*((uint *)2056);
//LibLCDNumChgPost(EPROT_EPOPEN);
//LibLCDNumChgPost(ESTAT_CBEIF);
LibEepromErase(MAS_ERA,2100);
LibEepromReProgWord(PWMDTY23,2048);
LibEepromReProgWord(ExtPk,2050);
LibEepromReProgWord(ExtPd,2052);
LibEepromReProgWord(ExtSpeedSet,2054);
LibEepromReProgWord(ExtPWM23Set,2056);
}
}
void OSTCBInitHook(OS_TCB *ptcb)
{
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -