Thank you very much for your quick respons.

Here comes the whoole beguinning of my code, the rest is in progress and can absolute confuse you, so I don´t include it. I am absolut sure that the program stucks at the shiftout/shiftin-loop, and as you can see it starts and goes there very soon.
As you can see I allready included the "modedefs.bas"-file. (I tried to attache my code in a box now, but dont know how so I copy it in below).

The connected module is a Hitachi HM55B

I tried a lot of ideas, pauses, changed chiftout-commands and things.

I hope you or anyone can have some idea.

Friendly regards / Lasse




include "modedefs.bas"

DinDout var portb.6 ' P6 transceives to/from Din/Dout
Clk var portb.5 ' P5 sends pulses to HM55B's Clk
En var portb.4 ' P4 controls HM55B's /EN(ABLE)
rela var porta.0
knapp var portb.6
Reset CON %0000 ' Reset command for HM55B
Measure CON %1000 ' Start measurement command
Report CON %1100 ' Get status/axis values command
Ready CON %1100 ' 11 -> Done, 00 -> no errors
NegMask CON %1111100000000000 ' For 11-bit negative to 16-bits

x VAR Word ' x-axis data
y VAR Word ' y-axis data
s VAR byte ' Status flags
angle VAR Word ' Store angle measurement
EE VAR byte
Promangle VAR byte
btnwk VAR Byte
droj VAR byte
define shift_pauseus 100

HIGH rela
droj = %0001


goto huvud


' -----[ Subroutines ]--------------------------------------------------------
compass:
' Compass module subroutine

HIGH En: LOW En ' Send reset command to HM55B
SHIFTOUT DinDout,clk,MSBFIRST,[Reset\4] 'OBS! jag har ersatt MSBFIRST med ,1,

HIGH En: LOW En ' HM55B start measurement command
SHIFTOUT DinDout,clk,MSBFIRST,[Measure\4] 'Ersatt MSBFIRST med ,1, även här
s = 0 ' Clear previous status flags

DO ' Status flag checking loop
HIGH En: LOW En ' Measurement status command

SHIFTOUT DinDout,clk,MSBFIRST,[Report\4]
SHIFTIN DinDout,clk,MSBPOST,[Status\4] ' Get Status


LOOP UNTIL s = Ready ' Exit loop when status is ready

SHIFTIN DinDout,clk,MSBPOST,[x\11,y\11] ' Get x & y axis values

HIGH En ' Disable module

IF (y.BIT10 = 1) THEN y = y | NegMask ' Store 11-bits as signed word
IF (x.BIT10 = 1) THEN x = x | NegMask ' Repeat for other axis
return
' End subroutines-------------------------------------------------------

huvud:
DO ' Main loop

tillb1:


gosub compass ' Get x, and y values

angle = x ATN -y ' Convert x and y to brads
angle = angle */ 180 + 1 ' Convert brads to degrees