If you have the inputs you want to output inverted in 'b2' then the code possibly has to be changed to -
outpinsD = b2 ^$FF
But I'm not really sure what you want. A more detailed description and what your hardware actually is may help.
Actually, I've been having trouble with the outputs not 'latching' for some time.
Please see attached schematic for the setup. The interrupt part is missing as this was going to be my next attempt...
The setup as shown works with the code shown below with the following problems:-
1) When a single input is present the relevent output goes high as expected. Condition acceptable.
2) When 2 simultaneous inputs are present both the relevent outputs do not stay high as expected. One stays high but the other stays high just fleetingly.
3) I can get both outputs to stay high if I put a pause into the sub-routine as in gosub routine cv: This is not the answer though because as soon as the pause times-out one of the outputs goes low. I need both outputs to stay high until a different input state is present.
Hippy, the reason I was asking about the inverse of the input pin states was because I thought that a hard interrupt might be the answer and I was going to incorporate that into the interrupt routine to save code space.
Am I missing something here, guys. My understanding is that as soon as an output is set high it should stay high until the program decides otherwise..... or is it that something external may be influencing the behaviour.... I'm at a loss...
Code
init:
setfreq em40
let dirsB = %11111110
let dirsD = %11111111
goto mainloop
mainloop:
b2 = pinsC
if b2 = %11111110 then gosub glockset
if b2 = %11111101 then gosub violinset
if b2 = %11111011 then gosub bourdonset
if b2 = %11110111 then gosub fluteset
if b2 = %11101111 then gosub cmelset
if b2 = %11111100 then gosub gv
if b2 = %11111010 then gosub gb
if b2 = %11110110 then gosub gf
if b2 = %11101110 then gosub gc
if b2 = %11111001 then gosub vb
if b2 = %11110101 then gosub vf
if b2 = %11101101 then gosub vc
if b2 = %11110011 then gosub bf
if b2 = %11101011 then gosub bc
if b2 = %11100111 then gosub fc
goto mainloop
glockset:
let pinsD = %00000001
return
violinset:
let pinsD = %00000010
return
bourdonset:
let pinsD = %00000100
return
fluteset:
let pinsD = %00001000
return
cmelset:
let pinsD = %00010000
return
gv:
let pinsD= %00000011
pause 1000
return
gb:
let pinsD= %00000101
return
gf:
let pinsD= %00001001
return
gc:
let pinsD= %00010001
return
vb:
let pinsD= %00000110
return
vf:
let pinsD= %00001010
return
vc:
let pinsD= %00010010
return
bf:
let pinsD =%0001100
return
bc:
let pinsD =%00010100
return
fc:
let pinsD =%00011000
return