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
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 |
Thank you. That works well. Best Regards, Bert van den Berg New Zealand
Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
Log in with Google account
No account? Register here.