Searching \ for '[SX] How much DATA can be used in SX/B' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/ubicom/lib/mem/index.htm?key=data
Search entire site for: 'How much DATA can be used in SX/B'.

Exact match. Not showing close matches.
PICList Thread
'[SX] How much DATA can be used in SX/B'
2005\12\14@092930 by Jim Fouchn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Jim Fouch wrote:

I have a project that I need to send several packets of Bytes using DATA statements to store the packets. These packets contain a starting Byte that says how many bytes are in that packet, followed by the actual packet bytes. Here is are the packets I have to send...



DATA $05,$01,$42,$00,$00,$00
DATA $05,$01,$43,$00,$01,$00
DATA $09,$01,$45,$00,$5A,$5A,$5A,$5A,$5A,$5A
DATA $09,$01,$46,$00,$00,$5A,$5A,$5A,$5A,$5A
DATA $09,$01,$46,$00,$01,$5A,$5A,$5A,$5A,$5A
DATA $09,$01,$47,$00,$00,$5A,$5A,$5A,$5A,$5A
DATA $09,$01,$4C,$00,$00,$5A,$5A,$5A,$5A,$5A
DATA $09,$01,$4C,$00,$01,$5A,$5A,$5A,$5A,$5A
DATA $09,$01,$4D,$00,$FF,$FF,$FF,$FF,$FF,$FF
DATA $09,$01,$41,$00,$5A,$5A,$5A,$5A,$5A,$5A
DATA $09,$01,$43,$00,$00,$5A,$5A,$5A,$5A,$5A
DATA $05,$01,$42,$00,$00,$00
DATA $05,$01,$42,$00,$00,$00
DATA $05,$01,$42,$00,$00,$00
DATA $05,$01,$42,$00,$00,$00
DATA $05,$01,$43,$00,$01,$00
DATA $09,$01,$44,$00,$01,$03,$00,$00,$00,$00
DATA $09,$01,$43,$00,$00,$5A,$5A,$5A,$5A,$5A
DATA $05,$01,$42,$00,$00,$00
DATA $05,$01,$42,$00,$00,$00
DATA $09,$01,$43,$00,$01,$00,$00,$00,$00,$00
DATA $09,$01,$45,$00,$5A,$5A,$5A,$5A,$5A,$5A
DATA $09,$01,$46,$00,$00,$5A,$5A,$5A,$5A,$5A
DATA $09,$01,$46,$00,$01,$5A,$5A,$5A,$5A,$5A
DATA $09,$01,$47,$00,$00,$5A,$5A,$5A,$5A,$5A
DATA $09,$01,$4C,$00,$00,$5A,$5A,$5A,$5A,$5A
DATA $09,$01,$4C,$00,$01,$5A,$5A,$5A,$5A,$5A
DATA $09,$01,$4D,$00,$00,$01,$FF,$FF,$FF,$FF
DATA $09,$01,$41,$00,$5A,$5A,$5A,$5A,$5A,$5A
DATA $09,$01,$43,$00,$00,$5A,$5A,$5A,$5A,$5A
DATA $05,$01,$42,$00,$00,$00
DATA $09,$01,$42,$00,$00,$00,$00,$00,$00,$00
DATA $09,$01,$42,$00,$00,$00,$00,$00,$00,$00
DATA $09,$01,$42,$00,$00,$00,$00,$00,$00,$00
DATA $09,$01,$43,$00,$01,$00,$00,$00,$00,$00
DATA $09,$01,$44,$00,$01,$03,$00,$00,$00,$00
DATA $09,$01,$43,$00,$00,$5A,$5A,$5A,$5A,$5A
DATA $09,$01,$42,$00,$00,$00,$00,$00,$00,$00
DATA $09,$01,$42,$00,$00,$00,$00,$00,$00,$00
DATA $09,$01,$43,$00,$01,$00,$00,$00,$00,$00
DATA $09,$01,$4F,$00,$FF,$FF,$03,$00,$00,$00
DATA $09,$01,$40,$00,$00,$02,$00,$00,$00,$00
DATA $09,$01,$40,$00,$01,$02,$00,$00,$00,$00
DATA $09,$01,$40,$00,$02,$02,$00,$00,$00,$00
DATA $09,$01,$40,$00,$03,$02,$00,$00,$00,$00
DATA $09,$01,$40,$00,$04,$02,$00,$00,$00,$00
DATA $09,$01,$40,$00,$05,$02,$00,$00,$00,$00
DATA $09,$01,$40,$00,$06,$02,$00,$00,$00,$00
DATA $09,$01,$40,$00,$07,$02,$00,$00,$00,$00
DATA $09,$01,$40,$00,$08,$02,$00,$00,$00,$00
DATA $09,$01,$40,$00,$09,$02,$00,$00,$00,$00
DATA $09,$01,$40,$00,$0A,$02,$00,$00,$00,$00
DATA $09,$01,$40,$00,$0B,$02,$00,$00,$00,$00
DATA $09,$01,$43,$00,$00,$5A,$5A,$5A,$5A,$5A
DATA $09,$01,$42,$00,$00,$00,$00,$00,$00,$00
DATA $05,$01,$42,$00,$00,$00
DATA $15,$01,$43,$00,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
DATA $09,$01,$45,$00,$5A,$5A,$5A,$5A,$5A,$5A
DATA $09,$01,$46,$00,$00,$5A,$5A,$5A,$5A,$5A
DATA $09,$01,$46,$00,$01,$5A,$5A,$5A,$5A,$5A
DATA $09,$01,$47,$00,$00,$5A,$5A,$5A,$5A,$5A
DATA $09,$01,$4C,$00,$00,$5A,$5A,$5A,$5A,$5A
DATA $09,$01,$4C,$00,$01,$5A,$5A,$5A,$5A,$5A
DATA $09,$01,$4D,$00,$00,$01,$FF,$FF,$FF,$FF
DATA $09,$01,$41,$00,$5A,$5A,$5A,$5A,$5A,$5A
DATA $09,$01,$43,$00,$00,$5A,$5A,$5A,$5A,$5A
DATA $05,$01,$42,$00,$00,$00
DATA $15,$01,$42,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
DATA $15,$01,$42,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
DATA $15,$01,$43,$00,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
DATA $09,$01,$4D,$00,$00,$01,$FF,$FF,$FF,$FF
DATA $09,$01,$43,$00,$00,$5A,$5A,$5A,$5A,$5A



I need to start at the first packet and move through each packet and process each one. My thought was to have a label before the first packet and use a counter index to keep track of which data packet I was on, however I know I have more than 255 data bytes. I'm going to have to break the total packets into 3-4 smaller groups.


I'm wondering if the SX28 will have enough memory. Also, will I have problems with overrunning page boundrys.


Jim


---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=100746
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)

2005\12\14@102110 by beann/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, bean wrote:

Jim,
 As of version 1.4 the READ command can use two variables (as base and offset) to read data from large tables.
 See the help file under "READ", the base and offset basically form a 16-bit pointer to the data being read.
 
 I didn' count all the bytes in the data lines, but they use program space. So you have 2K for data and program.
Bean.

---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=100746#m100753
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)

2005\12\14@105917 by Jim Fouchn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Jim Fouch wrote:

I guess I can break it into segs that don't exceed 255 bytes. I can then do it in maybe 3 or 4 data blocks. In some cases, teh packets repeat. I'm thinking of making the first byte hold both the Number of Bytes in the packet and how many times to repeat the packet. I never have more than 21 bytes and  a packet will never repeat more than 4 times.

Thanks,
Jim
---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=100746#m100761
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)

2005\12\14@110933 by beann/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, bean wrote:

Jim,
 Using "READ base+offset" you data block can be as large as you want.
 See the help file. When the offset "rolls-over" from 255 to zero you simple add 1 to the base.
Bean.

---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=100746#m100763
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)

2005\12\14@121651 by Coriolisn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Coriolis wrote:

Am I correct that packet length including the length byte is either 6, 10 or 22 bytes long? If you eliminate duplicate packets can you get the total number of bytes to be less than 512 bytes? If this is the case you can use double indirection. This means you have a table of pointers seperate from the above defined table, this table would store the offset pointer to the beginning of the packet. I count 72 packets including the duplicates, so the offset pointer table would have 72 entries. The first entry would be $00, meaning it starts at the base address of your packet data. Now your packet lengths (including the length bit) is divisible by 2, so we can store the offset into your packet data as the offset/2, meaning we can accomodate 512 bytes total, not including the length of the last packet (since it is only pointing to the head of the packet). So with this divided by 2 offset the next entry in your offset table would be $03 ($06/2). So given this double indirection scheme, the plain word english algorithm would look something like this:

Determine the packet number needed (Lets call this pnum)
Read the pnum'th entry of the offset table (Lets call this offset)
Shift offset to the left once (same as multiply by 2)
If carry bit is set goto UpperHalf else
 Read data at packet data base address + offset
 Continue to process the data by incrementing the offset number until packet data is exhausted
End of algorithm branch
UpperHalf branch:
 Read data at packet data base address + 256 + offset
 Continue to process the data by incrementing the offset number until packet data is exhausted
End of algorithm branch
By using double indirection, you can eliminate duplicate packets. Since the first packet is the same as the 12th-15th packets, the 12th-15th entries in the offset table would also be $00 and 24 bytes will be saved, because it is processed as though that data was stored for each of the packets. This method is more robust than the run length encoded that you are thinking about because it removes all duplicate packets, not just the identical ones that are adjacent.

This is a fairly advanced method of data encoding so dont be afraid to ask for clarification on anything you don't fully understand.

---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=100746#m100769
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)

2005\12\14@124938 by Jim Fouchn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Jim Fouch wrote:

Paul,
This is a great Idea!!! I'll give it a try.  Thanks...

Jim
---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=100746#m100775
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)

2005\12\14@130131 by Coriolisn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Coriolis wrote:

I also see another space saving solution, your data packets first data byte is always $01, also the 3rd data byte is always $00. You can eliminate these from your table as well and adjust your stored packet lengths to 4, 8 and 20. Then specifically code that whenever these two data bytes are to be fetched, the proper (but not stored byte) is generated. Doing this will reduce your total packet data by 144 bytes.

Now get this, I just recalculated your packets using both double indirection (eliminating duplicate packets), and removing the two constant bytes, and guess what I calculate the total number of bytes are? 256! Here is the packet data table Ive made:




DATA $03,$42,$00,$00
DATA $03,$43,$01,$00
DATA $07,$45,$5A,$5A,$5A,$5A,$5A,$5A
DATA $07,$46,$00,$5A,$5A,$5A,$5A,$5A
DATA $07,$46,$01,$5A,$5A,$5A,$5A,$5A
DATA $07,$47,$00,$5A,$5A,$5A,$5A,$5A
DATA $07,$4C,$00,$5A,$5A,$5A,$5A,$5A
DATA $07,$4C,$01,$5A,$5A,$5A,$5A,$5A
DATA $07,$4D,$FF,$FF,$FF,$FF,$FF,$FF
DATA $07,$41,$5A,$5A,$5A,$5A,$5A,$5A
DATA $07,$43,$00,$5A,$5A,$5A,$5A,$5A
DATA $07,$44,$01,$03,$00,$00,$00,$00
DATA $07,$43,$01,$00,$00,$00,$00,$00
DATA $07,$4D,$00,$01,$FF,$FF,$FF,$FF
DATA $07,$42,$00,$00,$00,$00,$00,$00
DATA $07,$4F,$FF,$FF,$03,$00,$00,$00
DATA $07,$40,$00,$02,$00,$00,$00,$00
DATA $07,$40,$01,$02,$00,$00,$00,$00
DATA $07,$40,$02,$02,$00,$00,$00,$00
DATA $07,$40,$03,$02,$00,$00,$00,$00
DATA $07,$40,$04,$02,$00,$00,$00,$00
DATA $07,$40,$05,$02,$00,$00,$00,$00
DATA $07,$40,$06,$02,$00,$00,$00,$00
DATA $07,$40,$07,$02,$00,$00,$00,$00
DATA $07,$40,$08,$02,$00,$00,$00,$00
DATA $07,$40,$09,$02,$00,$00,$00,$00
DATA $07,$40,$0A,$02,$00,$00,$00,$00
DATA $07,$40,$0B,$02,$00,$00,$00,$00
DATA $13,$43,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
DATA $13,$42,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00


This means you dont need to do the divide by 2 trick to accomodate all of the table! The algorithm would look something like this:

Determine the packet number needed (Lets call this pnum)
Read the pnum'th entry of the offset table (Lets call this offset)
Output $01 for the first packet data byte
Read data at packet data base address and output
Output $00 for the third packet data byte
Read data at packet data base address + offset (offset=1 at this point) and output
Continue to process the data by incrementing the offset number until packet data is exhausted
End of algorithm branch
---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=100746#m100779
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)

2005\12\15@044117 by Jim Fouchn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Jim Fouch wrote:

Paul,
Your idea worked great. It's amazing the the talent on this forum!

Strange how numbers work out. I was also amazed to see the Packet data worked out to be 256 bytes.  LOL
Jim
---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=100746#m100882
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)

2005\12\15@063546 by Coriolisn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Coriolis wrote:

Glad to hear it worked. Data structures are my forte, I got a 105 in the college course (by doing all the xtra credit problems), it got me an undergrad student advisor position in the class the next semester and a job as a student programmer. I find creating optimal data structures more fun than straight up programming.

---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=100746#m100893
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)

2005\12\19@080019 by cbmeeksn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, cbmeeks wrote:

[Quoting: "Paul Baker"]Glad to hear it worked. Data structures are my forte, I find creating optimal data structures more fun than straight up programming.

And just as important.  
Great work Paul.

-cbmeeks
---------- End of Message ----------

You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=100746#m101366
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)

More... (looser matching)
- Last day of these posts
- In 2005 , 2006 only
- Today
- New search...