Shop OBEX P1 Docs P2 Docs Learn Events
Too stupid for waitpeq (in assembler)? — Parallax Forums

Too stupid for waitpeq (in assembler)?

Nick MuellerNick Mueller Posts: 815
edited 2007-04-08 17:00 in Propeller 1
Hi!

I'm a new pilot using his propeller he got 3 days ago, so sorry for that dumb question.

I'm trying to read some serial data. Therefore, I need to synchronize to the signal's clock (the device has a clock and a data line). Tried it with SPIN, but it is too slow (timing is in the 10µs-range). So I have to do it in assembler.
The assembler code is started in a new cog (works) and loops forever sampling data and signaling that new data is available.
Got it working so far that I can pass parameters and communicate with an other cog.
For debugging, I'm writing state-information with wrlong that the monitoring cog displays.

But now, I'm completely stuck (pun intended) with the waitpeq-command. It works with SPIN, but not with assembler.

Here is the line where the cog waits forever:
waitpeq 0, #1



I have also tried:
waitpeq 0, #%0001



I'm waiting for a LOW on P0. I have verified with a scope that I do get a signal (with all the highs and lows) directly at the chip.


What am I doing wrong?

Thanx,
Nick

Comments

  • BTXBTX Posts: 674
    edited 2007-04-07 23:12
    Hi Nick.
    I'm not completely good in assembler but.....

    Are you sure that P0 is an input ?
    The waitpeq in asm must be (waitpeq State, <#> Mask). The prop manual talk about 'State' like a register, did you try something like this ?

    waitpeq reg,#1

    reg long 0

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Regards.

    Alberto.
  • Paul BakerPaul Baker Posts: 6,351
    edited 2007-04-07 23:45
    Hi Nick, Alberto has spotted your problem, you were trying to use a literal value in your destination field, but that value must be contained in a register and it's pointer used as the destination.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.
  • Nick MuellerNick Mueller Posts: 815
    edited 2007-04-08 13:51
    Thanks Paul and Alberto!

    That was my mistake not using a register for the state.

    It is written in the manual. But having a short example for every instruction would have helped (even) me finding my stupid error without asking.
    Having worked 3 days with the Propeller the only thing I miss is better documentation. App-notes, how-to's, examples. Won't name competitors for reference smile.gif

    But the Propeller is such a stunning product with very new concepts that it is worth spending the extra work to find things out. And save that extra time spent in coding because code get so much more compact and simple.

    Great piece of silicon with a lot of built-in fun!

    Nick
  • BTXBTX Posts: 674
    edited 2007-04-08 16:06
    You're wellcome Nick.

    It is true, I miss a lot too, some examples or 'how to', I think many people don't need them, but for us, could be a simple solution to not waste so time.
    And more, some instructions that are not so complicated, have a lot of examples...too much....in excess... (specially talking about spin).
    I know that Parallax people are working very hard about it, just have the preliminary datasheet now, sure there are a lot of things more to do, but fans, each day, want more and more.

    PChip is the BEST !!. (It deserves this support )

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Regards.

    Alberto.
  • Nick MuellerNick Mueller Posts: 815
    edited 2007-04-08 16:49
    Roberto!

    Regarding your statement "many people don't need them", I just can say that there are different ways how people learn and work. I'm one of those who need/have patterns (AKA examples) and work more in idioms.

    But I see that the great guys at Parallax are investing time on that subject too.

    Nick
  • rjo_rjo_ Posts: 1,825
    edited 2007-04-08 16:57
    Roberto and Nick!!!

    You are "oh so correct." At one end of the spectrum... you have perfect inductive thinkers... and at the other end you have perfect deductive thinkers. And in between is a vast sea of people, who lean one way or the other. My son for instance has an autism variant, called hyperlexia... he can remember anything... give him a rule... he will remember it... but what to do with all of those rules is his major problem. He needs to see it applied in a thousand different ways. I'm sort of the opposite... give me an example, and the first thing I try to do is make a general rule out of it...

    What I am trying to do... with my version of the manual... is go to the other extreme from the User Manual... but present all of the same general material ... from the perspective of assembly language. Eventually the goal is to have information in a form that regardless of how a person's brain organizes matterial there is an entry portal available.

    I am going to try to include a little example for everything... I would very much appreciate any code snippets that you guys find useful... they have to be in assembly of course...

    Rich
  • rjo_rjo_ Posts: 1,825
    edited 2007-04-08 17:00
    By the way... this is a general problem.

    My daughter was sort of a social butterfly in high-school... and she really liked some of the kids who were struggling the most. What I found by talking to her friends was that some of the smartest kids in the school ... were flunking out. No lie.

    Rich
Sign In or Register to comment.