Shop OBEX P1 Docs P2 Docs Learn Events
pasm input to output of an external clock — Parallax Forums

pasm input to output of an external clock

JkaneJkane Posts: 113
edited 2014-05-16 19:56 in Propeller 1
Hello,

I have a question

I have an external clock, 33Mhz, MX045T, which has the enable switch, I use pin 0 from the propeller to turn on the enable of the MX045T, which turns output of the external clock on and off, which works fine, so I turn the switch on for 20 us and off for 500 us and so forth and I get clocks of chucks of 33Mhz, but the problem I am having is the off time, 500us, the output which is not going thru the propeller is low, and for this project I need it to be high.

so what I did was purchase a hex inverter, and send all the data thru that, and this "kind" of works, but once in awhile, I get low's for the 500us, which messes up the device I am sending it to, the problem is the last pulse from the external clock could be high or low, and therefore the inverter sets the next 500us to high or low.

so I think what I need to do is send the output from the external clock back into the propeller, letting the 33mhz data flow thru and then making the output high during the 500us times.

so what I think should happen is: (for example)

:movedata

test would be
if enable pin high (pin 3) (then don't do anything)
input pin (pin 5 -33mhz external clock data) => output pin (pin 6 -33mhz external clock data)

if enable pin low (pin 3) then make output pin (pin 6) high and exit loop
jump to movedata

another idea would be make a 33Mhz clock with the propeller, which I have not had much luck with. I'm currently running a 6.25 Mhz crystal rather than the 5Mhz crystal, I tried NCO but could not get exactly 33Mhz which is 30ns, but I can go back and try again and this would be a better solution.

regards

Jeff

Comments

  • T ChapT Chap Posts: 4,223
    edited 2014-05-15 19:42
    Is there a way you can rephrase this a little more clearly? Any code you can post with a diagram or schematic of the concept? You say you have clocks of 33mhz but you also mention data. Kinda confusing to follow what you are trying to solve.
  • JonnyMacJonnyMac Posts: 9,105
    edited 2014-05-15 19:46
    If you can get the counter to output your desired frequency (will require manual tuning of the frqx register), that will be the cleanest way to go. You can assign the counter output to a pin and then manipulate the dira bit for that pin (I do this to send coded IR signals).
  • kwinnkwinn Posts: 8,697
    edited 2014-05-15 19:49
    Better to use a nand gate instead of an inverter. Connect the enable signal to the clock enable and one of the nand inputs and the clock to the other nand input. When the enable signal is high it will allow the clock signal to go to the output of the nand gate, when the enable is low the output from the nand gate will be high.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2014-05-15 20:32
    The enable pin on the MX045T does not turn the oscillator on and off, it simply tri-states the output. If you put a pull-down resistor on the output, it will always be low when "disabled." However, there's the issue of runty pulses. Do you care about that?

    -Phil
  • JkaneJkane Posts: 113
    edited 2014-05-15 20:44
    Kwinn,

    currently, just to make sure I understand, currently I connect the output of the external clock to the inverter ic, which inverts the signal, and the output is sent out to my device that receives it and the propeller is used to just activate the enable pin on the mx045t. there is no connection between the propeller pin, used to enable the external clock, and the output of the external clock, which allows the 33mhz data to flow thru the inverter ic (hex inverter) , so you suggest replacing the inverter ic with a nand gate ic, and sending both the enable pin (from propeller) and the external clock to the nand and the output would be high when required. (enable disabled)

    so

    external clock input| enable pin | output from external clock
    0 0 => 1
    0 1 => 1
    1 0 => 1
    1 1 => 0

    that should do it. thanks, I'll update when I get the ic.

    Jeff
  • JkaneJkane Posts: 113
    edited 2014-05-15 21:00
    Phil

    ok, yes tri-states, high low and float, I'll add a 10K pull down resistor on the output of the 33mhz clock to pull it low prior to the inverter. I'll check the pulses, from what I have seen so far they seem to be fairly accurate.

    I'll get back on what happens

    regards

    Jeff
  • JkaneJkane Posts: 113
    edited 2014-05-15 21:07
    Jon,

    Yes, tuning it is tricky, I haven't tried it since using th 6.25 Mhz crystal, before I was getting close, I think +/- a few ns, but I probably did it wrong, so I'll try again, so far there are three things I can do

    1) get an nand ic
    2) pull-down resistor of output of external clock
    3) propeller 33Mhz clock using freq register, and full control

    i'll try all three and get back

    regards

    Jeff
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2014-05-15 22:48
    Jkane wrote: »
    ...snip
    ...another idea would be make a 33Mhz clock with the propeller, which I have not had much luck with. I'm currently running a 6.25 Mhz crystal rather than the 5Mhz crystal, I tried NCO but could not get exactly 33Mhz which is 30ns, but I can go back and try again and this would be a better solution.

    If clkfreq=66MHz, the NCOburst object could generate a programmable number of complete pulses at 33MHz. It uses overlap of ctra and ctrb to so that. The output would be high when not generating pulses.


    (Sorry :innocent: I don't know where to procure an 8.25 or 4.125 MHz crystal!)
  • JkaneJkane Posts: 113
    edited 2014-05-16 15:24
    Phil,

    I tried many pull-down resistors, 27K, 10K,8K,6k,5.2K, 3K,1K and 200 ohms, but the signals did not stabilize, sometimes more interference, sometimes less, but none were as good as no resistor at all. anyway, will try the nand ic, should be here Monday.

    regards

    Jeff
  • JkaneJkane Posts: 113
    edited 2014-05-16 15:28
    Tracy,

    you can get the 8.25 at digikey, probably the 4.125, but changes the crystal will induce other timing issues,so I'm heading towards the nand ic, other things that I can try is running the input of the external clock into the propeller and the using nand gate logic to correct the output, or use a transistor to turn on the output, but odds are that that won't work. since the transistor will just be a replacement for the enable bit on the external mx045 clock.

    regard

    Jeff
  • kwinnkwinn Posts: 8,697
    edited 2014-05-16 19:56
    Yes, that's right. Here is how I would connect it. A low on the propeller pin enables the output, a high sets the output high.

    Jkane wrote: »
    Kwinn,

    currently, just to make sure I understand, currently I connect the output of the external clock to the inverter ic, which inverts the signal, and the output is sent out to my device that receives it and the propeller is used to just activate the enable pin on the mx045t. there is no connection between the propeller pin, used to enable the external clock, and the output of the external clock, which allows the 33mhz data to flow thru the inverter ic (hex inverter) , so you suggest replacing the inverter ic with a nand gate ic, and sending both the enable pin (from propeller) and the external clock to the nand and the output would be high when required. (enable disabled)

    so

    external clock input| enable pin | output from external clock
    0 0 => 1
    0 1 => 1
    1 0 => 1
    1 1 => 0

    that should do it. thanks, I'll update when I get the ic.

    Jeff
Sign In or Register to comment.