Home > Software engineering >  Up and down the computer
Up and down the computer

Time:10-03

I want to use vb to control the a light on single chip microcomputer, but here are the c programming with vb, is can't run, bother everybody to help, thank you
Private Sub Command1_Click ()
MSComm1. The Output="5"
End Sub

Private Sub Command2_Click ()
MSComm1. The Output="6"
End Sub

Private Sub Form_Load ()
MPort=1
MSComm1.ComIf MSComm1. PortOpen=True Then
MSComm1. PortOpen=False
MSComm1. Settings="9600, N, 8, 1", "
MSComm1. An InputMode=1
MSComm1. InBufferCount=0
MSComm1. RThreshold=1
If MSComm1. PortOpen=False Then
MSComm1. PortOpen=True
End the If
End the If
End Sub


# include
# define uchar unsigned char
# define uint unsigned int
Uchar a;
Sbit led=P1 ^ 0;
Void ser () interrupt 4
{
while(! RI);
RI=0;
A=SBUF;
}
Void main ()
{
TMOD=0 x20;
TH1=0 XFD;
TL1=0 XFD;
TR1=1;
REN=1;
SM0=0;
The SM1=1;
SCON=0 x50;
PCON=0 x00;
EA=1;
ES=1;
While (1)
{
If (a=='5')
{

Led=0;

}
}
}

CodePudding user response:

 Private Sub Command1_Click () 
MSComm1. The Output="5"
End Sub

Private Sub Command2_Click ()
MSComm1. The Output="6"
End Sub

Private Sub Form_Load ()
MPort=1
MSComm1.ComMSComm1. Settings="9600, N, 8, 1", "
MSComm1. An InputMode=1
MSComm1. InBufferCount=0
MSComm1. RThreshold=1
If MSComm1. PortOpen=False Then
MSComm1. PortOpen=True
End the If
End Sub
  • Related