Home > other >  stc8a8k64s412
stc8a8k64s412

Time:09-24

Could you tell me why I use the oscilloscope measurement serial port 2 the sender no waveform is high level make for a long time didn't find out why feel code also do not have what problem please help me to look at thank you
The following is the code:
# include "stc8A8K. H"
# define LED_ADDR 0 x80c0
# define FOSC 24000000
# define BAUD 9600
# define BRT (65536 - (FOSC/4/BAUD))
Unsigned char flag;
Unsigned char ReData;
Unsigned char SenData;
Code \ []={XFD 0 xfe, 0, 0 XFB, 0 xf7, 0 xef, 0 XDF, 0 XBF, 0 x7f};

Void Uart_Check ()
{
S2BUF=0 x55;
While (S2CON & amp; S2TI==0);
LED_ADDR) * ((unsigned char xdata *)=0 x01; S2CON & amp;=~ S2TI;
}
Void main ()
{
S2CON=0 x50; T2L=BRT;
T2H=BRT> 8;
EA=1;
AUXR=0 x14;
IE2=0 x01; While (1)
{Uart_Check (); Delay (500);
}
}
Void Uart2 () interrupt 8 using 1
{if (S2CON & amp; S2RI) {ReData=https://bbs.csdn.net/topics/S2BUF; LED_ADDR) * ((unsigned char xdata *)=0 x00;
//flag=1; S2CON & amp;=~ S2RI; }

CodePudding user response:

Delay (500), where the code is?

CodePudding user response:

reference 1st floor yishumei response:
delay (500), the code?
void delay (unsigned int m)
{
Int a=0, b=0;
For (a=0; a<500; +)
For (b=0; B}

CodePudding user response:

reference 1st floor yishumei response:
delay (500), the code?
I think he said TXD serial chip manual need to be configured to push pull output but I can't be configured with
P4M0=0 x04;
P4M1=0 x00;

CodePudding user response:

reference Little_sugar reply: 3/f
Quote: refer to 1st floor yishumei response:
delay (500), the code?
I think he said TXD serial chip manual need to be configured to push pull output but I can't be configured with
P4M0=0 x04;
P4M1=0 x00;

Programs may die in function Uart_Check () this while (S2CON & amp; S2TI==0),
S2TI is a register, if the serial port 2 is not received data, it is no doubt S2RI 1, then S2CON & amp; S2TI constant is zero,

CodePudding user response:

reference 4 floor yishumei response:
Quote: reference Little_sugar reply: 3/f

Quote: refer to 1st floor yishumei response:
delay (500), the code?
I think he said TXD serial chip manual need to be configured to push pull output but I can't be configured with
P4M0=0 x04;
P4M1=0 x00;

Programs may die in function Uart_Check () this while (S2CON & amp; S2TI==0),
S2TI is a register, if the serial port 2 is not received data, it is no doubt S2RI 1, then S2CON & amp; S2TI constant 0,
but when I was single step debugging is TI can be reset didn't die in the and so on

CodePudding user response:

There should be no configuration serial clock

CodePudding user response:

refer to 6th floor worldy response:
there should be no configuration serial clock
serial port using the timer 2?? The initial value setting and opened the ah
  • Related