Click here to Skip to main content
14,448,369 members

Hardware & Devices

 
AnswerRe: Dual Monitor Pin
Peter_in_27805-Dec-16 0:00
professionalPeter_in_27805-Dec-16 0:00 
QuestionProactive Backup And Restore Pin
C-P-User-321-Oct-16 15:40
MemberC-P-User-321-Oct-16 15:40 
AnswerRe: Proactive Backup And Restore Pin
Gerry Schmitz28-Nov-16 7:08
mveGerry Schmitz28-Nov-16 7:08 
AnswerRe: Proactive Backup And Restore Pin
Johnathan Perry2-Feb-17 4:35
MemberJohnathan Perry2-Feb-17 4:35 
GeneralRe: Proactive Backup And Restore Pin
Rahul kumar2212-Mar-17 23:08
MemberRahul kumar2212-Mar-17 23:08 
QuestionRaspberry Pi device driver Pin
Member 1263426529-Jul-16 5:56
MemberMember 1263426529-Jul-16 5:56 
SuggestionRe: Raspberry Pi device driver Pin
Richard MacCutchan29-Jul-16 6:13
communityengineerRichard MacCutchan29-Jul-16 6:13 
QuestionHow to write the program of single chip Microcomputer? Pin
Kimmy1020-Jul-16 0:45
MemberKimmy1020-Jul-16 0:45 
Hi,
In 89C51SND1C-UL digital tube selected, segment are used in P0 mouth. How to write a program. The datasheet of 89C51SND1C-UL is here http://www.kynix.com/Detail/1155480/89C51SND1C-UL.html
This is a buzzer program.The bit-choice is in P2. I want to consult if I want to change bit-choice at P0 mouth, how to change the program. I convert P2 directly into P0 mouth. It doesn't work. I'm still learning single-chip computer.

="quote">
Quote:
#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
sbit speak=P3^4;
sbit huang=P3^0;
sbit red=P3^1;
sbit sjia=P3^6;
sbit sji=P3^7;
sbit kai=P3^0;
sbit fuwei=P3^1;
sbit kais=P3^2;
uchar num,temp,shijian,shi,ge,ashi,age,aa,tt,bb,i;
uchar code table[]={0xc0,0xf9,0xa4,0xb0,0x99,
0x92,0x82,0xf8,0x80,0x90,
0x88,0x83,0xc6,0xa1,0x86,0x8e};
void delay(uint z)
{
uchar x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
void bj()
{
for(i=0;i<110;i++)
{
speak=~speak; delay(5);
}
for(i=0;i<230;i++)
{
speak=~speak; delay(2);
}
}
void keyscan()
{
if(sjia==0)
{
delay(5);
if(sjia==0)
{
shijian=shijian+1;
if(shijian==99)
{
shijian=0;
}
}
while(!sjia);
}
if(sji==0)
{
delay(5);
if(sji==0)
{
shijian=shijian-1;
if(shijian==0)
{
shijian=30;
}
}
while(!sji);
}
}
void zhuanhuan()
{
shi=shijian/10;
ge=shijian%10;
ashi=num/10;
age=num%10;
}
void sound()
{
speak=0;
}
void main()
{ huang=0;red=0;
EA=1;
TMOD=0x11;
T2CON=0x01;
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
TH1=(65536-5000)/256;
TL1=(65536-5000)%256;
TH2=(65536-50000)/256;
TL2=(65536-50000)%256;
ET0=1;
TR0=0;
ET1=1;
TR1=1;
ET2=1;
TR2=0;
IT0=1;
EX0=1;
IT1=1;
EX1=1;
aa=0;
bb=0;
shijian=30;
while(1)
{
keyscan();
}
}
void int_0() interrupt 0
{
huang=1;
TR0=1;
TR2=1;
}
void timer_0() interrupt 1
{
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
aa++;
if(aa==20)
{
aa=0;
shijian--;
if(shijian==6)
{
red=1;
huang=0;
sound();
}
if(shijian==0)
{
TR0=0;
TR2=0;
TF2=0;
}
}
}
void int_1() interrupt 2
{
shijian=30;
num=0;
TR0=0;
TR2=0;
}
void timer_1() interrupt 3
{
TH1=(65536-5000)/256;
TL1=(65536-5000)%256;
tt++;
bb++;
if(tt==5)
tt=1;
zhuanhuan();
switch(tt)
{
case 1:P2=0xf4;P0=table[shi];break;
case 2:P2=0xf8;P0=table[ge];break;
case 3:P2=0xf1;P0=table[ashi];break;
case 4:P2=0xf2;P0=table[age];break;
default : ;
}
if(bb==1)
{
bb=0;
if(shijian==5)
{
speak=~speak;
}
if(shijian==4)
{
speak=~speak;
}
if(shijian==3)
{
speak=~speak;
}
if(shijian==2)
{
speak=~speak;
}
if(shijian==1)
{
speak=~speak;
}
}

}
void timer_2() interrupt 5
{
TH2=(65536-50000)/256;
TL2=(65536-50000)%256;
P1=0xfe;
temp=P1;
temp=temp&0xf0;
while(temp!=0xf0)
{
delay(5);
temp=P1;
temp=temp&0xf0;
while(temp!=0xf0)
{
temp=P1;
TR2=0;
switch(temp)
{
case 0xee:{TR0=0;TF2=0;num=1;bj();}break;
case 0xde:{TR0=0;TF2=0;num=2;bj();}break;
case 0xbe:{TR0=0;TF2=0;num=3;bj();}break;
case 0x7e:{TR0=0;TF2=0;num=4;bj();}break;
}
while(temp!=0xf0)
{
temp=P1;
temp=temp&0xf0;
}
}
}
P1=0xfd;
temp=P1;
temp=temp&0xf0;
while(temp!=0xf0)
{
delay(5);
temp=P1;
temp=temp&0xf0;
while(temp!=0xf0)
{
temp=P1;
TR2=0;
switch(temp)
{
case 0xed:{TR0=0;TF2=0;num=5;bj();}break;
case 0xdd:{TR0=0;TF2=0;num=6;bj();}break;
case 0xbd:{TR0=0;TF2=0;num=7;bj();}break;
case 0x7d:{TR0=0;TF2=0;num=8;bj();}break;
}
while(temp!=0xf0)
{
temp=P1;
temp=temp&0xf0;
}
}
}

}

QuestionRe: How to write the program of single chip Microcomputer? Pin
ZurdoDev28-Nov-16 5:46
mveZurdoDev28-Nov-16 5:46 
AnswerRe: How to write the program of single chip Microcomputer? Pin
Vaclav_28-Nov-16 7:23
MemberVaclav_28-Nov-16 7:23 
AnswerMessage Closed Pin
2-Jul-17 17:10
MemberSarah Bishop2-Jul-17 17:10 
QuestionSmart card Pin
Umesh Ippar18-Jul-16 21:05
MemberUmesh Ippar18-Jul-16 21:05 
QuestionRemote Dev Environment Setup Pin
StampedePress21-Jun-16 17:01
MemberStampedePress21-Jun-16 17:01 
QuestionIf there is an Access point has timestamp resolution higher than 1µs Pin
mohammed qaid20-Jun-16 1:33
Membermohammed qaid20-Jun-16 1:33 
QuestionUnable to install VirtualSerial2 sample driver on Target Windows 7 PC Pin
amitrkcian30-May-16 9:16
Memberamitrkcian30-May-16 9:16 
Questionmaking use of BluetoothLEAdvertisementReceivedEventArgs Pin
__John_24-Feb-16 0:35
Member__John_24-Feb-16 0:35 
AnswerRe: making use of BluetoothLEAdvertisementReceivedEventArgs Pin
__John_24-Feb-16 4:46
Member__John_24-Feb-16 4:46 
QuestionWDM upper filter STATUS DEVICE CONFIGURATION_ERROR Pin
papagal25-Jan-16 11:10
Memberpapagal25-Jan-16 11:10 
AnswerRe: WDM upper filter STATUS DEVICE CONFIGURATION_ERROR Pin
Munchies_Matt31-Jan-16 23:07
MemberMunchies_Matt31-Jan-16 23:07 
GeneralRe: WDM upper filter STATUS DEVICE CONFIGURATION_ERROR Pin
papagal1-Feb-16 1:19
Memberpapagal1-Feb-16 1:19 
GeneralRe: WDM upper filter STATUS DEVICE CONFIGURATION_ERROR Pin
Munchies_Matt1-Feb-16 1:23
MemberMunchies_Matt1-Feb-16 1:23 
GeneralRe: WDM upper filter STATUS DEVICE CONFIGURATION_ERROR Pin
papagal1-Feb-16 1:36
Memberpapagal1-Feb-16 1:36 
GeneralRe: WDM upper filter STATUS DEVICE CONFIGURATION_ERROR Pin
Munchies_Matt1-Feb-16 1:40
MemberMunchies_Matt1-Feb-16 1:40 
GeneralRe: WDM upper filter STATUS DEVICE CONFIGURATION_ERROR Pin
papagal1-Feb-16 2:47
Memberpapagal1-Feb-16 2:47 
GeneralRe: WDM upper filter STATUS DEVICE CONFIGURATION_ERROR Pin
Munchies_Matt1-Feb-16 2:55
MemberMunchies_Matt1-Feb-16 2:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.