Request help getting CH552 serial port working

OP (Company: CruzPro Ltd.) #7670389
Rate this post
• ▲ useful
▼ not useful

Does anyone know how to get the CH552 serial port 1 configured and working? I can get serial port 0 working but can't get serial port1 working for the life of me. I configure the serial port1 this way but get no output:

SCON1=0x70 // 8 bit FAST mode SBAUD1= 100 // 4800 BAUD with internal 24Mhz clock running

The in the main program I have the following code:

while(1) { SBUF1='A'; DlyMs(100); }

TxD1 is on P1.7 (CH552T pin#5)

Regards,

Bert van den Berg New Zealand

#7670441
Rate this post
• ▲ useful
▼ not useful
1
#include<8051.h>
2

3
__sfr __at (0xC0) SCON1;
4
__sfr __at (0xC2) SBAUD1; 
5
__sfr __at (0xC1) SBUF1;
6

7
void cout(char *c)
8
{
9
 while(*c)
10
 {
11
  SBUF1=*c;
12
  c++;
13
  for(int i=0; i<0xfff;i++){}
14
 }
15
}
16

17
void main(){
18
 SCON1=0x70;      // 8 bit FAST mode
19
 SBAUD1= (256 - 6000000 / 16 / 9600);
20

21
 while(1)
22
 {
23
  cout("Hallo Welt!\n");
24
 }
25
}
1
SBAUD1 = 256- FCPU / 16 / BAUD

Reply

A question of your own? This thread is over 2 years old. Ask it in a thread of its own – more people read along there, and it gets answered more often and sooner.

Start a new thread

A fix, an addition or feedback on this thread? Then reply here.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.