Shop OBEX P1 Docs P2 Docs Learn Events
Newbie & cogs — Parallax Forums

Newbie & cogs

Travis M. BestTravis M. Best Posts: 9
edited 2009-10-27 19:57 in Propeller 1
I am a very very green propeller user I've decided to use the propeller chip in a project and have found it not as easy as I first thought and am looking for some advice. I have two separate programs I would like to run at the same time and I believe this can be done with COGS if so can some one show me a quick example of running two programs

Thanks
Travis Best

Comments

  • LeonLeon Posts: 7,620
    edited 2009-10-27 18:34
    http://forums.parallax.com/showthread.php?p=574524

    See Example 03.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
  • Cluso99Cluso99 Posts: 18,069
    edited 2009-10-27 18:34
    For simple use, the manual has some tutorials which expand to using multiple cogs to do simple things.

    Look at the FullDuplexSerial code in the OBEX. That is actually using 2 programs. One is the driver in pasm for the serial port. The VGA driver uses multiple cogs, but is more complex.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Links to other interesting threads:

    · Home of the MultiBladeProps: TriBlade,·RamBlade,·SixBlade, website
    · Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
    · Prop Tools under Development or Completed (Index)
    · Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) ZiCog (Z80) , MoCog (6809)
    · Search the Propeller forums·(uses advanced Google search)
    My cruising website is: ·www.bluemagic.biz·· MultiBladeProp is: www.bluemagic.biz/cluso.htm
  • CounterRotatingPropsCounterRotatingProps Posts: 1,132
    edited 2009-10-27 18:37
    Welcome to the forums, Travis.

    this is indeed one of the hurdles to overcome in learning the Prop - but it's not too difficult... Leon and Cluso have lead you in the right direction... I cut my teeth on this problem using the very same files Cluso indicates.

    Plus, you will always get great assistance from the forum members!

    cheers
    -Howard

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
  • ElectricAyeElectricAye Posts: 4,561
    edited 2009-10-27 18:39
    Take a look at the COGNEW command on p. 78 of the Propeller manual. You can have your first (Main) program run as a regular SPIN program and have the COGNEW command call up your second program as a method launched into a new cog. Another way to do this would be to make an Object out of your second program and simply have your Main program call up that object.


    You can also take a look at this, especially the sections talking about Methods and Cogs....
    www.parallax.com/Portals/0/Downloads/docs/prod/prop/PELabsFunBook-v1.1.pdf

    I hope that helps,
    Mark

    Post Edited (ElectricAye) : 10/27/2009 6:46:53 PM GMT
  • MagIO2MagIO2 Posts: 2,243
    edited 2009-10-27 19:57
    Welcome Travis!

    Do you have experience with other microcontrollers? In fact it is much easier to write programs for the propeller compared to other controllers when you wanna do some different things at the same time. Because other microcontrollers use interrupts for that and you have to take care that interrupt routines don't eat up to much time. Finding bugs in that kind of programs can be a real pain.

    Prop programming is so easy, if you get aware of the differences to single core microcontrollers. And that's the first task in learning how to program the prop. Get familiar with it and it's concepts. Start with SPIN only, using all the objects you are interested in. FullDuplexSerial , TV , PWM , Servo driver ....
    In a usual microcontroller you have a good chance that the code snippets you find has to be adopted to fit into your project ... because you already use the same interrupt for something else ....
    Prop ... no problem ... just start the code in a different COG.

    Is only starts to get complex when you need more RAM or you'd need more COGs.
Sign In or Register to comment.