50 baud ASCII output

Graham O

Member
Hello,
I'm trying to build a high altitude balloon flight computer using a 28X2 and have most of the software written. However I'm getting stuck on the output to the transmitter. I need a 50 baud data stream. I can get 50 baud via HSersetup, but that is a serial data stream with stop bits. Is there a way of stripping these off or not sending them? Alternatively, Hpisetup and "bit banging" will give me just the data stream, but not the low speed. Does anyone have any ideas please? I'm not against having another chip to do additional processing.
Any ideas would be much appreciated
Thanks

Graham
GW8RAK
 

Dippy

Moderator
Why do want to get rid of stop bits? Is it going to some special receiver?

You could bit bang the whole thing surely? Why Hpisetup?

Maybe if you explained the system then people could give you a really good solution. If it's a long description remember a picture paints a thousand words...
 

Graham O

Member
The data stream is 8 bit ASCII RTTY, which although an old amateur radio technique has good signal to noise performance and is the preferred modulation mode for high altitude balloons. Customised decoding software allows the balloon's position to be plotted on Google Earth in real time. RTTY may not be the best, but it is easy generate and decode. I'm just stuck on the slow speed requirement.

Reading the manual about Hpisetup, I see that it says "Spispeed is a constant/variable to define the clock speed". The manual then shows that spislow is clock speed/64 = 63KHz at 4MHz clock speed. But does the word variable imply that we can slow it down further with a custom term, i.e. clock speed/X ?

Thanks for any help.
 

hippy

Ex-Staff (retired)
I also thought that RTTY was normal serial, framed with start and stop bits, just running at a quite low speed, and often with 5-bits of data ( baudot code ) instead of 8-bits. I would guess 'ASCII RTTY' is using the same technique of sending but using 8-bits; highs and low bits generate two different frequency transmissions or a presence and absence of a single frequency. It is possible that data framing could be achieved by length of gap between charcters sent like morse code but I didn't think it was.

For 50 baud, taking that as 50 bits per second, that's a bit time of 20ms. Even an 08M at 4MHz will be able to generate that through bit-banging with little problem and the 28X2 can do the same.

I think we need a better definition and description of what the data out is and how it is formatted, perhaps an indication of what the data goes into when it leaves the PICAXE and what the ground station decoder expects.
 

Graham O

Member
My apologies people, I've just checked and the spec for the transmission is more tolerant than I thought and it can be 8n1. However, 8n2 is recommended to resolve timing errors. Is this possible? I seem to remember a manual stating that all serial comms are 8n1.

I have found some similar code and the output speed of Hsersetup can be set to 50 baud, but their mode value is %110. I can't find anything in the manual to describe this. Does anyone know?
 
Last edited:

hippy

Ex-Staff (retired)
8N1 is the default for PICAXE serial but 8N2 is achievable, and easily so if bit banging. It can also be achieved through adding a simple PAUSE after each character sent. For high-speed serial it can be achieved by poking various internal SFR's which I am guessing would be what you'd favour.
 

manuka

Senior Member
GrahamO:I'd assume at least temperature & altitude etc sent over simplex VHF/UHF, but it'd help if you detailed just what you're monitoring, and the data link RF frequency. Given your slow baud rates, other encoding techniques with superior weak signal performance ( DTMF and Hellschrieber etc) spring to mind. Decoding these is a piece of cake with PC software. Stan ( ZL2APS)
 

Graham O

Member
eclectic, thanks, I have seen his post and have pm'ed him. However the published spec for the tracking software can accommodate a range of data formats and I think the problem may have been solved. I'm hoping to get things tested today and will report back.
Thanks for everyones help.
 

vttom

Senior Member
Any reason you can't just do:

Code:
xmit_at_50_baud:

' Assumptions:
' - b0 contains the data to send
' - pin1 is the output pin

' Start bit
low 1

' 8 bits of data, LSB fist
for b1 = 0 to 7

  ' May need to invert data?
  pin1 = bit0
  b0 = b0 / 2

  ' Probably needs to be tweaked to account for
  ' execution time of divide and loop increment/test
  pause 20

next b1

' 2 stop bits
high 1
pause 40

' Done
return
??
 

Graham O

Member
Any reason you can't just do:

Code:
Snipped
??
I'm hoping that I won't have to set up pause times to allow for execution. For this application, at least one person has used 1 stop bit, in which case the output is quite simple. But as I've been working on this over the weekend, I've found more ways of achieving it and have made good progress. Once it is all working, I'll report back for other people's benefit.
 

manuka

Senior Member
Given their legendary "signals out of the mud" decoding feature, DTMF based teletype for specific info. may worth considering?
This uses normal DTMF, but in tone combinations to represent characters ! I'd pondered something similar when
exploring PICAXE generated Sequential Multi-tone Hellschreiber, but this nifty MFTT approach is potentially much more useful.

PICAXEs don't offer native DTMF generating (shame!), but the 2009 work VH6HV & I put in showed on the fly CALIBFREQ
tweaking for specific tone frequencies is viable. Decoding via PC software (Spectran etc) is easy. Stan - ZL2APS
Code:
'********************************************************************************
'*  VK/ZL PICAXE-08M HELLSCHREIBER Sequential Multi-Tone (SM/T) beacon code     *
'*  Looks capable of storing ~25 chs. on an 08M  ZL2APS & VK6HV collaboration.  *
'*  This demo entirely fills (256/256 bytes) a 08M.      Sept 2009/Jan.2010     *
‘*  Program may be downloaded from www.picaxe.orcon.net.nz/VKZLHELL.BAS         *
'********************************************************************************
REM PC soundcard decode via SPECTRAN V2 "Waterfall" visual display 
REM Tweak SPECTRAN auto bright, contrast, speed, gain & palette settings etc to suit
REM NOTE: Feel free to add, change, modify or optimize required. 
REM PICAXE tone generating syntax is in form PIN,(SOUND,DURATION)
REM Sound has values 0 (silence) to 128,with output freq =12048/(128.1-sound)
REM So sound =95 output ~12000/(128-95)= 12000/33 =~364 Hz, doubling to 728Hz when 8MHz SETFREQ M8
REM NB – freq. varies slightly with temp. & individual PICAXE internal oscillator calibration.
REM CALIBFREQ +/-30 ( POKE $90 ) conveniently tweaks internal osc. freq.
REM ------------------------------------------------------------------------------------------
Symbol Testbyte = B0
Symbol Column_Numbers = B4
Symbol Character = B8
Symbol Column_Elements = B6
Symbol Column_Bits = B2
Symbol Tones = B10
Symbol Increment = B12
SetFreq M8
Start:
Wait 10 'Message repeat delay-8MHz clock halves value! Use SLEEP (& BOD) etc to enhance battery life
REM Lookup command below accesses your pre-stored message. Modify to suit- pad out with spaces (0)?
REM shows VK.ZL PICAXE "HELL" BEACON - make upper column_number same as number of ch. elements.
For Column_Numbers = 0 to 151              'setting col.number too high repeats last character!
Lookup Column_Numbers,(31,32,64,32,31,0,127,8,20,34,65,0,8,0,97,81,73,69,67,0,127,64,64,64,64,0,0,0,0,0,0,0,127,9,9,9,6,
0,65,65,127,65,65,0,62,65,65,65,65,0,124,10,9,10,124,0,65,34,28,34,65,0,127,73,73,73,73,0,0,0,0,0
,0,1,1,0,127,8,8,8,127,0,127,73,73,73,73,0,127,64,64,64,64,0,127,64,64,64,64,0,1,1,0,0,0,0,0,0,127
,73,73,73,62,0,127,73,73,73,73,0,124,10,9,10,124,0,62,65,65,65,65,0,62,65,65,65,62,0,127,4,8,16,1
27,0,0,0,0,0,0,8),Character 
Testbyte = Character
Tones = 95
Increment = 0                            'Resets default to 0 after each 5x7 matrix col. sent 
Gosub Hellscreiber
Next
Goto Start
Hellscreiber:
For Column_Elements = 1 to 7
Column_Bits = Bit6                       '7th bit in Byte B0 (Bit0 - Bit7).
If Column_Bits = 1 Then Gosub ToneON     'Send tone if "Bit6" of Byte B0 = "1", 
If Column_Bits = 0 Then Gosub ToneOFF    'else send quiet if "Bit6" of Byte B0 ="0".only bit tested.
Testbyte = Testbyte * 2                  'Shift left! 
Next Column_Elements
Return 
ToneON:     
Poke $90, Increment                     'CALIBFREQ to bring tones (& thus images) tighter.       
Sound 1, (Tones, 15)                    'PICAXE tone generating syntax in form pin,(sound, duration)
Bit6 = 0                                'Reset Bit6 of Byte B0 to "0" so Hellschreiber: can retest 
Increment = Increment + 2               'Increment a value + 1 to be POKEd at $90
Return 
ToneOFF:
Poke $90, Increment
Sound 1, (0, 15)                        'Sound value of 0 gives silence 
Bit6 = 0
Increment = Increment + 2               'Increment a value +1 to be POKEd at $90  
Return 
REM -------------------------------------------------------------------------------------
REM Ch.images shown scrolling down the screen "waterfall" style -SPECTRAN horiz. display turns 90°
REM Rt. mouse button click on SPECTRAN display toggles waterfall scroll from downward to leftwards
REM Construct own characters by considering them scrolling downwards -thus N viewed as Z etc
REM                                       Bit6(this is the 7th bit of the 8bit byte, of Byte B0)
REM                                                             |
REM                                                             |        Last sent Bit0 column 5  
REM 5 wide by 7 high matrix                                     |             |                |
REM                                                             V             |                V
REM  Column numbers  1-5          Ex. letter "A" = 124 - *1111100       ##### V                #   
REM  #1  #2  #3  #4  #5                             10 - *0001010          # #               #   #
REM [ 1][ 1][ 1][ 1]((1)) (Bit0                      9 - *0001001 thus =>  #  #            #       #
REM [ 2][ 2][ 2][ 2][ 2]  (Bit1)                    10 - *0001010          # #             # # # # #
REM [ 4][ 4][ 4][ 4][ 4]  (Bit2)                   124 - *1111100       #####              #       #
REM [ 8][ 8][ 8][ 8][ 8]  (Bit3)                                                           #       #
REM [16][16][16][16][16]  (Bit4)           This is Bit6 of column 1,the first bit sent.--> #       #
REM [32][32][32][32][32]  (Bit5)            Then Bit5 of column 1, then Bit 4 of column 1,             
REM (64)[64][64][64][64]  (Bit6)            Bit3, Bit2, Bit1, Bit0, etc. etc. Then Bit6 
REM [ *][*][ *][ *][ *]  (Bit7,not used)   of column 2, then Bit 5, Bit4 and so on until
REM                                         all 35 bits are "shifted left" through the BIT6
REM                                         of byte B0 location (with appropriate tone or
REM                                         silence) & a complete 5x7 character matrix sent.
REM Bit6 (64) in column #1 is the first 
REM bit sent of the 5 x 7 matrix, Bit0    
REM ((1)) in column #5 is the last bit sent.
REM -------------------------------------------------------------------------------------------
REM         LETTERS:                  and  NUMBERS:                 PUNCTUATION etc: 
REM .
REM A = 124, 10,  9, 10,124       T =   1,  1,127,  1,  1     	! =   0,  0, 95,  0,  0
REM B = 127, 73, 73, 73, 62       U =  63, 64, 64, 64, 63	# =  20,127, 20,127, 20
REM C =  62, 65, 65, 65, 65       V =  31, 32, 64, 32, 31	[ =   0,127, 65, 65,  0
REM D = 127, 65, 65, 65, 62       W = 127, 32, 16, 32,127	] =   0, 65, 65,127,  0
REM E = 127, 73, 73, 73, 73       X =  65, 34, 28, 34, 65	\ =   2,  4,  8, 16, 32	
REM F = 127,  9,  9,  9,  9       Y =   1,  2,124,  2,  1	/ =  32, 16,  8,  4,  2
REM G =  62, 65, 73, 73, 57       Z =  97, 81, 73, 69, 67	" =   0,  1,  1,  0,  0
REM H = 127,  8,  8,  8,127       			        . =   0, 64,  0,  0,  0
REM I =  65, 65,127, 65, 65       0 =  62, 65, 65, 65, 62       , =   0, 96,  0,  0,  0 
REM J = 113, 65, 65,127,  1       1 =  68, 66,127, 64, 64       < =   8, 20, 34, 65,  0 
REM K = 127,  8, 20, 34, 65       2 = 121, 73, 73, 73, 70       > =   0, 65, 34, 20,  8
REM L = 127, 64, 64, 64, 64	  3 =  65, 73, 77, 75, 49       ? =   0,  1, 89,  9,  6 
REM M = 127,  2,  4,  2,127	  4 =  15,  8,  8,  8,127       * =  73, 42,127, 42, 73   
REM N = 127,  4,  8, 16,127	  5 =  79, 73, 73, 73, 49       % =  35, 19,  8,100, 98  
REM O =  62, 65, 65, 65, 62	  6 =  60, 74, 73, 73, 49       + =   8,  8,127,  8,  8
REM P = 127,  9,  9,  9,  6	  7 =   1,  1,121,  5,  3       - =   8,  8,  8,  8,  8
REM Q =  62, 65, 81, 33, 94       8 =  54, 73, 73, 73, 54       = =  20, 20, 20, 20, 20 
REM R = 127,  9, 25, 41, 70	  9 =   6,  9,  9,  9,127       
REM S =  70, 73, 73, 73, 49           			 
REM -------------------------------------------------------------------------------------
REM  Ham radio call example.(0,)= space-use one between letters & perhaps six between words.
REM          V               K                6               H              V     
REM (31,32,64,32,31,0,127,8,20,34,65,0,60,74,73,73,49,0,127,8,8,8,127,0,31,32,64,32,31)
 
Last edited:

Graham O

Member
Thanks for all the help people. Much appreciated. Very interesting code about Hellschreiber on an 08 chip. I may well try that for another project.
I now have 50 baud RTTY working and although it's been a long project, it has been very satisfying. Just got to get the rest of the electronics together now.
 
Top