📄 main.c
字号:
//*******************************************************
//* *
//* REMOCON OF MASSAGE MACHINE FOR FAMILY *
//* *
//* DEVICE : uPD784218 *
//* *
//* Copyright (C) 2000 K.K NUMATA *
//*******************************************************
#pragma sfr
#pragma ei
#pragma nop
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include "disp.h"
#include "dlcd.h"
#include "hsio.h"
#include "key_hl.h"
#include "slcd.h"
#include "sound.h"
#include "text.h"
#include "tmr.h"
#include "trm.h"
#include "flag.h"
#include "vfd.h"
#include "iconprc.h"
#define loop() while( 1 )
#define TM10MS 234
void Timer2_init(void);
void Delay_200ms(void);
//*******************************************************
// Pocket main
//*******************************************************
void main( void )
{
//*** mode status flag initirize
// ENDHM_F = 1 ; //I-1
yn_mode = 5 ; //shouna is over
empty_column = 111;
power_on_init_F = 1 ;
Vfd_disp_init(); /* vfd disp init */
Snd_init(); /*sound*/
Vfd_int_init() ;
Trm_init();
/*** uart1 initialize***/
Hsio_init((HSL1+HCL8+HPO), HBPS2400, Htx_buff, sizeof(Htx_buff));
Henable_tx(); /*stop bit 1,8 bit char,odd parity,baud rate 1930(23)*/
Henable_rx(); /* Htx_buff is tx data area, size is 16byte,Hrx_buff is 32 byte size area*/
Timer2_init();
WDM = 0x86 ;
EI() ;
while( !TMIF2)
NOP();
TMIF2 = 0 ;
while(!TMIF2)
NOP();
TMIF2 = 0 ;
NOP();
VFD_F_CON = 1 ;
VFD_V_CON = 1;
VFD_BK = 0; //BRIGHT ON VFD
TMC0 = 0x0c ;
main_step = 0 ;
TMIF2 = 0 ;
EI() ; /* Enabel Interrupt */
//*******************************************************
// MAIN LOOP
//*******************************************************
loop()
{
NOP(); /*loop()==while(1)*/
NOP();
if( TMIF2 == 1 )
{ /** 10ms time up ? **/
TMIF2 = 0; /*clear interrupt flag */
WDM = 0x86; /* watch dog timer reset */
// if((main_step == 1)||(main_step==4)||(main_step==7))
// Column_move_data_prc();
if(power_on_init_F == 0)
Key_hd();
// Sound_prc();
switch(main_step)
{
case 0:
Trm_prc();
Key_prc();
main_step = 1;
break;
case 1:
Timer_hd();
main_step = 2;
break;
case 2:
Seg_prc();
main_step = 3;
break;
case 3:
if((POWER_F == 1) && (cs_tmr_h != 0) && (ac_mode == 0)
&& (stop_step == 0) && (dsp_err == 0) && (dlcd_err_tmr == 0))
// if((POWER_F == 1)&&(ac_mode == 0)&& (stop_step == 0) && (dsp_err == 0)
// && (dlcd_err_tmr == 0))
{
Icon_prc();
}
else
{
Txt_prc();
}
main_step = 4;
break;
case 4:
// Slcd_hd();
// Sound_prc();
// Bgm_sound_prc();
main_step = 5;
break;
case 5:
// Txt_hd();
main_step = 6;
break;
case 6:
// Dlcd_hd();
main_step = 7;
break;
case 7:
main_step = 8;
break;
case 8:
Sound_prc();
Bgm_sound_prc();
main_step = 9;
break;
case 9:
main_step = 0;
break;
}
}
}
}
void Timer2_init(void)
{
/*** timer 2 time 10ms***/
TMIF2=0;
TMC2 = 0x00 ;
PRM2 = 0x07 ; /*counter clock is 23.4KHz*/ /* fxx/512 */
CR20 = TM10MS ; /* High Speed Main Timer 10 msec */
TCE2 = 1 ; /*start counter*/
TMIC2 = 0x43 ; /*priority 3, disable interrupt */
}
void Delay_200ms(void)
{
unsigned char i=30 ;
while(i)
{
NOP();
if(TMIF2)
{
TMIF2 = 0 ;
i--;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -