Shop OBEX P1 Docs P2 Docs Learn Events
frequency synth — Parallax Forums

frequency synth

letontonletonton Posts: 9
edited 2009-05-07 15:10 in Propeller 1
hi all
fr. synth code is fine...
but if i want to obtain more than two frequencies
??
(i tried with more cogs - no result !)

and is it possible to change the output duty cycle ?
have precise width pulses ?

Comments

  • MicrocontrolledMicrocontrolled Posts: 2,461
    edited 2009-04-20 15:00
    Are you sure that you started each cog that you tryed it on successfully?? I am not very experienced with the operation of cogs but if you did not start the cog than the program would not run correctly on it. It might just not be possible with that kind of object to create more than 2 frequencies. I am sorry if this does not help, but could you make it more clear of what you are trying to do?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Toys are microcontroled.
    Robots are microcontroled.
    I am microcontrolled.
  • letontonletonton Posts: 9
    edited 2009-04-22 15:34
    thanks
    i just want (minimum) have 4 different frequencies
    on 4 separate output pins...

    and if possible change the duty cycle of signal...
  • MicrocontrolledMicrocontrolled Posts: 2,461
    edited 2009-04-22 16:53
    This is a problem... You can try to modify the existing object in order to allow the 4 frequincies instead of 2.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Toys are microcontroled.
    Robots are microcontroled.
    I am microcontrolled.
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2009-04-22 20:18
    letonton,

    Since the counters are involved, you can only have 2 frequencies per cog, which means you need 2 cogs for your 4 frequencies. Here is some example code.

    To change the Duty Cycle, you need to make modifications to the "Synth" object and follow the Application notes for using the PWM feature of the counters.


    CON
      _clkmode = xtal1 + pll16x
      _xinfreq = 5_000_000
    
    
    Pin1 = 0 
    Pin2 = 1
    Pin3 = 2
    Pin4 = 3
    
    F1 =  300
    F2 =  500
    F3 =  700
    F4 = 1100
    
    OBJ
      Freq    : "Synth"
    
    VAR
    long    Stack1[noparse][[/noparse]20]
    long    Stack2[noparse][[/noparse]20]
    
    PUB DEMO
        cognew(One_COG, @Stack1)
        cognew(Another_COG, @Stack2)    
    
    PUB One_COG
      Freq.Synth("A", Pin1, F1)
      Freq.Synth("B", Pin2, F2)
      repeat  
          
    PUB Another_COG
      Freq.Synth("A", Pin3, F3)
      Freq.Synth("B", Pin4, F4)
      repeat  
    
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.

    Post Edited (Beau Schwabe (Parallax)) : 4/22/2009 8:24:01 PM GMT
  • letontonletonton Posts: 9
    edited 2009-05-07 15:10
    first
    thanks to beau s. for help to a propeller and
    spin beginner !

    another question

    if i want to run say some cogs, with some ready objects
    (exemple : vga text and tv text objects) mixed with
    a routine of my own (started with cognew) ?

    also
    i'd like a plot routine like this :

    plot ( x, y, color)
    where color is the pixel color value in a useful RGB form,
    (4 intensity levels are enough)

    thank you for help !
Sign In or Register to comment.