Serial straight to memory

Jeremy Leach

Senior Member
This might have been covered before, but it would be great to have a command that could load data straight into RAM or EEPROM. Just specify a start address and number of bytes to receive.
 

BeanieBots

Moderator
hserin.
BACKGROUND serial input straight into scratchpad RAM.
Page 57.
You'll have to wait until next week for the 28X1 before you can use it though.
 

Technical

Technical Support
Staff member
BB is basically correct, but you don't actually use hserin command at all.

Use hsersetup to specify "background serial" reception to the scratchpad. Then serial receipt is fully automatic and occurs in the background whilst the PICAXE runs other tasks. hserin command is not used.

And Jeremy already has a 28X1 beta chip... ;-)

Edited by - Technical on 27/04/2007 15:04:54
 

Dippy

Moderator
Jer, this was a little loop I was playing with. The bits commented-out were just things I was playing with.
It doesn't do anything special, just waits for 8 bytes.
<code><pre><font size=2 face='Courier'>
; set picaxe type
#picaxe 28x1

hsersetup B2400_4, %01 ' Set Hardware serial buffer speed,mode (auto)

Symbol Sp1 = b9
Symbol Sp2 = b10
Symbol Sp3 = b11
Symbol Sp4 = b12
Symbol Sp5 = b13
Symbol Sp6 = b14
Symbol Sp7 = b15
Symbol Sp8 = b16

'loop waiting for 8 bytes
main:
sp1=100:sp2=0:sp3=0:sp4=0:sp5=0:sp6=0:sp7=0:sp8=0
'hserin [1500,Giveup],0,8 &#8216; receive 8 bytes into s/pad starting address 0
do
Serout 1,T2400_4,(b1) ' Dummy loop just for testing..
loop until Hserptr = 8 ' until ser pointer = 8 (i.e. loop here til 8 bytes)
hserinflag =0
Hserptr = 0
Get 0,sp1
Get 1,sp2
Get 2,sp3
Get 3,sp4
Get 4,sp5
Get 5,sp6
Get 6,sp7
Get 7,sp8
'ptr = 0
'Revvy = @ptr
Giveup:
debug

goto main &#8216; loop back to start
</font></pre></code>

A lot of it was just for messing with.

Edited by - dippy on 27/04/2007 17:20:47
 

Jeremy Leach

Senior Member
Thanks. Yes I do have a beta chip. Been so engrossed in current project that haven't had chance to get to grips with it and should have read about this new serin. Sounds very useful especially for longish data streams.
 

RexLan

Senior Member
This will be extremely useful.

Technical ... what is the ETA for the chip to be available from the US distribution?

 
Top