This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Using Max232 and sending info to terminial

I have written a simple A/D program to output details to P4 and a seven seg display attached to Port 5. I wish to transmit this information via the RS232 to the terminal emulator (Hypertermial)but I am having problems with the code to set up the UART. So far I have the following working sections in the program (A/D conversion, Binary - BCD)

This is the code I have so far added to attempt the transmission via RS232

void initialise_serial0_for_baudrate()
{
	BD = 1;		//Enable Baud Rate Generator
	PCON = 0x80;  	//Set SMOD to double baudrate
	T1 = 1;		//Initially set transmitt flag
}
	

void Transmit()
{
	T1=0;		//Clear TI flag
	S0BUF = P5;	//Output information
	while(!T1) {;}	//Wait until transmit flag is set
}

The KitCON515C I am using has a 10MHz Quartz.

Any help appreciated to point me in the right direction. I am trying to send using a 9600 baud

Parents
  • At a casual glance it appears you have used T1 (T ONE) instead of TI (T I). The Transmit Interrupt bit is labeled TI. Could that be the problem?

    You may want to take a look at the HELLO example program that comes with the Keil tools in the Examples folder. This short program configures the serial port and transmits "Hello World\n".

    Jon

Reply
  • At a casual glance it appears you have used T1 (T ONE) instead of TI (T I). The Transmit Interrupt bit is labeled TI. Could that be the problem?

    You may want to take a look at the HELLO example program that comes with the Keil tools in the Examples folder. This short program configures the serial port and transmits "Hello World\n".

    Jon

Children
No data