PDA

View Full Version : Pulse Out



khoog
- 24th June 2005, 04:34
What is the difference between:

1.
HIGH portx.n
pause 10
LOW portx.n

2.
portx.n = 1
pause 10
portx.n = 0

3.
PULSEOUT portx.n, 1000

???
Klaus

mister_e
- 24th June 2005, 04:55
The main difference will be the amount of code generated.

Due to my fear(or challenge depending) of bad code space usage, i'll use your example #2. Yeah in that case you must set the according TRIS register but... it's always a good practice to do it anyway ;)

khoog
- 24th June 2005, 05:05
Thanks for the quick reply Steve.

When I tried it, I found that #3 used the least amount of code, but I'll go back and count those bytes again just to make sure.

Klaus

mister_e
- 24th June 2005, 05:17
Can be right or wrong depending on how m,any time you use the Pulseout in the same code, do a simple copy/paste 2-3-4-5 times and compare all of your 3 method. I bet the second will take less codespace or really close to. Well just a bet. My brain-cells and fingers feel lazy now...

khoog
- 25th June 2005, 06:22
Finally had time to run some quick experiments.

Option #1 added 14 bytes

Option #2 added 10 bytes

and Option #3 added a healthy 100 bytes to my code.

Looks like you were right Steve, but I ran these at 1AM. Results at that time (for me at least) are probably as reliable as results after 3 or 4 beers.

BR
Klaus

mister_e
- 25th June 2005, 09:15
Results at that time (for me at least) are probably as reliable as results after 3 or 4 beers

good apertizer ;)