Shop OBEX P1 Docs P2 Docs Learn Events
Simple ASM question — Parallax Forums

Simple ASM question

DarrenYDarrenY Posts: 61
edited 2007-10-10 13:18 in Propeller 1
This is gonna be easy for someone with ASM knowledge (not me!)

I want to modify FullDuplexSerialExt so that at the end of its receive loop I call a spin method to do some processing.

Is it as simple as:

jmp #spinmethod 'call spin based data processing method << INSERT THIS
jmp #receive 'byte done, receive next byte

???

Comments

  • Graham StablerGraham Stabler Posts: 2,507
    edited 2007-10-10 12:21
    You can't call spin from assembly but you could set a flag in hub ram so that the main spin program could see it and do the appropriate action. You could use wrlong for that, the address it writes to can be passed via the par parameter of the cognew for the function.

    I'm a bit confused by what you are trying to do, can't the spin program just tell the serial object to get a byte, then process it and then request another?

    Graham
  • DarrenYDarrenY Posts: 61
    edited 2007-10-10 12:32
    Good idea about using a flag.

    Basically I'm trying to save a cog.
    I'm currently doing it the way you describe, but doing it that way uses 2 cogs no? i.e. 1 for the FullDuplexSerialExt object and one for the processing.

    If I can integrate the processing into the FullDuplexSerialExt object itself I can use 1 cog to do the same thing.

    I'm reading NMEA data from a GPS. Ideally I just want to start a modified FullDuplexSerialExt and then it then goes off and reads AND decodes the incoming strings all by itself.
  • Graham StablerGraham Stabler Posts: 2,507
    edited 2007-10-10 12:35
    You are always going to need more than one cog for most applications, what happens to the received data? Can't the cog that uses the data do the processing?

    The method I suggest will not help you save a cog, you cannot have spin and assembly in the same cog (same method yes same cog no). You could code your processing in assembly perhaps but that will depend on how complex it is.

    Graham
  • DarrenYDarrenY Posts: 61
    edited 2007-10-10 12:45
    Graham Stabler said...

    The method I suggest will not help you save a cog, you cannot have spin and assembly in the same cog (same method yes same cog no). You could code your processing in assembly perhaps but that will depend on how complex it is.

    Ah nuts, I didn't realise that.

    OK, i'll stick with the 'standard' way of doing it then. I was just thinking it would be great to have a 'fire-and-forget' GPS object that I could just query data from.

    Thanks Graham.
  • Graham StablerGraham Stabler Posts: 2,507
    edited 2007-10-10 12:49
    What processing is required? Perhaps it can be done, might be a fun excersize
  • DarrenYDarrenY Posts: 61
    edited 2007-10-10 13:18
    It's really just string manipulation. Looking for start of sentence $, reading in the bytes until a LF and then decoding the substrings
Sign In or Register to comment.