Output on a bit condition
Hi again!
I'm making a sort of polling and i have to make a pin high if a bit of a variable is 1 or i have to make the same pin low if the bit of a varialbe is 0.
bytetest····· var byte
dataout······ var rb.0
.....
dataout=bytetest.7· (the MSB of bytetest)
but it seems to not work...
i have also use "IF"·
If bytetest.7=1 then high dataout··· (it doesn't work the same)
it is a stupid .... but i'm going crazy.
Can anybody help me?
Alessandro (italy)
I'm making a sort of polling and i have to make a pin high if a bit of a variable is 1 or i have to make the same pin low if the bit of a varialbe is 0.
bytetest····· var byte
dataout······ var rb.0
.....
dataout=bytetest.7· (the MSB of bytetest)
but it seems to not work...
i have also use "IF"·
If bytetest.7=1 then high dataout··· (it doesn't work the same)
it is a stupid .... but i'm going crazy.
Can anybody help me?
Alessandro (italy)
Comments
... then it will follow the selected bit of your test byte. You didn't post the whole program so I'm guessing that RB.0 was not made an output hence you were not able to see anything (externally) that was written to the RB.0 output register.
i was able to see if i wrote "high DataOut" with this i read a 1 on my oscilloscope.
Thanks....
you are GREAT!
Alessandro
I'm doing a polling on a bit and when i read an external clock i have to make an output...
the comments are in italian, but if you need i can traslate.
it is not the complete program but i have to debug in small piece...
' =========================================================================
'
'·· File...... TEMPLATE.SXB
'·· Purpose... SX/B Programming Template
'·· Author....·
'·· E-mail....·
'·· Started...
'·· Updated...
'
' =========================================================================
'
' Program Description
'
'
' Device Settings
'
DEVICE········· SX28, OSC4MHZ, TURBO, STACKX, OPTIONX
FREQ··········· 4_000_000
'
' IO Pins
'
'
waitbit··var ·rc.0
ackbit··var·rc.1
data_inout·pin·rc.6
clock_in·pin·rc.7
Rx1byte··var ·byte
' =========================================================================
· PROGRAM Start
' =========================================================================
Start:
Rx1byte=%10000000
watch Rx1byte
Main:
· high waitbit·'dico alla Bs2 che i dati sono pronti
pauseus 100
·low waitbit
attesa_invio1_clk_alto:
if ackbit=0 then goto attesa_invio1_clk_alto·'aspetto il bit di conferma di inizio ricezione
attesa_invio1_clk_alto7:
if clock_in=0 then goto attesa_invio1_clk_alto7
'high data_inout···· <
this instead works fine... but i don't need a static output
data_inout=Rx1byte.7 <
it in particolar doesn't work even with "pin" definition
attesa_invio1_clk_basso7:
if clock_in=1 then goto attesa_invio1_clk_basso7
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
attesa_invio1_clk_alto6:
if clock_in=0 then goto attesa_invio1_clk_alto6
data_inout=1
attesa_invio1_clk_basso6:
if clock_in=1 then goto attesa_invio1_clk_basso6
break
Thanks
Alessandro (italy)