2P serin to scratchpad
Archiver
Posts: 46,084
In a posting last year Joe Sass said.
"The BS2P has the ability to input directly to the scratch pad ram using serin,
as done in the sample code from the Parallax site."
Is this still the case? Where can I find further documentation on this? they
have re-designed the site.
I am working on a project that requires reading a string of as much as 96 bytes,
calculating the checksum, reading in a timestamp
(from some form of realtime onewire clock), manipulating the data, and sending
it to 2 other devices each of which wants to see the
data in different forms.
Lonnie - KF4HAZ -
"The BS2P has the ability to input directly to the scratch pad ram using serin,
as done in the sample code from the Parallax site."
Is this still the case? Where can I find further documentation on this? they
have re-designed the site.
I am working on a project that requires reading a string of as much as 96 bytes,
calculating the checksum, reading in a timestamp
(from some form of realtime onewire clock), manipulating the data, and sending
it to 2 other devices each of which wants to see the
data in different forms.
Lonnie - KF4HAZ -
Comments
SERIN pin, baud, [noparse][[/noparse]SPSTR \L]
where L is the number of bytes to buffer to the Scratchpad RAM. The first
character received is put in location 0, and the data builds up. If you are
using the Scratchpad to hold other data, you should store it at the top of
the Scratchpad so that it is not overwritten by the SERIN data.
The SPSTR modifier works in both the BS2p and the BS2pe. We find it
particularly useful in our GPS experiments where we buffer the entire $GPMRC
string to Scratchpad, then parse out the data as required.
-- Jon Williams
-- Parallax
In a message dated 4/28/2003 11:23:08 AM Central Standard Time,
techsupport@f... writes:
> In a posting last year Joe Sass said.
>
> "The BS2P has the ability to input directly to the scratch pad ram using
> serin, as done in the sample code from the Parallax site."
>
> Is this still the case? Where can I find further documentation on this?
> they have re-designed the site.
>
> I am working on a project that requires reading a string of as much as 96
> bytes, calculating the checksum, reading in a timestamp
> (from some form of realtime onewire clock), manipulating the data, and
> sending it to 2 other devices each of which wants to see the
> data in different forms.
>
> Lonnie - KF4HAZ -
[noparse][[/noparse]Non-text portions of this message have been removed]
In this application the length of the string varies, the end of the string is
denoted by a <CR><ETX> followed by the checksum and a
<CR>.
How would SPSTR be implemented knowing that:
1. the length of the string varies.
2. the end marker occurs between the end of the string and the checksum<CR>?
From: <jonwms@a
> Yes, it is documented in the help file. In short, here's how you do it:
>
> SERIN pin, baud, [noparse][[/noparse]SPSTR \L]
>
> where L is the number of bytes to buffer to the Scratchpad RAM. The first
> character received is put in location 0, and the data builds up. If you are
> using the Scratchpad to hold other data, you should store it at the top of
> the Scratchpad so that it is not overwritten by the SERIN data.
>
> The SPSTR modifier works in both the BS2p and the BS2pe. We find it
> particularly useful in our GPS experiments where we buffer the entire $GPMRC
> string to Scratchpad, then parse out the data as required.
>
> -- Jon Williams
> -- Parallax
>
>
>
> In a message dated 4/28/2003 11:23:08 AM Central Standard Time,
> techsupport@f... writes:
>
> > In a posting last year Joe Sass said.
> >
> > "The BS2P has the ability to input directly to the scratch pad ram using
> > serin, as done in the sample code from the Parallax site."
> >
> > Is this still the case? Where can I find further documentation on this?
> > they have re-designed the site.
> >
> > I am working on a project that requires reading a string of as much as 96
> > bytes, calculating the checksum, reading in a timestamp
> > (from some form of realtime onewire clock), manipulating the data, and
> > sending it to 2 other devices each of which wants to see the
> > data in different forms.
> >
> > Lonnie - KF4HAZ -
>
>
>
> [noparse][[/noparse]Non-text portions of this message have been removed]
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the Subject and Body
of the message will be ignored.
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
I have used it with GPS where, as you indicate, the length of the incoming
string varies. That said, the $GPMRC string is followed by another so I set
my \L parameter to get the entire $GPMRC string plus a few possible extra
bytes of the next string. If you don't need the entire string, you can
shorten the \L parameter to accept the number of bytes you want to examine.
-- Jon Williams
-- Parallax
In a message dated 4/28/2003 12:42:58 PM Central Standard Time,
techsupport@f... writes:
> Tnx and one further question, is the /L modifier needed.
> In this application the length of the string varies, the end of the string
> is denoted by a <CR><ETX> followed by the checksum and a
> <CR>.
> How would SPSTR be implemented knowing that:
> 1. the length of the string varies.
> 2. the end marker occurs between the end of the string and the checksum<CR>
> ?
[noparse][[/noparse]Non-text portions of this message have been removed]
I don't think the SPSTR \L is correct command. It should be SPSTR L. See
example code below.
Chuck
'BS2p24 writes and reads a Microchip 24LC32, i2c eeprom
'example of fast read using SPSTR L command
'6/18/01
dta var byte
idx var byte
pause 100 'powerup time
for idx = 0 to 31
I2COUT 0,$A0,$00\idx,[noparse][[/noparse]idx*2] 'store multiply times 2
pause 5 'page write byte to i2c, 5ms min. time
next
pause 1000
debug cls
'for idx = 0 to 31
I2CIN 0,$A1,$00\0,[noparse][[/noparse]spstr 32]
for idx=0 to 31
get idx,dta
debug "Loc: ", dec idx,tab,tab,"Data: ",dec dta,cr
next
is no slash character in the command as Chuck points out below.
Note that SPSTR works with any "serial" input stream: SERIN, I2CIN, OWNIN and
LCDIN.
-- Jon Williams
-- Parallax
In a message dated 4/28/2003 1:34:31 PM Central Standard Time,
CHIPKEN@a... writes:
> Jon,
> I don't think the SPSTR \L is correct command. It should be SPSTR L. See
> example code below.
> Chuck
>
> 'BS2p24 writes and reads a Microchip 24LC32, i2c eeprom
> 'example of fast read using SPSTR L command
> '6/18/01
>
>
> dta var byte
> idx var byte
>
> pause 100 'powerup time
>
> for idx = 0 to 31
> I2COUT 0,$A0,$00\idx,[noparse][[/noparse]idx*2] 'store multiply times 2
> pause 5 'page write byte to i2c, 5ms min. time
> next
>
> pause 1000
> debug cls
>
> 'for idx = 0 to 31
> I2CIN 0,$A1,$00\0,[noparse][[/noparse]spstr 32]
> for idx=0 to 31
> get idx,dta
> debug "Loc: ", dec idx,tab,tab,"Data: ",dec dta,cr
> next
>
[noparse][[/noparse]Non-text portions of this message have been removed]
that you'll have to add a 28-pin PIC to your design,
I thought I would add that the Basic ATOM
(www.basicmicro.com) does support a hardware UART
on-chip (pin 14 and 15), and has HSERIN/HSEROUT
command support to provide access to an
interrupt driven 232 port, with 48 bytes
of buffering. And if you don't like
their HSERIN/HSEROUT cmds, the Atom does support
a pseudo-interrupt between Basic tokens which may
be sufficient to do the job for you.
Note that the ATOM is a 24-pin Stamp compatible
package for around $50.00, and you'll still have to
have the MAX232 driver -- but you should check them
out.
Note the ATOM has 2k of ram, and 16K of program memory,
which also makes your solution easier.
--- In basicstamps@yahoogroups.com, "FalconWireless Tech Support -
KF4HAZ" <techsupport@f...> wrote:
> In a posting last year Joe Sass said.
>
> "The BS2P has the ability to input directly to the scratch pad ram
using serin, as done in the sample code from the Parallax site."
>
> Is this still the case? Where can I find further documentation on
this? they have re-designed the site.
>
> I am working on a project that requires reading a string of as much
as 96 bytes, calculating the checksum, reading in a timestamp
> (from some form of realtime onewire clock), manipulating the data,
and sending it to 2 other devices each of which wants to see the
> data in different forms.
>
> Lonnie - KF4HAZ -