27113 IO card SHIFOUT
Hello,
I would like to use the serial feature of the 27113 IO card with the Propeller chip. How do I translate the Basic stamp code listed below?
I would like to use the serial feature of the 27113 IO card with the Propeller chip. How do I translate the Basic stamp code listed below?
' -----[ Program Code ]----------------------------------------------------
Main:
DO
GOSUB Out_595 ' Update 74HC595
DEBUG HOME, " 76543210", CR
DEBUG "RELAYS:", BIN8 index, CR ' Display Current Output States
GOSUB In_165 ' Read 74HC165
DEBUG "INPUTS:", BIN8 optos ' Display Current Input States
index = index + 1 ' Increment Counter
PAUSE 500 ' Small Delay (1/2 Second)
LOOP
STOP
' -----[ Subroutines ]-----------------------------------------------------
Out_595:
SHIFTOUT DataIO, Clock, MSBFIRST, [index]
PULSOUT HC595, 5 ' Latch Outputs
RETURN
In_165:
PULSOUT HC165, 5 ' Load Inputs
SHIFTIN DataIO, Clock, MSBPRE, [optos]
RETURN

Comments
pub out_595(dio, clock, latch, value, bits) dira[dio] := 1 ' output outa[clock] := 0 ' output/low dira[clock] := 1 outa[latch] := 0 ' output/low dira[latch] := 1 value <<= (32-bits) ' shift MSB to bit31 repeat bits outa[dio] := (value <-= 1) & %1 ' get bit (from MSB) outa[clock] := 1 ' clock it outa[clock] := 0 outa[latch] := 1 ' latch outputs outa[latch] := 0 pub in_165(dio, clock, load, bits) | tmp165 outa[load] := 0 ' load inputs dira[load] := 1 outa[load] := 1 dira[dio] := 0 ' input outa[clock] := 0 ' output/low dira[clock] := 1 tmp165 := 0 ' clear workspace repeat bits ' read n bits tmp165 := (tmp165 << 1) | ina[dio] ' get new bit outa[clock] := 1 ' blip clock outa[clock] := 0 return tmp165Got side tracked by other stuff. I'm just getting back to it. Have you made any progress?