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 Serial Data

Status
Not open for further replies.

Yin-Yang

Newbie level 4
Joined
Aug 9, 2005
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,368
Hiya guys


I have been learning to carry out Serial Prepherial Interface using simple bit-banging and I need to know how to write the software that read my serial data for my 8051 chip. I was thinking of using interrupt and timer but I am not really sure. Can you please give me some hints?

::Yin-Yang::
 

All what you need is a software UART. Go to:
**broken link removed**
This application note is ready-to-go code witten for 8051 derivatives without hardware UART (87C752 ..).
You may need to rename some pins but the rest is pure 8051 code ..
Regards,
IanP
 

    Yin-Yang

    Points: 2
    Helpful Answer Positive Rating
The SPI interface can easily be implmented in software by bit-bashing. If the 8051 is going to be the master, then you do not need to use the interrupt. Simply start shifting data in/ out as you wish. The timing is not critical, as long as you do not exceed the maximum speed of any of the slaves (I find it hard to believe you could).

If the 8051 is going to be a slave, then use the external interrupt line to act as /SS. Then you need to read/ output the data right after the correct edge of the clock. Timing in this case is really critical, since the master may be very fast. And you do not output the data on the edge of the clock, but slightly after, due to software overhead. It is still very much doable, just make sure that the masters do not operate at speeds too high for the 8051.

Another solution involves the use of an actual shift register that the 8051 can read and write. The master shifts data in/out of that register and the micro reads/ writes data parallel. (This is pretty much the way SPI actually operates). Implementing it this way would create many more hardware problems, though.
 

    Yin-Yang

    Points: 2
    Helpful Answer Positive Rating
yes, if it is SPI master it is very easy to do (no timers/interrupts needed)
If it is slave we may need to have 1/2 interrupts on CLK/SS pins. As timing to output the data is critical.

Most of the cases, we will be doing only master interfaces to transfer data with slave devices like ADC/EEPROMS etc.


Cheers
 

    Yin-Yang

    Points: 2
    Helpful Answer Positive Rating
Hiya IanP and guys

Thank you for your information but I prefer C language for me to understand the software UART to assembly language. Please remember I have been learning to use AT89C52 for few months so I am not familiar with bit-bashing. Do you have the bit-bashing software with you?

Yin-Yang
 

Almost every microcontroller (versions) has a Hardware UART. All you need to do is set up the right parameters like Baud Rate and Parity Bits.etc. and have a C Program to catch the data and display/store it on your PC. You can use Hyper Terminal too.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top