Searching \ for '[SX] code optimalization' 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/devices.htm?key=sx
Search entire site for: 'code optimalization'.

Exact match. Not showing close matches.
PICList Thread
'[SX] code optimalization'
2008\07\21@234622 by stefn/a

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

Hi

I have been working an a nice project for quite some time now. Everything is working nice but I have been waking against the memory limited space of the sx28. So I 'm now trying to optimise my code so that it fits all into the sx28.

I was wondering if somebody knows a simple way to set outputs on different pins high or low with one word.


ex.


I want to set ra.0 and rb.0 to high and ra.1 to low sometimes during my program flow. In some other time i need to set ra.0 low and rb.0 to high. Leaving the other pins unchanged.

Is thier a way to define that in a constant with a good name and use only the name afterwoods in the program flow? Is that gaining me program space then?

I 'm using sx/B.


Thanks for any suggestions.


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

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

2008\07\22@001331 by peterverkaikn/a

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

You can define a pin (for example ra.0)
pinA0 var ra.0
To make the pin high use
 pinA0 = 1   (this translates into setb ra.0)
To make the pin low use
 pinA0 = 0   (this translates into clrb ra.0)
Without seeing your code we cannot give good advice
on how to optimize your code.

regards peter
---------- End of Message ----------

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

2008\07\22@003134 by stefn/a

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

Hi Peter
Thanks for your reaktion. Sorry I can not post the code. The end user wants his code private so I have to respect that.

The post you made is verry clear. I alraedy use that like that. The only thing I was wondering. Can you do that also for several pins at the same time.

Something like pins VAR ra.0,rb.1,rb.6 pins = 1
Your example is using a one to one relation. Can it be a one to many? (but not the complete poort and/or different ports)
stef
---------- End of Message ----------

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

2008\07\22@004941 by peterverkaikn/a

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

You can define multiple constants like this:
pinA0 CON $001 pinA1 CON $002
pinA2 CON $004
pinA3 CON $008 pinB0 CON $101
pinB1 CON $102
pinB2 CON $104
pinB3 CON $108
pinB4 CON $110
pinB5 CON $120
pinB6 CON $140
pinB7 CON $180 pinC0 CON $201
pinC1 CON $202
pinC2 CON $204
pinC3 CON $208
pinC4 CON $210
pinC5 CON $220
pinC6 CON $240
pinC7 CON $280
You can combine pins of the same port like this:
pinsB = pinB0 OR pinB3
To set the pins specified by pinsB
rb = rb OR pinsB
To clear the pins specified by pinsB
pinsB = not pinsB
rb = rb AND pinsB
To automatically set pins of the same port you can use a subroutine
SUB setPortPins  'call this with a wordparameter like pinsB
pinmask = __PARAM1
port = __PARAM2
branch port,setA,setB,setC
return
setA:
ra = ra OR pinmask
return
setB:
rb = rb OR pinmask
return
setC:
rc = rc OR pinmask
return
ENDSUB
For clear, you can define something simular using AND instead of OR.
Question is if this really optimizes your code, because setting up pins
and calling the subroutine also takes quite some code.
Another option to optimize is changing some of the sxb code into assembly.

regards peter
---------- End of Message ----------

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

2008\07\22@010135 by stefn/a

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

Thanks peter
You offen specify "same port ". So it is not possible to AND/OR on pins from different ports?


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

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

2008\07\22@010918 by peterverkaikn/a

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

No, as there are no assembly statements that operate on multiple ports.

regards peter
---------- End of Message ----------

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

2008\07\22@025908 by stefn/a

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

thanks peter
---------- End of Message ----------

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

2008\07\22@205121 by Sparks-R-Funn/a

flavicon
face
In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Sparks-R-Fun wrote:

Make sure you are using subroutines for tasks you perform more than once.  SX/B commands like SERIN, SEROUT, PAUSE, etc. actually generate a lot of SX assembly commands each time they appear in a program.  If you place these commands in their own subroutine they will appear only once in the program (and thus generate only one sequence of assembly commands) but can be called multiple times.  The impact of this can be dramatic for some programs.

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

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

2008\07\23@014058 by stefn/a

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

Hi sparks
I will look into it. thanks for the tip. I also use a lot of DATA arguments to store some static data. They seem to took also a lot off place. Has someone experiance (perhaps a schema and some examples) to connect memory to the sx28. I can then leave my program in the sx28 and place the data in the memory ic. The only problem then is that I have not mutch i/O pins free.

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

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

2008\07\23@062935 by PJ Allenn/a

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

There is an example program (and circuit) for implementing an I2C EEPROM in SX/B Help.

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

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

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