We always set mcu port in high/low level to enable some actions , but forget to set MCU port in low/high level to disable it after the action finished .
Today I modified Nixie tube display system code . The original *.hex file burn into MCU ,system worked abnormal ----after hear startflag "di-ring " the Nixie tubes disable display time data .After wrote two line codes " P0 = 0xff ; NixietubeD = 1 ; ",the issue solved .
< !–more–>
The issue told us do not forget to set MCU in opposite level to disable some action after them finished .
/***********************************************************************/
/* */
/*Project:Nixie tube Display system */
/* Date: July 17 2011 mordify:July 25 2011 */
/* Author: Ilymtics */
/*Contact:ilymtics@msn.com */
/* */
/***********************************************************************/
#include "headfile.h"
unsigned char second ,minit ,csecond ;
unsigned int count ;
/***********************************************************************/
/* Function :Nixietubedisplay */
/* Describe :display form 0 to 9 form left Nixietube to right Nixietubes */
/**********************************************************************/
void Nixietubedisplay()
{
/*P1 = LEDrunning[csecond];// light LED every 1 minisecond ;
Delaynms(1) ;
P1 = 0xff ;
*/
NixietubeA = 0 ; // enable minit display
P0 = Nixietubecode[minit/10] ;
Delaynms(1) ;
P0 = 0xff ; //disable minit display ,miss these two lines ,the system will display abnormal
NixietubeA = 1 ;
NixietubeB = 0 ;
P0 = Nixietubecode[minit%10] ;
Delaynms(1) ;
P0 = 0xff ;
NixietubeB = 1 ;
NixietubeC = 0 ;
P0 = Nixietubecode[second/10] ;
Delaynms(1) ;
P0 = 0xff ;
NixietubeC = 1 ;
NixietubeD = 0 ;
P0 = Nixietubecode[second%10] ;
Delaynms(1) ;
P0 = 0xff ;
NixietubeD = 1 ;
}
/***********************************************************************/
/* Function :systeminit */
/* Describe :initial system setting */
/**********************************************************************/
void systeminit()
{
TMOD = 0X02 ;
TH0 = 0x19 ;
TL0 = 0x19 ;
EA = 1 ;
TR0 = 1 ;
ET0 = 1 ;
}
/***********************************************************************/
/* Function :timer0 */
/* Describe :setting time interrupt timer0 */
/**********************************************************************/
void timer0 (void) interrupt 1 using 0 //定时器T0
{
count++; //每过250us,cnt加一
if(count==400) //250*400=0.1s
{
count=0;
/* P1 = 0X00 ;
Delaynms(10) ;
P1 = 0XFF ; */
csecond++;
if(csecond ==10)
{
csecond = 0;
second ++ ;
if(second ==60)
{
second = 0 ;
minit ++ ;
if(minit ==60)
{
minit = 0 ;
}
}
}
}
}
/***********************************************************************/
/* Function :Poweronflag */
/* Describe :give people a sound flag("di" ring) to know this system alive now */
/**********************************************************************/
void Poweronflag()
{
BELL = 1 ;
Delaynms(10) ;
BELL = 0 ;
Delaynms(10) ;
BELL = 1 ;
}
/* main function */
void main()
{
systeminit();
Poweronflag();
while(1)
{
Nixietubedisplay();
}
}
,
We always set mcu port in high/low level to enable some actions , but forget to set MCU port in low/high level to disable it after the action finished .
Today I modified Nixie tube display system code . The original *.hex file burn into MCU ,system worked abnormal ----after hear startflag "di-ring " the Nixie tubes disable display time data .After wrote two line codes " P0 = 0xff ; NixietubeD = 1 ; ",the issue solved .
The issue told us do not forget to set MCU in opposite level to disable some action after them finished .
/***********************************************************************/
/* */
/*Project:Nixie tube Display system */
/* Date: July 17 2011 mordify:July 25 2011 */
/* Author: Ilymtics */
/*Contact:ilymtics@msn.com */
/* */
/***********************************************************************/
#include "headfile.h"
unsigned char second ,minit ,csecond ;
unsigned int count ;
/***********************************************************************/
/* Function :Nixietubedisplay */
/* Describe :display form 0 to 9 form left Nixietube to right Nixietubes */
/**********************************************************************/
void Nixietubedisplay()
{
/*P1 = LEDrunning[csecond];// light LED every 1 minisecond ;
Delaynms(1) ;
P1 = 0xff ;
*/
NixietubeA = 0 ; // enable minit display
P0 = Nixietubecode[minit/10] ;
Delaynms(1) ;
P0 = 0xff ; //disable minit display ,miss these two lines ,the system will display abnormal
NixietubeA = 1 ;
NixietubeB = 0 ;
P0 = Nixietubecode[minit%10] ;
Delaynms(1) ;
P0 = 0xff ;
NixietubeB = 1 ;
NixietubeC = 0 ;
P0 = Nixietubecode[second/10] ;
Delaynms(1) ;
P0 = 0xff ;
NixietubeC = 1 ;
NixietubeD = 0 ;
P0 = Nixietubecode[second%10] ;
Delaynms(1) ;
P0 = 0xff ;
NixietubeD = 1 ;
}
/***********************************************************************/
/* Function :systeminit */
/* Describe :initial system setting */
/**********************************************************************/
void systeminit()
{
TMOD = 0X02 ;
TH0 = 0x19 ;
TL0 = 0x19 ;
EA = 1 ;
TR0 = 1 ;
ET0 = 1 ;
}
/***********************************************************************/
/* Function :timer0 &
nbsp; */
/* Describe :setting time interrupt timer0 */
/**********************************************************************/
void timer0 (void) interrupt 1 using 0 //定时器T0
{
count++; //每过250us,cnt加一
if(count==400) //250*400=0.1s
{
count=0;
/* P1 = 0X00 ;
Delaynms(10) ;
P1 = 0XFF ; */
csecond++;
if(csecond ==10)
{
csecond = 0;
second ++ ;
if(second ==60)
{
second = 0 ;
minit ++ ;
if(minit ==60)
{
minit = 0 ;
}
}
}
}
}
/***********************************************************************/
/* Function :Poweronflag */
/* Describe :give people a sound flag("di" ring) to know this system alive now */
/**********************************************************************/
void Poweronflag()
{
BELL = 1 ;
Delaynms(10) ;
BELL = 0 ;
Delaynms(10) ;
BELL = 1 ;
}
/* main function */
void main()
{
systeminit();
Poweronflag();
while(1)
{
Nixietubedisplay();
}
}
您可以选择一种方式赞助本站
支付宝转账赞助

支付宝扫一扫赞助
