This code will explain better what I am trying to do (hopefully)
Code:
Function rtty_txtbyte(chr As Byte) As Byte
Lcdcmdout LcdLine1Pos(1)
Lcdout "Char = " chr
Call rtty_txbit(0) 'start Bit
'send bits For For char lsb first
For j = 0 To 7 'change this here 7 Or 8 For ascii-7 / ascii-8
Lcdcmdout LcdLine3Pos(1)
Lcdout "Bit = " chr(j)
If chr.0 Then
Call rtty_txbit(1)
Else
Call rtty_txbit(0)
Endif
chr = ShiftRight(chr, 1)
Next j
Call rtty_txbit(1) 'stop Bit
Call rtty_txbit(1) 'stop Bit
End Function
I am displaying the letter as it arrives from the lookup on line 1 and then I want to display th eindividual bits of the letter on line 3 from the j loop.
Function pow(x1 As Byte, t As Byte) As Byte
Dim x2 As Byte
t = LookUp(1, 2, 4, 8, 16, 32, 64, 128), t
x2 = x1 And t
pow = 0x31
If x2 = 0 Then pow = 0x30
End Function
High thanks for that - couldn't get it to work properly so decided to do this ...
Code:
Function convert_char(chr As Byte) As Byte
Lcdcmdout LcdLine1Pos(pos)
Lcdout chr
Call rtty_txbit(0) 'start Bit
For j = 0 To 7 'ascii-7 / ascii-8
'Lcdcmdout LcdLine3Pos(1)
'Lcdout "Bit ", #j,
If chr.0 Then
'Lcdcmdout LcdLine3Pos(8)
'Lcdout "= HIGH" ' -- Use the scope to see this is true!
Call rtty_txbit(1)
Else
'Lcdcmdout LcdLine3Pos(8)
'Lcdout "= LOW "
Call rtty_txbit(0)
Endif
chr = ShiftRight(chr, 1)
Next j
Call rtty_txbit(1) 'stop Bit
Call rtty_txbit(1) 'stop Bit
End Function
tracing it on the built in scope I can then confirm that R = 01010010 which is correct so I know at least i'm send the characters correctly. A bit heath robinson but it worked