PDA

View Full Version : Testing DIRA



inaki
02-04-2007, 10:17 PM
I am trying a simple test with DIRA register in ASM but it seems to·fail.
I am trying to test PIN2 direction status, but I get always zero, despite it is changing in·a Spin routine from 1 to 0 periodically.

My code in the Spin routine does the following:

dira[2]~~ 'change PIN2 to OUTPUT
MyRoutine
dira[2]~·· 'change PIN2 to INPUT
etc,etc

this routine is called in a loop.

In a separate COG, there is an ASM code that performs the following tests:

MyCheck
······················· test mask, dira wz
······················· if_z jmp #MyCheck······ 'while pin2 is not an·INPUT·it waits
mask LONG %100

I get always zero,·so the loop continues forever.
Any explanation for this ? Am I·missing anything obvious ? :-(








▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

Mike Green
02-04-2007, 10:46 PM
Each cog has a separate direction and output register. There is logic on the chip to make sure these don't interfere with each other. Look at the diagram at the bottom of the main Propeller page. It shows you how this works.