Shop OBEX P1 Docs P2 Docs Learn Events
Difficulty with WAITPNE — Parallax Forums

Difficulty with WAITPNE

WurlitzerWurlitzer Posts: 237
edited 2009-10-08 12:23 in Propeller 1
I seem to be unable to get my PASM program to Wait for Pin #25 to be low.

I have eliminate all other COGS from launching to avoid any DIRA overwrite issues.

Using the FullDuplex spin program I verified that Pin #25 goes high and low by displaying the value of INA in binary format.

In the code snipit below I write a value of 123 into a Circular Que during the Initialization sub routine of the PASM program in question.

Only if pin #25 goes low should I ever re-write this same memory location in the Circular Queue with a value of 124.

For some reason, I always get the value of 124 even if I jumper Pin #25 to Vcc prior to restarting the program.

I placed a scope on Pin 25 and it is sitting high with no visible noise.

'' Get the next byte from the MIDI in stream
''
mov     MidiMask, #1  
shl     MidiMask, #25 'pin 25 MIDI input
getMidiByte 
                        waitpne MidiMask,MidiMask                    ' Wait for a start bit. 
mov event_data, #124 'remove 
wrlong  event_data, EventBufferStartAddr'remove
jmp #getMidiByte'remove 

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-10-07 19:32
    It looks like your code should behave as·you describe.· The behavior that you see happening must be due to something that you're not showing.
  • WurlitzerWurlitzer Posts: 237
    edited 2009-10-07 19:54
    Thanks for looking at it Mike!

    I tried to cut out everything else by just jumping back to the getMidiByte.

    It is behaving like a DIRA has assigned it as an output someplace but that is why I cut out all the other code.

    The only thing I have not looked at was the FullDuplexSerial code but as that seems so stable for everyone I thought I could ignore it. I'll check it anyway.

    Thanks again for taking the time.
  • tonyp12tonyp12 Posts: 1,951
    edited 2009-10-07 22:51

    how do you reserve space for 'MidiMask' ?

    long·0 or just res ?

    Using res can created random issues,
    but mostly when assuming that the start value is 0 in the reserved space.






    ·
  • WurlitzerWurlitzer Posts: 237
    edited 2009-10-08 12:05
    Tonyp12, I did use res for MidiMask however, you will note that I wrote: mov MidiMask, #1 then shl MidiMask, #25 so any ambiguity of its starting value would have been removed.

    Thanks for taking the time to look at the code.
  • kuronekokuroneko Posts: 3,623
    edited 2009-10-08 12:10
    Wurlitzer said...
    Using the FullDuplex spin program I verified that Pin #25 goes high and low by displaying the value of INA in binary format.
    Out of curiosity, what did the displayed value look like?
  • WurlitzerWurlitzer Posts: 237
    edited 2009-10-08 12:23
    kuroneko, I have removed that portion of code which was used to simply verify that the chip was not faulty.

    However, I had it display 32 bits and all the other bits maintained their value, minus the target bit #25.

    Bit #25 would change from a 1 to 0 depending if I pulled the pin high or low so I am assuming the chip is operational.

    This code segment was part of a very good MIDI Serial spin program written by Tom Dimock. I had used it before but I noticed in that code, I changed how the start of data was processed. I first did a waitpeq followed by waitpne then looked for the next 8 bits rather than 9 bits in the original code. This simply discarded the start bit before looking for data bits. I don't remember why I did that but it worked. I'll try this method again later today.

    Thanks for your input.
Sign In or Register to comment.