Searching \ for '[SX] More efficient serial' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: massmind.org/techref/ubicom/lib/io/index.htm?key=serial+serial
Search entire site for: 'More efficient serial'.

Exact match. Not showing close matches.
PICList Thread
'[SX] More efficient serial'
2009\06\12@194457 by lbouchern/a

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

HI All

So i wrote a peice of SX code at work.

My project works, but i am using like 95%+ of the space on the SX28. Which leaves little room for future expansion.


So two questions.

Is there a hardware solution to get more program and or data space?


second
Most of my program involves sending and receiving strings.

I cannot post the real program, but below is the gist of what i have done.

Can i make this more efficient?


Thanks a bunch
[2]
DEVICE SX28, OSCHS2, TURBO, STACKX, OPTIONX
FREQ 50_000_000
'DEVICE SX28, OSC4MHZ, TURBO, STACKX, OPTIONX
'DEVICE SX28, OSCHS2, TURBO, STACKX, OPTIONX
'FREQ 4_000_000
ID "Something"



' =========================================
PROGRAM Start
' =========================================

TX_COMMAND_BYTE SUB 1
RX_COMMAND_BYTE SUB 0
TX_DATA_BYTE SUB 1
RX_DATA_BYTE SUB 0
Start:


Main:

FOR idx = 0 TO 26 read monitor_log+idx,send_byte
TX_COMMAND_BYTE send_byte
NEXT
FOR idx = 0 TO 7
TX_DATA_BYTE up_or_down(idx)
NEXT

for idx=0 TO 7 if constant_log = 0 then something_1(idx) = RX_DATA_BYTE else something_1(idx) = RX_COMMAND_BYTE endif next
GOTO Main
SUB TX_COMMAND_BYTE
SEROUT tx_commands, COMMAND_BAUD_RATE, __PARAM1 ' send the character
ENDSUB
SUB TX_DATA_BYTE
SEROUT tx_data, DATA_BAUD_RATE, __PARAM1 ' send the character
ENDSUB
SUB RX_COMMAND_BYTE
SERIN rx_monitor_pin, COMMAND_BAUD_RATE, subroutine_temp1,100,No_Data ' wait for serial input
RETURN subroutine_temp1 ' return to caller
ENDSUB
SUB RX_DATA_BYTE
SERIN rx_data_pin, DATA_BAUD_RATE, subroutine_temp1,100,No_Data ' wait for serial input
RETURN subroutine_temp1 ' return to caller
ENDSUB

monitor_log:

DATA "Something i cannot put here",13
[/2]
---------- End of Message ----------

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

2009\06\14@202341 by lbouchern/a

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

No ideas out there?

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

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

2009\06\15@091337 by Peter Van der Zeen/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Peter Van der Zee wrote:

Iboucher;
It's hard for volunteers to help when details of what you are trying to do are not available, and no comments in the code. I'm a person who likes a challenge, but I expect the other party to do the work..... I try to give pointers so that they can learn.

As far as filling up your program space..... without studying your code, and based on my experience, I would estimate what you are attempting to consume 256 bytes if written tightly in assembler, and 2 times that in SX/B.

So look at the SX/B output listings, and see where all the space has gone, and make improvements accordingly.

Cheers,
Peter (pjv)
---------- End of Message ----------

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

2009\06\16@154708 by lbouchern/a

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

Wish i could put details, but i really cannot cause of work.
Sorry for the lack of comments, thought the code was generally self explanitory.
Just trying to send and receive various length sequences of various characters.

Really just wondering if there is a way to get rid of all the for loops, and make a biggers subfuction that handles the for loop.

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

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

2009\06\16@175514 by lbouchern/a

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

So ya,

now that i drove home, sorry i wasn't completely clear.


So let me try again
Given this part of the main program


FOR>
TX_DATA_BYTE monitor_log(idx)

NEXT
How>
SUB TX_DATA_BYTE

SEROUT>
ENDSUB
And i am sending the data contained in the string monitor_log:

monitor_log:

DATA "Something i cannot put here",13
And i cannot put the reference to monitor_log into the sub function because there would be several different strings stored in data. (Maybe i can get around this by simply an index, since i know all the different strings ahead of time, i just have to be careful not to repeat the serout functions. Hummmm.)
Any help greatly appreciated.

Thanks
Lucas
---------- End of Message ----------

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

2009\06\16@180900 by lbouchern/a

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

Ahh i got it
Define the sub function with two variables.
1 being string length
1 being string reference number so
TX_DATA_BYTE 1 7    (where 1 is string reference, and 7 is length.

then the sub funtion
SUB TX_DATA_BYTE for idx = 0 to __PARAM2
if __PARAM1 = 1 then
send_byte=monitor_log(idx)
endif
if __PARAM1 = 2 then
send_byte=some_other_string(idx)
endif
SEROUT tx_data, DATA_BAUD_RATE, send_byte ' send the character next
ENDSUB
---------- End of Message ----------

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

2009\06\16@183816 by lbouchern/a

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

Hum looks like that saves only 2 instructions.
Maybe if i assume the data is stored together i can simplify this more.

Meaning if i have two strings string_1:
DATA "STRING_1"
string_2:
DATA "STRING_2"
then, i think
string_1(9) = "S"
then i can get rid of the if in the sub function
i just have to pass a the start location and number of charaters to the sub function instead of an index and number of characters.

Heck i quess i should just store all the strings in one long data entry.

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

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

2009\06\17@051543 by Unsoundcoden/a

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

Hi I have used the following which transmits a zero terminated string. It's not much different or efficient to what you have but it works well and its easy to use.


Tx_String  sub 2       'declaration
Tx_String @string_1    'usage
Tx_String @string_2
   
Tx_String:             'writes strings terminated with 0
Addr= __Wparam12       'Addr is a word value
do
READ Addr,char
IF char=0 THEN EXIT
inc Addr
serout tx,baud,char
loop
RETURN string_1:
DATA "STRING_1",0
string_2:
DATA "STRING_2",0

Jeff T.

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

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

2009\06\18@165748 by PJMontyn/a

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

lboucher,
You say you're using 95% of the EEPROM space, and that your app mainly involves involves sending and receiving strings.  So. my question to you is how much of the EEPROM space is used to store strings currently?  In other words, if you're using 80% of the EEPROM space just to store strings, then what you need to do is either shrink the size of your strings or move them to an external serial EEPROM.

Thanks,
PeterM
---------- End of Message ----------

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

2009\06\30@200216 by lbouchern/a

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

Hi
I have managed to shrink everything down to about 80% of the EEPROM. I don't have the code in front of me, but no more than 10-15% was stored strings. Most of the program was receiving strings and parsing data correctly. I have never added EEPROM before. If i get to that point i will have to give it a try.

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

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

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