Previous in Forum: How To Design A Good Sound Speaker For A Big Church   Next in Forum: want to know about sensor output
Close
Close
Close
7 comments
Rate Comments: Nested
Commentator

Join Date: Sep 2010
Posts: 67

Programming 89c51 Using Keil C

06/07/2011 9:08 AM

Hi,

I need to convert the serial 12 bit data into parallel 12 bit using the 89c51 IC. presently iam using p3.0(RXD pin) as input pin, i.e, iam giving my 12bit serial data to pin p3.0 and have to convert it into parallel data using 89c51...

Can anyone give me suggestion how can i do it please...

Thanks...

Register to Reply
Interested in this topic? By joining CR4 you can "subscribe" to
this discussion and receive notification when new comments are added.

Good Answers:

These comments received enough positive votes to make them "good answers".
Guru
United Kingdom - Member - Not a New Member Hobbies - Musician - New Member Hobbies - Fishing - New Member

Join Date: May 2006
Location: Reading, Berkshire, UK. Going under cover.
Posts: 9684
Good Answers: 468
#1

Re: Need help in programming for 89c51 using keil C

06/07/2011 9:26 AM

Is it asynchronous (like e.g. RS232) or is there a clock or data strobe signal?

__________________
"Love justice, you who rule the world" - Dante Alighieri
Register to Reply
Commentator

Join Date: Sep 2010
Posts: 67
#2
In reply to #1

Re: Need help in programming for 89c51 using keil C

06/07/2011 9:34 AM

Actually i get that 12 bit serial data from the MAX187 IC(ADC)...

Register to Reply
Guru
United Kingdom - Member - Not a New Member Hobbies - Musician - New Member Hobbies - Fishing - New Member

Join Date: May 2006
Location: Reading, Berkshire, UK. Going under cover.
Posts: 9684
Good Answers: 468
#3
In reply to #2

Re: Need help in programming for 89c51 using keil C

06/07/2011 10:44 AM

Where exactly is your problem?

__________________
"Love justice, you who rule the world" - Dante Alighieri
Register to Reply
Commentator

Join Date: Sep 2010
Posts: 67
#4
In reply to #3

Re: Need help in programming for 89c51 using keil C

06/07/2011 10:52 AM

In converting that serial 12bit data in parallel...

Register to Reply
3
Guru
United Kingdom - Member - Not a New Member Hobbies - Musician - New Member Hobbies - Fishing - New Member

Join Date: May 2006
Location: Reading, Berkshire, UK. Going under cover.
Posts: 9684
Good Answers: 468
#5
In reply to #4

Re: Need help in programming for 89c51 using keil C

06/07/2011 11:29 AM

Assuming the data comes MSB first:

  1. Clear result
  2. Do whatever the MAX187 datasheet tells you to do to prepare for data transfer
  3. Do whatever the MAX187 datasheet tells you to do to the SCLK to read a databit
  4. result = result x 2
  5. If databit = 1, add 1 to result
  6. Repeat from 3 until you've read all 12 data bits.

In C, it's probably more elegant to use shift and or at steps 4 and 5, tho' it comes to the same thing.

__________________
"Love justice, you who rule the world" - Dante Alighieri
Register to Reply Good Answer (Score 3)
Commentator

Join Date: Sep 2010
Posts: 67
#6
In reply to #5

Re: Need help in programming for 89c51 using keil C

06/07/2011 11:35 AM

Iam getting serial output data from MAX187 correctly. But i have to convert this serial data into parallel data...

Register to Reply
Guru
United Kingdom - Member - Not a New Member Hobbies - Musician - New Member Hobbies - Fishing - New Member

Join Date: May 2006
Location: Reading, Berkshire, UK. Going under cover.
Posts: 9684
Good Answers: 468
#7
In reply to #6

Re: Need help in programming for 89c51 using keil C

06/07/2011 11:43 AM

Just code up the steps I gave you into C. It describes the algorithm for serial to parallel conversion.

__________________
"Love justice, you who rule the world" - Dante Alighieri
Register to Reply
Register to Reply 7 comments

Good Answers:

These comments received enough positive votes to make them "good answers".

Previous in Forum: How To Design A Good Sound Speaker For A Big Church   Next in Forum: want to know about sensor output

Advertisement