SwingeyP
Member
I have my RTTY beacon almost working. It's transmitting data. I can adjust the 'shift' and it sounds like it should - lol
My problem now is getting an accurate baud rate.
I know the key to getting the baud rate correct is timing.
Doing some background reading 50 baud should be 1/50th of a second = 20000μ seconds.
I assume this is the time between each character sent? - So can I send a character then delays 2000u seconds?
I could really do with some help with this one - I'm so close I can tatse it
Regards - Paul
My problem now is getting an accurate baud rate.
I know the key to getting the baud rate correct is timing.
Doing some background reading 50 baud should be 1/50th of a second = 20000μ seconds.
I assume this is the time between each character sent? - So can I send a character then delays 2000u seconds?
I could really do with some help with this one - I'm so close I can tatse it
Code:
'- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -
'RTTY with NTX2 Test written by paul swingewood
'March 2013 - PIC 16F628A
'Based on code developed by Rob Harrison for Arduino
'--------------------------------------------------------------------------
'Define SIMULATION_WAITMS_VALUE = 2
Define CONF_WORD = 0x3f50 'Internal Oscillator'
Define CLOCK_FREQUENCY = 4
AllDigital
'Define the comms for the LCD display.
Define LCD_LINES = 4
Define LCD_CHARS = 20
Define LCD_BITS = 4
Define LCD_DREG = PORTB
Define LCD_DBIT = 4 'Use the high order bits'
Define LCD_RSREG = PORTA
Define LCD_RSBIT = 2
Define LCD_EREG = PORTA
Define LCD_EBIT = 0
Define LCD_RWREG = PORTA
Define LCD_RWBIT = 1
Define LCD_READ_BUSY_FLAG = 1
Define LCD_COMMANDUS = 5000 'delay after LCDCMDOUT, default value is 5000
Define LCD_DATAUS = 100 'delay after LCDOUT, default value is 100
Define LCD_INITMS = 20
Define SEROUT_DELAYUS = 1000
Symbol txcr_pin = PORTA.7
Dim i As Byte 'used for loops
Dim j As Byte 'used for loops
Dim pos As Byte 'used for lcd position
Dim ch As Byte 'used to hold individual character
Dim times_sent As Byte 'used to check number of times sent before waiting
startup:
Lcdinit LcdCurBlink
Lcdcmdout LcdClear
WaitMs 100
times_sent = 0
loop:
Lcdcmdout LcdClear
For i = 0 To 15
ch = LookUp("RTTY TEST BEACON"), i
pos = i + 1
Call convert_char(ch)
Next i
If times_sent = 4 Then
WaitMs 5000
times_sent = 0
Endif
times_sent = times_sent + 1
Goto loop
End
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
Function rtty_txbit(b As Bit) As Bit
If b = 1 Then
'High
High txcr_pin
Else
'Low
Low txcr_pin
Endif
WaitUs 20000 '1/50th of a second = 50 Baud?
End Function
Regards - Paul