Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/03/01 03:48
Read: times


 
#12140 - RE: Send data 16 bit via RS232
Given:

unsigned int speed[1] =1000;

in 'C', to send this via the serial port you could code the following:

void sendword(unsigned int x)
{
while(!TI); // Wait for previous sends to finish
TI = 0; // Clear Transmit flag
SBUF = x & 0xFF; // Send low byte of word
while(!TI); // Wait for byte to finish sending
TI = 0; // Clear Transmit flag
SBUF = (x & 0xFF00) >> 8; // Send high byte of word
}

Then just call the routine with

sendword(speed[1]);

Good luck.

Craig Steiner

PS--In the future please use your full real name. This is a professional forum. Thanks.


List of 7 messages in thread
TopicAuthorDate
Send data 16 bit via RS232            01/01/70 00:00      
RE: Send data 16 bit via RS232            01/01/70 00:00      
RE: Send data 16 bit via RS232            01/01/70 00:00      
RE: Send data 16 bit via RS232            01/01/70 00:00      
RE: Send data 16 bit via RS232            01/01/70 00:00      
RE: Send data 16 bit via RS232            01/01/70 00:00      
RE: Send data 16 bit via RS232            01/01/70 00:00      

Back to Subject List