Ahhh - I see. Many thanks for that.
I am trying to convert some code from Pic Basic Pro to OShon and i'm having some trouble with bits and bytes. Can you help with this please?
Original Pic Basic Pro Code
; = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
; = = fts - 8 replacement(ctcss encoder For yaesu = =
; = = by manfred mornhinweg, may 2010 = =
; = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
'============================== Pin definitions ==============
toneout var PORTA.1
s1 var PORTB.0
s2 var PORTB.1
s3 var PORTB.2
s4 var PORTB.3
s5 var PORTA.2
s6 var PORTA.3
e var PORTA.4
'TX is fixed at MCLR
'============================ variables ======================
tnum var Byte ;tone number from radio
frec var Word ;tone frequency x 5
Define osc 20 ;trick compiler into thinking the crystal is 20mhz, To get better freq resolution.
CMCON = 7 ;Disable comparators, Enable digital functions On PORTA
'=============Main============
toneoff: If e = 0 Then Goto toneoff ;tones are disabled, just idle
tnum = s6 ;Read tone number, independent of pins
tnum = tnum < < 1
tnum = tnum + s5
tnum = tnum < < 1
tnum = tnum + s4
tnum = tnum < < 1
tnum = tnum + s3
tnum = tnum < < 1
tnum = tnum + s2
tnum = tnum < < 1
tnum = tnum + s1
tnum = tnum - 20 ;make first tone number zero
lookup2 tnum, [487, 457, 442, 427, 412, 398, 385, 372, 359, 335, 1251, 1209, 1168, 1128, 1090, 1053, 1017, 964, 931, 899, 869, 839, 811, 783, 757, 731, 706, 682, 659, 636, 615, 594, 574, 554, 536, 517, 500, 474, 442, 412, 385, 359, 335], frec
toneloop: FreqOut toneout, 0, frec
Goto toneloop
OSHON CODE - I have been messing with bits and bytes as it doesn't compile ....
Dim tnum As Byte
Dim freq As Word
Dim toneout As Bit
Dim s1 As Bit
Dim s2 As Bit
Dim s3 As Bit
Dim s4 As Bit
Dim s5 As Bit
Dim s6 As Byte
Dim e As Bit
toneout = PORTA.1
s1 = PORTB.0
s2 = PORTB.1
s3 = PORTB.2
s4 = PORTB.3
s5 = PORTA.2
s6 = PORTA.3
e = PORTA.4
'=============Main============
toneoff: If e = 0 Then Goto toneoff 'tones are disabled, just idle
tnum = s6 'Read tone number, independent of pins
tnum = ShiftLeft(tnum, 1)
tnum = tnum + s5
tnum = ShiftLeft(tnum, 1)
tnum = tnum + s4
tnum = ShiftLeft(tnum, 1)
tnum = tnum + s3
tnum = ShiftLeft(tnum, 1)
tnum = tnum + s2
tnum = ShiftLeft(tnum, 1)
tnum = tnum + s1
tnum = tnum - 20 'make first tone number zero
freq = LookUp(487, 457, 442, 427, 412, 398, 385, 372, 359, 335,
1251, 1209, 1168, 1128, 1090, 1053, 1017, 964, 931, 899,
869, 839, 811, 783, 757, 731, 706, 682, 659, 636,
615, 594, 574, 554, 536, 517, 500, 474, 442, 412,
385, 359, 335), tnum
toneloop: FreqOut toneout, freq, 0
Goto toneloop
Thanks for your help