400 bps with picaxe

zero48

New Member
how can generate serout speed of 400 bps picaxe 08m and i would like to generate 1600hz audio tone?? any help
 

hippy

Technical Support
Staff member
400bps gives a bit time of 2.5mS, considerably greater than the fastest execution time of a PICAXE PULSOUT instruction, so [ untested code ] ...

- ' Pin 0 - 400bps Out ( N400)
-
- SYMBOL BIT_TIME = 200 ' [See note below]
-
- b2 = "A" ' Data to send
-
- ' Set bit0(lsb/Start bit) to bit9(msb/Stop bit) to 0 or 1 as required
-
- bit0 = 1 ' Start bit
- bit1 = b2 AND %00000001 MAX 1 ' Data bit 0
- bit2 = b2 AND %00000010 MAX 1 ' Data bit 1
- <i>etc </i>
- bit8 = b2 AND %10000000 MAX 1 ' Data bit 7
- bit9 = 0 ' Stop bit
-
- ' Churn the bits out
-
- pins = bit0 : PULSOUT 1,BIT_TIME ' Start bit
- pins = bit1 : PULSOUT 1,BIT_TIME ' Data bit 0
- pins = bit2 : PUSLOUT 1,BIT_TIME ' Data bit 1
- <i>etc </i>
- pins = bit8 : PULSOUT 1,BIT_TIME ' Data bit 7
- pins = bit9 : PULSOUT 1,BIT_TIME ' Stop Bit

The value for BIT_TIME is a guesstimate based on 2.5mS (2500uS ) needed per bit, less 500uS for a 'pins=' and PULSOUT, divided by 10 because PULSOUT uses units of 10uS. You may have to experiment to calibrate it accurately.

The timing variance because of the varying token positioning in the program memory should have minimal impact with such a slow baud rate so it should remain within tolerance.

To get 1600Hz out as well, you could use an NE555 or similar gated by the data output stream, or you may be able to use PWMOUT and gate that.

I don't think the PWMOUT goes down to 1600Hz, but you could underclock the 08M, but that may adversely impact on the PULSOUT ( although up to 2.5mS should give a lot of leeway for underclocking maybe down to 500kHz ).

An alternative might be to use an underclocked 08M which only generates PWMOUT when the control line from the other is high, but this is likely to be just as easy using a NE555, although a separate 08M might be better suited to FSK, but then an NE555 ( ora pair ) may do that just as well.

Edited by - hippy on 4/9/2005 6:05:44 PM
 

zero48

New Member
i want to send ID codes (8 bit word burst ) by radio but the estandar for my aplication is 400 bps modulated in a 1600 hz carrier . i know how to modulate them but i think using your idea 555 plus 08 m will be enough and cheap ,thus I can change the ID by pc , i ran out of 08m but as soon they arrive i`ll post the results.
thanks
 
Top