Ich habe sogar die routine ins JAL übersetzt und die geht.Leider ist der
HC597 nicht gerade leicht zu finden.Den gibt's nicht bei Reichelt und
auch nicht bei Conrad.Deswegen würde Ich mich über eine routine zum
HC165 freuen, aber wie man sie schreibt weiß ich noch nicht.
Das ist meine HC597 routine.
-- 74hc597 input expander
-- how to use:
-- The DATA pin should be set as input, all other as outputs
var volatile bit DATA is pin_c3 -- Any other I/O pin could
be used
var volatile bit CLOCK is pin_c2
var volatile bit LATCH is pin_c1
var volatile bit LOAD is pin_c0
pin_c0_direction = output
pin_c1_direction = output
pin_c2_direction = output
pin_c3_direction = input
var byte vport_c = 0
procedure hc597_receive is
var byte Var1, Var2 -- port status and counter
Var2 = 8 -- initializing counter
Latch = high -- receive pin states into input latch
asm nop
Latch = low
Load = low -- transfer the contents of input latch to SHIFT
reg
asm nop
Load = high
asm local Loop1 -- lokal label
asm Loop1:
assembler
rlf Var1,f ;rotate "Var1" one place to the left
btfss Data ;is data line = "1" ?
bcf Var1,0 ;if not, clear bit 0 in Var1
btfsc Data ;is data line = "0" ?
bsf Var1,0 ;if not, set bit 0
bsf Clock ;generate one clock
nop
bcf Clock
decfsz Var2,f ;has 8 bits been received?
end assembler
asm goto Loop1 ;if not, repeat
vport_c = Var1
end procedure