Shop OBEX P1 Docs P2 Docs Learn Events
Noobie Method Cog issues — Parallax Forums

Noobie Method Cog issues

TJHJTJHJ Posts: 243
edited 2008-03-15 20:40 in Propeller 1
Well Im back, the last bit of advice I got was awesome so thanks again.

So I cant seem to figure out why this wont work.

So my Tv out code is

''Motordisp.spin Take some Vars dump them on the screen

CON
 _clkmode = xtal1 + pll16x
 _xinfreq= 5_000_000
 
OBJ
  TV : "TV_Terminal"
VAR
  Long Stack[noparse][[/noparse]50]          'Stack space for a new cog.
  byte Cog
PUB Start(RPMin, ADVin, Count): Success  '' Start my new cog running this tv program
  Stop
  Success := (Cog := Cognew(Monitor(RPMin, ADVin, Count), @Stack) +1)
  

PUB Stop '' Free the cog

  if Cog
    cogstop(Cog~ -1)

PUB Active: YesNo  ''Check the cog is active

YesNo := Cog>0

Pub Monitor(RPMTime, Advance, Pulse)
  TV.start(12) '' Init my tv on pin 12
  Repeat                             
    TV.Str(String("The RPM is "))                       '' Print The RPM is
    TV.Dec(RPMTime)                                       '' Print Var value
    TV.Out(13)                                                 '' New line
    TV.Str(String("The Advance is "))                 '' Print The Advance is
    TV.Dec(Advance)                                        '' Print Advance Value
    TV.out(13)                                                 '' New Line
    TV.Str(String("The Crank Pulse is "))            '' Print The Crank Pulse is 
    tv.dec(Pulse)                                              '' Print Pulse Value
    Tv.out(13)                                                  '' New Line
    Waitcnt(2_000_000 + cnt)                            '' Leave the info up a moment before clearing and Refreshing
    Tv.out(0)                                                    '' Clear Screen
                                                                     '' Do it forever.... 

    




Ok so this works for the most part, When I Compile and run this program it shows up on the TV with all values showing 0, Which makes sense to me.

Here is the issue when I call the method... I get nothing

Just a simple test program to call it
Obj
Disp : "MotorDisp"
Con
Pulse = 1000
RPM = 10
Pin = 20

Pub main
 Disp.start(Pulse,RPM,pin)




It does the same thing w/ or w/o variables or constants.
I know its probably something really stupid so sorry.
But I just cant seem to figure out why.

Thank you for your time.
TJ

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-03-15 20:00
    Do you have the clock mode constants in your main file? The Spin compiler ignores them in all but the main program file.
    The TV object won't work with the default RCFAST values.
  • TJHJTJHJ Posts: 243
    edited 2008-03-15 20:40
    That would fix it, thank you so much.
Sign In or Register to comment.