Shop OBEX P1 Docs P2 Docs Learn Events
Resolved! How to collect ir pulse streams in asm? — Parallax Forums

Resolved! How to collect ir pulse streams in asm?

ratronicratronic Posts: 1,451
edited 2007-09-17 21:40 in Propeller 1
The code that is attached does work , but the seven bit·data stream, the way I am collecting it, is inverted and I have to·xor it for proper display. I have been looking in the prop manuel but I can't see any thing there that would let me·collect them non inverted in the first place.·Am I missing something? Could one of you look at the code and tell me if there is a better way to collect the stream? And also if there is something that I should be doing different? This is just for personal education!! Thanks Dave.·

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Fix it if ain't broke·
D Rat


Dave Ratcliff· N6YEE

Post Edited (ratronic) : 9/18/2007 3:11:05 PM GMT

Comments

  • deSilvadeSilva Posts: 2,967
    edited 2007-09-17 20:24
    Some remarks:
    (1) All special registers are zero when a COG starts, so you need not clear pin0.
    If complex I/O settings must be used just define a LONG and move it onto DIRA. I suspect you do not want to disturb other COGs... Never mind! DIRA is your own personal copy! only a "1" is valid and "written through"

    (2) You should write sub t2, t1 rather than subs t2, t1 to be more clear in what you do; however SUBS performs the same computation as SUB, just the carry is set differently and you do not use it...

    (3) For the same reason CMPS is more confusing than CMP in this context, but will work of course..

    (4)
        if_c      jmp #loop2
                  jmp #loop1
    loop2
    

    is generally coded as:
        if_nc      jmp #loop1
    



    (4) This looks very strange:
        if_c      rcr rn, #1
        if_nc     rcr rn, #1
    



    (5) You shift a bit (=carry) whenever a pulse is between 32_000 and 64_000 ticks. When you change the parameters of CMPS the carry will be set, when the pulse is >64_000 ticks - that simple! So just:
                  CMP d, t2  wc
                  RCR rn, #1
    


    will do the trick - I think smile.gif

    Post Edited (deSilva) : 9/17/2007 8:29:33 PM GMT
  • ratronicratronic Posts: 1,451
    edited 2007-09-17 20:32
    That's what I did!! I had the compare backwards. I just went brain dead and could not see it!! Thank you very much for all of your help Desilva!!!

    Dave.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Fix it if ain't broke·
    D Rat


    Dave Ratcliff· N6YEE
  • ratronicratronic Posts: 1,451
    edited 2007-09-17 21:40
    Here is the code with all of Desilva's points put in and taken out.·· Dave.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Fix it if ain't broke·
    D Rat


    Dave Ratcliff· N6YEE
Sign In or Register to comment.