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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/22/05 15:31
Read: times


 
#104001 - confusion
Responding to: ???'s previous message
Imtiaz,

I don't quite understand your questions - you seem trying to apply your PC experience to 8051, am I right? So let's constrict ourselves only to the '51.

As for the '51 side, you need to:

  • establish a baudrate generator (usually setting timer1 into 8-bit autoreload mode (see TCON) with a proper reload value (in TH1); in '52 timer2 can be used and there are also derivatives with independent baudrate generators - but timer1 will always work); see Keil's baudrate calculator (Andy will be kind to provide the link) and the appropriate chapter in the "bible" or the tutorial (see also the SMOD bit in PCON); don't forget to start the timer (setb tr1)
  • set the UART usually into mode 2, with receiver enabled (see SCON, typical value is 50h)
  • UART setup finished (unless you want to do interrupt-driven comms, but let that be the second step). Now if you want to transmit a byte, put it into SBUF and wait until TI is set, then clear TI. If you expect a byte to be received, wait until RI is set, then you can read out the byte from SBUF and clear RI.

By now, the paulmon software does all this for you at startup. If you plan to write your own application, you should do it yourself (even if you are using paulmon to start it so it is already set up somehow -> later you might want to use your application without paulmon and then you will run into trouble).

Erik will be kind to give a link to the "bible". Meantime, you can read the faq and tutorials for serial communication by clicking to the appropriate link in the column on the left <----.


Jan Waclawek


List of 5 messages in thread
TopicAuthorDate
Serial Port Configuration            01/01/70 00:00      
   Off-Topic            01/01/70 00:00      
   confusion            01/01/70 00:00      
   My apologies            01/01/70 00:00      
      You've got it!            01/01/70 00:00      

Back to Subject List