PDA

View Full Version : HOW do I use the REP c/n modifier ?



Simon Brodeur
- 23rd September 2005, 17:54
I'm trying to send this separation to a terminal program :

SEROUT TXRS,T2400,["------------------------",13,13]

I want to use the REP c/n modifier, but will it save code space ? Surely, it should be a kind of loop. I'm trying something like this and it doesn't work :

SEROUT TXRS,T2400,[REP DEC 45/24,13,13]

I change the "-" to is decimal value and I want to repete it 24 times.

It is surely a syntaxe error, can you help me...

Melanie
- 23rd September 2005, 21:49
Close but no cigar...

Try...

[REP 45\24,13,10]

or...

[REP $2D\24,13,10]

...see the PICBasic Manual.

rhino
- 23rd September 2005, 21:51
You might want to look at the manual. I'm not 100%, but I don't think SEROUT supports that modifier. You may have to use SEROUT2. Look up SEROUT2 and try [REP -\24, 13, 13].
***EDIT***
Nevermind... Mel beat me to it with a solution. http://www.picbasic.co.uk/forum/images/icons/icon12.gif