Shop OBEX P1 Docs P2 Docs Learn Events
5 Mhz or 10 Mhz Output Expected? — Parallax Forums

5 Mhz or 10 Mhz Output Expected?

grahamreitzgrahamreitz Posts: 56
edited 2010-03-01 03:09 in Propeller 1
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000

PUB Main
  coginit(0, @main_entry, 3)       

DAT
                        org     0
main_entry        mov     dira, pin
:loop                 xor     outa, pin
                        jmp     #:loop

pin     long         |< 3



I am measuring 5Mhz on the scope (200 Mhz Tektronix) with the prop demo board. I don't always have access to a scope and was guessing the output would be 10 Mhz.

[noparse][[/noparse](4 cycles @ 80 Mhz) per instruction] * 2 instructions (xor and jmp) = 10 Mhz?

Thanks,
graham

Comments

  • BeanBean Posts: 8,129
    edited 2010-02-28 21:18
    Graham,
    The pin will TOGGLE at 10MHz which will give you a frequency of 5MHz.

    Bean

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Use BASIC on the Propeller with the speed of assembly language.

    PropBASIC thread http://forums.parallax.com/showthread.php?p=867134

    March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
    ·
  • grahamreitzgrahamreitz Posts: 56
    edited 2010-02-28 21:21
    Bean said...
    Graham,
    The pin will TOGGLE at 10MHz which will give you a frequency of 5MHz.

    Bean

    Ha! Thanks!
  • mikedivmikediv Posts: 825
    edited 2010-02-28 23:38
    Bean could you explain that a little more for me,, if the pin toggles at 10 Meg why the 5 Meg output??? is it like a sine wave and you are only seeing half of it??? Thanks
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-03-01 00:23
    One full period involves two toggles: one low-to-high; the other high-to-low.

    -Phil
  • mikedivmikediv Posts: 825
    edited 2010-03-01 01:16
    So Phil it I set my prop chip to output say 10 Meg on pin 0 and I took my scope and measured pin 0 would I only see 5 meg of the square wave I can picture the square wave but I am not grasping the 10 meg 5 out concept fully
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-03-01 01:29
    If you use the method in the OP's program, which toggles every two instructions (8 clocks, or 100 ns), the toggle frequency is 10MHz. But it takes two toggles to complete a full cycle of the square wave output, so the output frequency is half that. OTOH, if you program a counter to output 10 MHz, you will get 10 MHz.

    -Phil
  • tonyp12tonyp12 Posts: 1,951
    edited 2010-03-01 01:43
        _______         ___
       |       |       | 
    ___|       |_______|
    
       &#8593;   &#8593;   &#8593;   &#8593;   &#8593;
       xor jmp xor jmp xor 
     
     
       <---- 5mhz ---->
    
    
     
    You see that rising edge to next rising edge 
    takes two xors.
     
    

    Post Edited (tonyp12) : 3/1/2010 2:20:56 AM GMT
  • mikedivmikediv Posts: 825
    edited 2010-03-01 01:45
    Duh I get it its in how you write the program sorry sometimes it like trying to see an elephant with a microscope .. I was just focusing on something else that I was working on that was relevant
    thanks guys
  • grahamreitzgrahamreitz Posts: 56
    edited 2010-03-01 03:09
    mikediv said...
    Duh I get it its in how you write the program sorry sometimes it like trying to see an elephant with a microscope .. I was just focusing on something else that I was working on that was relevant
    thanks guys
    Don't sweat it Mike. I should know better and just got lost in some details too.
Sign In or Register to comment.