Difficulty with WAITPNE
Wurlitzer
Posts: 237
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.
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
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.
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.
·
Thanks for taking the time to look at the code.
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.