標(biāo)題:
屏廠客戶LCD9325參考STM32源代碼
[打印本頁(yè)]
作者:
1656449435
時(shí)間:
2018-7-4 11:15
標(biāo)題:
屏廠客戶LCD9325參考STM32源代碼
屏廠客戶LCD9325參考代碼
0.png
(43.68 KB, 下載次數(shù): 49)
下載附件
2018-7-4 18:06 上傳
單片機(jī)源程序如下:
#include <stm32f10x_lib.h>
#include "stdinc.h"
#include "sys.h"
#include "led.h"
#include "key.h"
#include "wdg.h"
#include "TFT.h"
#include "touch.h"
#include "picture.h"
#include "ui.h"
#include "config.h"
#include "sysserv.h"
#include "TFT_Init.h"
#include "ParamMgr.h"
#include "DMX.h"
#include "PCBATest.h"
/**********************************************************************/
// DSP-A
// 2016.9.28
//
/**********************************************************************/
INT8U GucMsg;
INT8U GucTmr1Cnt = 0;
BOOL GbTmr1MSSyncSig = FALSE;
extern INT8U GucDMXCableValid;
extern BOOL GbMaterSend;
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
void SysTimerInit (void);
void sysSuspendForSync (void);
void Timerx_Init (void);
void sysInit (void);
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#define T_10MS 0
#define T_20MS 1
#define T_200MS 2
#define T_500MS 3
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
int main(void)
{
INT8U ucParam;
INT8U ucKey;
static INT8U ucDlyS = 0;
sysInit();
SetTimer(T_10MS, 10);
SetTimer(T_20MS, 20);
SetTimer(T_200MS, 200);
SetTimer(T_500MS, 1000);
GetLockCode();
while(1)
{
sysSuspendForSync();
if (GbTmr1MSSyncSig)
{
GbTmr1MSSyncSig = FALSE;
SoftTimer1mSec();
AudioDetect();
CodingSwitch();
}
GucMsg = GetMessage(&ucParam);
switch (GucMsg)
{
case MSG_TIMEOUT:
switch (ucParam)
{
case T_10MS:
if (GbMaterSend) // (PARAM(TEST_MASTER)) // if I'm configed as master
{
RS485_AS_OUTPUT(); // Set DMX as output to output data
UART_RXD_DISABLE();
if(ucDlyS > 2)
{
ucDlyS = 0;
DMXSend();
}
ucDlyS++;
}
else
{
UART_RXD_ENABLE();
RS485_AS_INPUT(); // Set DMX as input, release RS485 bus
}
ParamUpdateRoutine();
break;
case T_20MS:
ucKey = KeyScan();
//KeyHandle(ucKey);
uiRoutine(ucKey);
GbDMXUpdate = TRUE;
break;
case T_200MS:
// Deal DMX cable active status
if (GucDMXCableValid != 0) // DMX Cable is inserted and valid.
{
GucDMXCableValid--;
}
LedRoutine();
TestDataRxRoutine();
TestDataTxRoutine();
break;
case T_500MS:
ParamResetRoutine();
PCBtestRoutine();
break;
default:
break;
}
break;
default:
break;
}
DMXSendRoutine();
}
}
void sysInit (void)
{
Stm32_Clock_Init(6); //系統(tǒng)時(shí)鐘設(shè)置
SysTimerInit();
Timerx_Init();
SoftTimerInit();
MsgQueueInit();
LCD_Init(); // 初始化液晶
Touch_Init();
uiInit();
dmxInit();
uartInit();
PCB_TestInit();
//IWDG_Init(1,0xfff);
}
void sysSuspendForSync (void)
{
IWDG_Feed();
while (GucTmr1Cnt < 8)
{
IWDG_Feed(); // feed watch dog
if (GucTmr1Cnt >= 6)
continue;
//stpPosFeedback();
}
ENTER_CRITICAL();
GucTmr1Cnt -= 8;
EXIT_CRITICAL();
//lcdBufUpdate();
}
void SysTimerInit (void)
{
SysTick->CTRL |= (1<<1)|(1<<2);
SysTick->LOAD = 749; // 31.25us tick, 749 = (31.25 * 24MHz) - 1
SysTick->CTRL |= (1<<0);
}
void Timerx_Init (void) // 1MS sync signal, avoid 31.25 tick loss
{
RCC->APB1ENR |= (1<<4);
TIM6->ARR = 24000-1; //1000us
TIM6->PSC = 0;
TIM6->CR1 |= (1<<0);
}
INT16S GiSlvSyncTick = 0;
INT16S GiSlvSyncDelta = 0;
INT16U GuiUpdateSysCnt = 0;
#pragma optimize = speed
void SysTick_Handler (void) // 31.25us
{
static INT8U ch = 0;
SYS_TMR:
if (GiSlvSyncDelta < -5)
{
GiSlvSyncDelta++;
return;
}
GucTmr1Cnt++;
GiSlvSyncTick++;
……………………
…………限于本文篇幅 余下代碼請(qǐng)從51黑下載附件…………
復(fù)制代碼
所有資料51hei提供下載:
屏廠客戶LCD9325參考代碼.rar
(624.14 KB, 下載次數(shù): 10)
2018-7-4 18:07 上傳
點(diǎn)擊文件名下載附件
下載積分: 黑幣 -5
作者:
嗒嗒嗒2
時(shí)間:
2019-3-30 15:10
謝謝,樓主
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1