Shop OBEX P1 Docs P2 Docs Learn Events
Stamp to Prop transistion - Axion 7” TV Sound issue and understanding multiple COGs — Parallax Forums

Stamp to Prop transistion - Axion 7” TV Sound issue and understanding multiple COGs

StampmysterStampmyster Posts: 27
edited 2011-03-03 20:56 in Propeller 1
It appears the Axion in AV mode will not allow sound, unless a solid Video signal is present?

(However, otherwise absolutely delighted with the TV!)

If I try and listen to an audio-spin example, I can hear it through head-headphones (When headphones are plugged in to the Prop), but not through the TV. (When the TV is plugged in to prop.)

However, I can play my IPOD through the TV when displaying any graphics that will provide a video signal.

Certainly a more experienced programmer could easily, run some-kind-of-video in another COG, just to allow the sound demo to be heard through the AXION TV?

But, I’m just not that knowledgeable yet, I have only read chapters 1 and most of 2, and just now seeing how to run multiple COGS and other Objects in the main program. Still struggling at exercise 5 and 6 in the tutorial.

I’m frustrated with the nomenclature, and syntax. Things appear redundant, and non-logical in many cases. I really need to get a handle on it. I feel I need to understand each and every item fully.

I know one thing, I’m not in Kansas anymore! And just like OZ, it appears magical, powerful, beautiful, and basked in color. But, each step is a challenge and very unfamiliar to me.

For example: Use Blinker1.spin this for both examples below.

{{ Blinker1.spin }}

OBJ
LED : "Output"

PUB Main
{Toggle pins at different rates, simultaneously}
LED.Start(16, 3_000_000, 10)
LED.Toggle(17, 2_000_000, 20)
Why does this work?:

{{ Output.spin }}

VAR
long Stack[9] 'Stack space for new cog

PUB Start(Pin, Delay, Count)
{{Start new toggling process in a new cog.}}

cognew(Toggle(Pin, Delay, Count), @Stack)

PUB Toggle(Pin, Delay, Count)
{{Toggle Pin, Count times with Delay clock cycles in between.}}

dira[Pin]~~ 'Set I/O pin to output direction
repeat Count 'Repeat for Count iterations
!outa[Pin] ' Toggle I/O Pin
waitcnt(Delay + cnt) ' Wait for Delay cycles


And this won’t?:

{{ Output.spin }}

VAR
long Stack[9] 'Stack space for new cog

PUB Start(Pin, Delay, Count)
{{Start new toggling process in a new cog.}}

dira[Pin]~~ 'Set I/O pin to output direction
repeat Count 'Repeat for Count iterations
!outa[Pin] ' Toggle I/O Pin
waitcnt(Delay + cnt) ' Wait for Delay cycles


PUB Toggle(Pin, Delay, Count)
{{Start new toggling process in a new cog.}}

dira[Pin]~~ 'Set I/O pin to output direction
repeat Count 'Repeat for Count iterations
!outa[Pin] ' Toggle I/O Pin
waitcnt(Delay + cnt) ' Wait for Delay cycles


In the first example the LEDS flash independently and start at the same time?

In the second example, the LEDS flash one first and when done, then the other?
Well OK, this is probably painfully obvious to many, and I thank you in advance for your tolerance of a beginner.

-Peace!
483 x 360 - 63K

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2011-03-03 20:15
    In version one, the Start call starts up a copy of Toggle in a cog, then the Start call returns (probably before the Toggle copy actually starts running), then the Main routine calls Toggle directly so you have two separate copies of Toggle running, each in its own cog simultaneously.

    In version two, the Start call directly does the toggle operation and doesn't return until all the blinking is done, then Main calls Toggle which does the same thing on a different pin. This version uses only one cog.
  • StampmysterStampmyster Posts: 27
    edited 2011-03-03 20:56
    I see! I think? Please correct me if I’m wrong.

    The calls are executed linearly and will do each task in order. The Object called is completed in it’s entirety, before the next call is executed.

    However if an object is written to be started in another COG instead, the call will load and start the object in this new cog, then return to the Main (call list) and then do the next task in line immediately.

    I suppose this would have blatantly obvious to normal people…lol.

    Thank you!
Sign In or Register to comment.