Shop OBEX P1 Docs P2 Docs Learn Events
Testing DIRA — Parallax Forums

Testing DIRA

inakiinaki Posts: 262
edited 2007-02-04 15:46 in Propeller 1
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[noparse][[/noparse]2]~~ 'change PIN2 to OUTPUT
MyRoutine
dira[noparse][[/noparse]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 ? :-(








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

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-02-04 15:46
    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.
Sign In or Register to comment.