Click here to Skip to main content
15,885,546 members
Home / Discussions / Hardware & Devices
   

Hardware & Devices

 
AnswerRe: Dual Monitor Pin
Peter_in_27804-Dec-16 23:00
professionalPeter_in_27804-Dec-16 23:00 
QuestionProactive Backup And Restore Pin
C-P-User-321-Oct-16 14:40
C-P-User-321-Oct-16 14:40 
AnswerRe: Proactive Backup And Restore Pin
Gerry Schmitz28-Nov-16 6:08
mveGerry Schmitz28-Nov-16 6:08 
AnswerRe: Proactive Backup And Restore Pin
Johnathan Perry2-Feb-17 3:35
Johnathan Perry2-Feb-17 3:35 
GeneralRe: Proactive Backup And Restore Pin
Rahul kumar2212-Mar-17 22:08
Rahul kumar2212-Mar-17 22:08 
QuestionRaspberry Pi device driver Pin
Member 1263426529-Jul-16 4:56
Member 1263426529-Jul-16 4:56 
SuggestionRe: Raspberry Pi device driver Pin
Richard MacCutchan29-Jul-16 5:13
mveRichard MacCutchan29-Jul-16 5:13 
QuestionHow to write the program of single chip Microcomputer? Pin
Kimmy1019-Jul-16 23:45
Kimmy1019-Jul-16 23: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 4:46
professionalZurdoDev28-Nov-16 4:46 
AnswerRe: How to write the program of single chip Microcomputer? Pin
Vaclav_28-Nov-16 6:23
Vaclav_28-Nov-16 6:23 
QuestionSmart card Pin
Umesh Ippar18-Jul-16 20:05
Umesh Ippar18-Jul-16 20:05 
QuestionRemote Dev Environment Setup Pin
StampedePress21-Jun-16 16:01
StampedePress21-Jun-16 16:01 
QuestionIf there is an Access point has timestamp resolution higher than 1µs Pin
mohammed qaid20-Jun-16 0:33
mohammed qaid20-Jun-16 0:33 
QuestionUnable to install VirtualSerial2 sample driver on Target Windows 7 PC Pin
amitrkcian30-May-16 8:16
amitrkcian30-May-16 8:16 
Questionmaking use of BluetoothLEAdvertisementReceivedEventArgs Pin
__John_23-Feb-16 23:35
__John_23-Feb-16 23:35 
AnswerRe: making use of BluetoothLEAdvertisementReceivedEventArgs Pin
__John_24-Feb-16 3:46
__John_24-Feb-16 3:46 
QuestionWDM upper filter STATUS DEVICE CONFIGURATION_ERROR Pin
papagal25-Jan-16 10:10
papagal25-Jan-16 10:10 
AnswerRe: WDM upper filter STATUS DEVICE CONFIGURATION_ERROR Pin
Munchies_Matt31-Jan-16 22:07
Munchies_Matt31-Jan-16 22:07 
GeneralRe: WDM upper filter STATUS DEVICE CONFIGURATION_ERROR Pin
papagal1-Feb-16 0:19
papagal1-Feb-16 0:19 
GeneralRe: WDM upper filter STATUS DEVICE CONFIGURATION_ERROR Pin
Munchies_Matt1-Feb-16 0:23
Munchies_Matt1-Feb-16 0:23 
GeneralRe: WDM upper filter STATUS DEVICE CONFIGURATION_ERROR Pin
papagal1-Feb-16 0:36
papagal1-Feb-16 0:36 
GeneralRe: WDM upper filter STATUS DEVICE CONFIGURATION_ERROR Pin
Munchies_Matt1-Feb-16 0:40
Munchies_Matt1-Feb-16 0:40 
GeneralRe: WDM upper filter STATUS DEVICE CONFIGURATION_ERROR Pin
papagal1-Feb-16 1:47
papagal1-Feb-16 1:47 
GeneralRe: WDM upper filter STATUS DEVICE CONFIGURATION_ERROR Pin
Munchies_Matt1-Feb-16 1:55
Munchies_Matt1-Feb-16 1:55 
GeneralRe: WDM upper filter STATUS DEVICE CONFIGURATION_ERROR Pin
papagal1-Feb-16 2:00
papagal1-Feb-16 2:00 

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.