Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Receiving data serially on port pin p1.0 in microcontroller 8051

Status
Not open for further replies.

pawan yadav

Newbie level 4
Joined
May 28, 2006
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,345
is it possible to recieve data serially on port pin p1.0 in micro controller 8051? if yes then then how much the reception will be accurate?
 

Re: serial communication in controller

You can use any 8051 pin to receive serial data .. here is an example of 8051-derivative software UART: **broken link removed** ..
As far as the "accuracy" is concerned, if you can use External Interrupt 0 or 1 pin as Rx it will be as accurate as the Rx pin, if, however, it is any general purpose I/O pin, it will depend on how frequent you ask the micro to "scan" that pin ..

Regards,
IanP
 

serial communication

if i am recieving data on port pin p1.0(8051 ) serially at baud rate 9600 bits/sec,what is the accuracy of reception?i have no other pin free on controller 8051.
 

Re: serial communication in controller

will it be a burden for the uC? i mean, if the transmission lasts for several seconds then will the uC busy processing the routine?
 

Re: serial communication in controller

I would put it this way: if this microcotroller has already a lot of things to do, this method will not work for you ..
It is exactly the opposite way around: reading P1.0 as the RX pin for 9600bps will almost entirely occupy this microcontroller and one of its timers (this timer has to be dedicated to that pin as its baud rate generator) ..

Regards,
IanP
 

Re: serial communication

Refer to the following post:


Regards,
IanP
 

Re: serial communication

dear ianp,
i think you put the wrong url... it's pointing back
 

Re: serial communication

No mate, there were two post on the same issue and they were merged (behind the scenes) by the moderators ..

Regards,
IanP
 

serial communication

Ian, Dika & Pawan ...

If I gonna use any Timer0/1 of 8031 derivative uC port-1's single pin to generate the desired baud-rate of say 9600bps without any other things to do...

1. How do I read/buffer the 8-bits of data byte by byte through one-pin (say P1.0) without knowing the control start/stop control signals in Mode-1 from RS232? Do I need to monitor for control signals/just take the data in a 8-iterative loop and buffer the same?

2. My question is same again for Writing. How do you do this?

Will you use control signals also for the connec or not?

regds..,
Abid
 

Re: serial communication

i am working on a similar kind of a problem. using xilinx edk for it. i am not able to interfce with a uart? can anyone help???
 

Re: serial communication

You must do what "real" uarts do:

1. Use the timer to generate interrupts (i.e., "raw clocks") at a frequency that is a multiple your baud rate. This will enable you to sample the serial input data bits near their centers. For example, suppose your raw clock is 16 times the baud rate. When a start bit leading edge is detected you will wait 8 raw clocks and then start the "bit clock." From that point on, the bit clock has the same frequency as the baud rate, so you get a new bit clock edge every 16 sample clocks, beginning in the middle of the detected start bit.

2. Implement what is effectively a state machine in your firmware. This is responsible for detecting the leading edge of the start bit. After the start bit is detected and the bit clock is running, you must sample a new serial input data bit on every bit clock edge. When you have all 8 (or however many data bits you are using) data bits, verify you get a valid stop bit and then transfer the byte to storage. If errors are detected during byte acquisition, discard the byte and wait for the next start bit.

Hope this helps!
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top