大家好,图我就不介绍了,大家一看就明白。在下写了段程序,运行结果是RC0、RC1始终是低电平,这样对应的两个数码管一直
是显示的,总是找不出原因,很苦恼,哪位高手帮我分析下,多谢了!
程序如下:
#include <pic.h>
#include "myfuncs.h"
#include "seg74.h"
const char Seg7TableC[]={0x33,0x7b,0x2f,0x2b,0x63,0xa3,0xa3,0x3b,0x23,0x23};
const char Seg7TableB[]={0xa0,0xf0,0xa0,0xb0,0xf0,0xb0,0xa0,0xf0,0xa0,0xb0};
void DisplayData(unsigned int iData)
{
char NumStr[5];
NumStr[1]=iData/1000;
NumStr[2]=(iData%1000)/100;
NumStr[3]=(iData%100)/10;
NumStr[4]=iData%10;
RC5=0;
RC1=1;
RB7=1;
RC0=1;
PORTC=(PORTC&0x23)|(Seg7TableC[NumStr[1]]&0xdc);
PORTB=(PORTB&0x8f)|(Seg7TableB[NumStr[1]]&0x50);
delayms(5);
RC5=1;
RC1=0;
RB7=1;
RC0=1;
PORTC=(PORTC&0x23)|(Seg7TableC[NumStr[2]]&0xdc);
PORTB=((PORTB&0x8f)|(Seg7TableB[NumStr[2]]&0x50))&0b11011111;
delayms(5);
RC5=1;
RC1=1;
RB7=0;
RC0=1;
PORTC=(PORTC&0x23)|(Seg7TableC[NumStr[3]]&0xdc);
PORTB=(PORTB&0x8f)|(Seg7TableB[NumStr[3]]&0x50);
delayms(5);
RC5=1;
RC1=1;
RB7=1;
RC0=0;
PORTC=(PORTC&0x23)|(Seg7TableC[NumStr[4]]&0xdc);
PORTB=(PORTB&0x8f)|(Seg7TableB[NumStr[4]]&0x50);
delayms(5);
}
|