We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello I have still some problems with my serial interface on the Infineon C167 controller. The original function putchar or printf won't work. I have used some hints : S0CON = 0x0011; S0BG = 0x40; /* SET BAUDRATE TO 9600 BAUD */ P3 |= 0x0400; /* SET PORT 3.10 OUTPUT LATCH (TXD) */ DP3 |= 0x0405; /* SET PORT 3.10 DIRECTION CONTROL (TXD OUTPUT) */ DP3 &= 0xF7FF; /* RESET PORT 3.11 DIRECTION CONTROL (RXD INPUT)*/ S0TBIR = 1; S0TIC = 0x80; S0RIC = 0; S0EIC = 0; S0R = 1; S0TBIR = 0; S0TIR = 0; S0TBUF = 0x31; while ( S0TIR == 0 ) { } /* S0TBIR = 0; S0TIR = 0; S0TBUF = 0x32; while ( S0TIR == 0 ) { } */ ----------------------------------------------------- If I try it for one time (code above) it worked! But not, if I try it a second time. Have someone a idea, why? Dietmar Sierk Germany
Have you tried the 'Hello World' example? If it doesn't work, it must be something to do with the receiver. In the program you are using to read the serial port check the comms settings (baudrate, number of stop bits, parity bit, flow control.)
Yes, I have tried the example "hello word", but it doesn't work. My pested code work once only, therfore I think my parameters are ok. I can't undertand, why it isn't repeatable . Dietmar Sierk
Works once You mean it sends the first byte but doesn't send the second one? If you have an oscilloscope, it would be nice to have a look at the TXD line and make shure that you get only one byte because I still think it's the problem with the receiver (PC, presumably.) The piece of code you posted works fine in the simulator. I can see no reason why it wouldn't work in the target.
"You mean it sends the first byte but doesn't send the second one? " Exact. Ich have built in a little delay between the firs and second one, now it works .. unfortunately , I don't know why... Many thanks, Dietmar
"Ich have built in a little delay between the firs and second one, now it works" Yes, that sounds like the problem lies at the receiver - it just isn't fast enough to receive characters head-to-tail. Did you do the 'scope test to see whether it was a receiver or transmitter problem?