feeding a square wave

Discussion in 'The Projects Forum' started by kahafeez, Dec 7, 2008.

  1. kahafeez

    Thread Starter Active Member

    Dec 2, 2008
    150
    0
    Hi. i need to feed the demodulated data to an 8051 to its RxD pin. bt the demodulated output is not like a signal an 8051 would recieve bcz

    1. the demod signal has two voltage levels. a positive(400mV) and a negative(-600mV). while to my knowledge i'll have to shape to a signal which only has a positive level of 5V and the negative level should be clipped to 0V.


    2. the demod data has also reduced the duty cycle. the negative level is smaller and the upper's spans more. so i need to make the duty cycle 50%.


    how do i do this? plz help. thanks.
     
  2. mik3

    Senior Member

    Feb 4, 2008
    4,846
    63
    You can use an op amp, connected as an inverting amplifier, to clamp the voltage only to positive values. Bias its non-inverting input with 700mV (use a resistor voltage divider) and apply your signal to its inverting input. The duty cycle depends on the circuit which generates this signal. Can you post s schematic of it?
     
  3. kahafeez

    Thread Starter Active Member

    Dec 2, 2008
    150
    0
    thanks pdi33. i tried a solution bt it didnt work

    here are the results. plz take a look and suggest wat is wrong.

    abt the duty cycle. actually the demodulation of an FSK signal is done using PLL(Phase Locked Loop).... and the PLL's output is a sqaure wave with the negative part a bit less lengthy than the positive part. so i think the 8051 wont accept a signal with 60% positive halves...
     
  4. Wendy

    Moderator

    Mar 24, 2008
    20,766
    2,536
    Guess I have to bite (which is why I haven't jumped in yet), what is the 8051 RXD pin? What are you trying to accomplish?
     
    Last edited: Dec 7, 2008
  5. kahafeez

    Thread Starter Active Member

    Dec 2, 2008
    150
    0
    the RxD pin is the 10th pin or P3.0th pin of an 8051 from which it receives serial data.

    the TxD pin is the 11th pin which transmits data serially. anyway forget abt TxD and RxD. just help me abt shaping a 400mV to -600mV square wave to a 5V to 0V square wave? i knw the amplification pert. just need to know how to clamp
     
  6. Wendy

    Moderator

    Mar 24, 2008
    20,766
    2,536
  7. kahafeez

    Thread Starter Active Member

    Dec 2, 2008
    150
    0
    the freq is around 4.8Kbps of the square wave
     
  8. Papabravo

    Expert

    Feb 24, 2006
    10,179
    1,800
    The RxD pin is connected to a UART. Your data doesn't look like anything like the data that a UART is designed to handle. Your problem is making an assumption without the knowledge to back up the assumptions. The UART in an 8051 is usually designed to accept asyncronous data in a 10-bit or 11-bit frame. There is a syncronous mode, but it works at fixed frequencies with respect to the system clock.

    It would help if you can tell us which manufacturer and part number 8051 you are using. What is the frequency of the oscillator? What are you trying to do with the data?
     
  9. kahafeez

    Thread Starter Active Member

    Dec 2, 2008
    150
    0
    actually i'm using an Atmel's 8051. the idea is controlling a motor at a distance through a remote. two 8051's connect to each other at 4.8Kbps with an osc of 11.0592MHz. i'm now actually trying to make a wireless link between the two uC. i've done FSK modulation. and the data is demodulated using PLL. the PLL's output is bipolar(a +ve level and a -ve level) i want just a square wave of 0 to 5V.

    i havent used the RS232 standard/ RC5 protocol. bt may be it itself is using it m not sure. but i think only a byte or 8 bits is transfered as i've sent an 0x55 from the transmitter.
     
  10. Papabravo

    Expert

    Feb 24, 2006
    10,179
    1,800
    Atmel makes a great variety of 8051 parts. Some are exactly compatible with the original 8051 designed by Intel. Many of them have enhanced features which makes it difficult to offer general advice without a specific part number. With a specific part number I can download a data sheet and offer specific suggestions.

    In as much as you are sending "square waves" back and forth is it essential that you use the RxD and the TxD pins? They do not seem well suited for your purpose. But then I still don't know precisely what you are trying to do or how you think using a UART will be helpful.

    It almost seems like an input capture pin that would allow you to measure frequency, duty cycle, and period might be more appropriate. What information is going back and forth between the two processors? What does the square wave represent with respect to the motor and what can you change about the "square wave" to indicate that the motor should do something different?
     
  11. kahafeez

    Thread Starter Active Member

    Dec 2, 2008
    150
    0
    actually i'm controlling two motors at the destination. two motors and four directions. motor 1 right
    motor 1 left

    motor 2 right
    motor 2 left

    so i need to send 4 different signals. i'll use any four combinations lets say 0x77, 0x92, 0x78 or 0x whatever. i just need four different signals. i'm using ATMEL's 89c51, n i'm using TxD and RxD pin as its a smart way to communicate with a uC. i do have another plan that is using anyother pins to transmit four kind of signals and then using a parallel to serial converter and at the destination using a serial to parallel converter and scanning the pins at the destination as in the case of the keypad.

    bt i'll use this scheme if my serial comm scheme fails.

    bt Bravo the point here is shaping the square wave to meet the requirement of the 89c51 RxD pin.....
     
  12. kahafeez

    Thread Starter Active Member

    Dec 2, 2008
    150
    0
    hey buddy m out of time here. catch up with u later. do reply.
     
  13. Papabravo

    Expert

    Feb 24, 2006
    10,179
    1,800
    So let me see if I understand. You have four different values that you can send. Once a motor is commanded to move it keeps moving so that each time the incoming character changes it means a new command. Is it possible to stop a motor?

    This is the datasheet for the part you are using
    http://www.atmel.com/dyn/resources/prod_documents/doc0265.pdf
    Is that correct?

    The oscillator is 11.0592 MHz. This frequency is commonly chosen when you wan't to generate serial baudrates like 300, 600, 1200, 2400, 4800, 9600, 19200 bits per second.

    A key feature of this type of communication is that although the bits within a character are syncronous, there can be an arbitrary delay between characters. The line spends a great deal of time in the "idle" state with no signals at all present.

    The next feature of this type of communication is called framing. Each character begins with a START bit which causes a transition on the line from an IDLE(MARK) state to the nonidle(SPACE) state. Following the START bit there can be 5, 6, 7, or 8 data bits, followed by an optional parity bit, followed by 1, 1 1/2, or 2 STOP bits which are always in the IDLE(MARK) state.

    I see no provisions in your square wave for any kind of framing.

    Let us start with some basic questions. Which Timer/Counter are you using for baudrate generation, and what values are you writing to those Timer/Counter registers.

    How are you configuring the UART. What values are you writing to the SCON, SMOD, and PCON registers. With this information I may be able to better advise you on your design.
     
  14. kahafeez

    Thread Starter Active Member

    Dec 2, 2008
    150
    0
    the motor will stop after 3 seconds after it receives any of the four signals. i've done that in the code.


    yes m using the same ic whose datasheet is given.


    i dont think my data is using any standards bcz i've sent 0x55. and i've also connected an oscilloscope at the TxD pin and it just gives 8 bits.

    the wave i posted in my 1st post was nt the real data i shouldnt have posted it. i just wanted to show that the kind of wave i'm getting after PLL has its upper peak long. forget the figure i posted.

    i've posted my code so that u can see the timers and scon values. thanks.
     
Loading...