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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
09/25/09 03:16
Read: times


 
#169115 - RS232: Sending data to PC from 8051 MCU - Please help!
Hi all,

I am working on a project that uses 8051 MCU (ADuC848). The device measures 0 – 5VDC voltage from 10 channels then send to PC via RS232.

Here is the protocol the device needs to follow to exchange the data to the PC:
;-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
The host PC’s program requests information by sending simple ASCII commands, followed by carriage return (cr). The MCU replies with data, followed by “cr”.

PC’s command:		Meaning:		MCU’s reply

S1 			Status			0 or 1 or 2 with “cr”

Vn			Voltage			0-65565 (2 bytes of 16 bit ADC result) with n = channel 1 to 10
						“cr” must be sent as well. The PC’s program will ask all test result of channel 1 to 10
;-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
I have been able to set up the communication in between the ADuC848 and PC’s terminal as:

void serial_init(void)
{									//Configure UART
  T3CON = 0x83;         			//configure timer 3...
  T3FD  = 0x12;          			//...for 9600 baud
  SCON  = 0x52;
}

I use this to send ADC result to the terminal:

ADCread(); //read results from channel 1 to 10
printf("Head #1: %un",Channel1_ADC);   //display channel 1 reading on windows' terminal
printf("Head #2: %un", Channel 2_ADC); //display channel 2 reading on windows' terminal 
 

Thought I have been working with embedded software for quite sometimes but still not familiar in this RS232 communication. If it’s possible please give me any advice of how to receiving and sending data to the PC following the above protocol.

I do appreciate your time and thank you very much in advance for your help.

Thanks,
Ralf




List of 38 messages in thread
TopicAuthorDate
RS232: Sending data to PC from 8051 MCU - Please help!            01/01/70 00:00      
   What problems have you encountered?            01/01/70 00:00      
      Re: What problems have you encountered?            01/01/70 00:00      
         Q: How can I eat a whole whale?            01/01/70 00:00      
         There are examples and serial I/O tutorial information            01/01/70 00:00      
            Re: There are examples and serial I/O tutorial information            01/01/70 00:00      
               If you're using Keil            01/01/70 00:00      
               I have only seen some in assembly            01/01/70 00:00      
                  Re: RS232 discussion on Keil & 8052 website            01/01/70 00:00      
                     Hello, World!            01/01/70 00:00      
                        Re: Hello, World!            01/01/70 00:00      
                           why on earth?            01/01/70 00:00      
                           As Erik says            01/01/70 00:00      
                              Re: As Erik says            01/01/70 00:00      
                                 Just extend single-char routine            01/01/70 00:00      
                                 pseudo code            01/01/70 00:00      
                                    bufgfers            01/01/70 00:00      
                                    Re: circular bufgfers            01/01/70 00:00      
                                    Re: pseudo code            01/01/70 00:00      
                                       what is this            01/01/70 00:00      
                                          Used size            01/01/70 00:00      
                                          Can you give me any simple code, please?            01/01/70 00:00      
                                             first            01/01/70 00:00      
                                                RE: first            01/01/70 00:00      
                                                   why not directly to where you anyhow need to be eventually            01/01/70 00:00      
                                 INTSIO?            01/01/70 00:00      
   A note on using printf            01/01/70 00:00      
      How to set BAUD rate to 19200, timer 3 for ADuCxxx?            01/01/70 00:00      
      Is that OK to use printf to send data to PC like this?            01/01/70 00:00      
         Are you listening to anything that's been said here?            01/01/70 00:00      
            Re: Are you listening to anything that's been said here?            01/01/70 00:00      
               ADC read function just stop working            01/01/70 00:00      
               far better efficient and organise            01/01/70 00:00      
                  Thanks            01/01/70 00:00      
                     The trouble I have is I am running out of time            01/01/70 00:00      
                        This is what happens when you do somebody's work for them            01/01/70 00:00      
                           Re: This is what happens when you do somebody's work for the            01/01/70 00:00      
                              Then use the resources available to you!            01/01/70 00:00      

Back to Subject List