Shop OBEX P1 Docs P2 Docs Learn Events
Time := CNT Issues — Parallax Forums

Time := CNT Issues

bbakerbbaker Posts: 16
edited 2008-03-18 08:53 in Propeller 1
I star a new COG, PUB XXXXX | Time

Time := CNT
Waitcnt (time += 100_000)
(ADDITIONAL CODE)

This WORKS

Then I start a new COG, PUB ZZZZZZZ | Time

Time := CNT
Waitcnt (Time += 100_000)
(ADDITIONAL CODE)

This does not work


SO I changed the varible Time to TimeA....
PUB ZZZZZZZ | TimeA

Time := CNT
Waitcnt (Time += 100_000)
(ADDITIONAL CODE)

This did not Work
So for testing a qiut using the TimeA and just...
Waitcnt (100_000 +cnt)

This Works....BUT

The first COG Time quit working. I can't get it to work at all. I have even deleted the code from the second COG and Rem the code to start the second COG

I have had this problem sever times before.

Anyone have any ideas what I am doing wrong

Thanks

Comments

  • RaymanRayman Posts: 14,162
    edited 2008-03-17 00:48
    Code looks okay. So, I would think it's another stack space issue... How much stack space did you give to each of these new cogs?
  • Chuck RiceChuck Rice Posts: 210
    edited 2008-03-17 01:57
    100_000 is not a long time. WAITCNT does an EQUAL test. If the time you are testing has already passed, it will wait forever (not really forever, it will wait till the CNT counter counts over the max count, to zero, and back around again, but it is a long enough time that is seems like forever!)

    Try adding an if test to compare the TIME variable with the CNT. -Chuck-
  • JavalinJavalin Posts: 892
    edited 2008-03-18 08:53
    SO I changed the varible Time to TimeA....
    PUB ZZZZZZZ | TimeA 
     
    Time := CNT
    Waitcnt (Time += 100_000)
    (ADDITIONAL CODE)
    
    

    Shouldn't that be:

    SO I changed the varible Time to TimeA....
    PUB ZZZZZZZ | TimeA 
     
    [b]TimeA[/b] := CNT
    Waitcnt ([b]TimeA[/b] += 100_000)
    (ADDITIONAL CODE)
    
    

    ??

    I agree with Bean 100_000 is short - just over 1ms.· Try using "+= clkfreq/2" for 500ms

    J

    Post Edited (Javalin) : 3/18/2008 1:21:35 PM GMT
Sign In or Register to comment.