REP command with BS2P
FORD
Posts: 221
Hi All,
I read in one of Tracy Allens posts regarding use of a DS18B20 temperature device, a command "REP" within a debug command.
I have searched Parallax documentation and cant find anything realted to this command.
Can anyone provide a link, or an explanation of the REP command pleease.
Any help appreciated.
Cheers,
Chris,
Western Australia.
I read in one of Tracy Allens posts regarding use of a DS18B20 temperature device, a command "REP" within a debug command.
I have searched Parallax documentation and cant find anything realted to this command.
Can anyone provide a link, or an explanation of the REP command pleease.
Any help appreciated.
Cheers,
Chris,
Western Australia.
Comments
No its definately REP, and I have no idea of its purpose.
Have searched manuals etc and can find nothing.
See the code below written by Tracey Allen...
DEBUG "degC=", REP "-"\signC, DEC ABS degC/10, ".", DEC1 ABS degC,TAB
If you need to display the same ASCII character multiple times, the REP (repeat) formatter can help. REP takes the form: REP x\n ;where x is the character and n is the number of times to repeat it. For example:
DEBUG REP "-"\10
would display 10 hyphens on the screen, "
".
I hope this helps you out, because I learned something too about this as well.
Thats expained it perfectly.
Where did you find it in the help ?
If you have the paper copy of the "Syntax and Reference" manual, version 2.2, REP is located on (or near) page 167 under the DEBUG section.
If you have the Basic Stamp editor, version 2.4.2, open up the help and under the Index tab, enter "REP" and it will take you to the DEBUG section. Scroll down just shy of half way and you'll come across a table of Formatters. At the bottom of the table, REP resides.
Thanks for asking this question - I had no idea the DEBUG (or SEROUT for that matter) supported this function.
Later,
DJ
The count can even be a zero. So
REP "-"\signC
either prints a minus sign or not depending on the sign bit of a number. The whole instruction line prints a temperature, either negative or positive. Note that the sign bit is given its own name as an alias for bit15 of the temperature Word variable.
A few other uses:
-- Add a line feed conditionally to a line return, necessary for some displays but not others:
LFb VAR BIT ' if this equals 1, print a LF after each CR
DEBUG CR, REP LF\LFb
-- Make an ascii graph on a screen, the position of the "X" depends on a variable line after line:
-- Right justify text in a field of width W
myString DATA 29, "What is going on at Parallax?" ' counted string, length in first byte
I'll be copy/pasting this info into the file in which I keep tips & tricks.
DJ
I am using your code to write 8 channels of temperature data to an Sd card at 1 minute intervals, using a bs2p.
Thank you heaps for posting that code for the DS18B20, its a very neat bit of code.
Hope alls well over your way,
We are on Cyclone watch alert today, very rare for so far South here in Western Australia.
Again, thank you.
Cheers,
Chris
I was curious which DS18B20 code you were using. One I had posted used the skipRom command to address one single device, or and another used the readROM to discover the unique address of a single device on the line, which could then be entered as fixed data to address multiple devices. But I don't think I posted one that did a full seach and enumeration with multiple unknown devices on the buss. I used to have that, but can't find it at the moment.
Thanks again,
I would like to see the code you used to enumerate the devices.
I have done lots with ds1996 memory stuff, but have never tried enumeration with 1wire devices.
I am using 8 i/o to read 8 devices, so enumeration would be a great help, as I want to ad some ralays later, so will need some spare i/o for that.
Best regards,
Chris.