bc_fred Posted October 12, 2011 Report Posted October 12, 2011 The function "RTC to ASCII" is potentially useful. It would be more useful if one could get rid of the "/" separator in the MM/DD string and the ":" separator in the hh:mm string. I can move RTC to ASCII into three consecutive MI's. I suppose I could then move ASCII to NUM. The documentation for ASCII to NUM says that you specify a Source Vector address, a Vector Length, and a Destination Vector. (there's also something called a Factor, but that's to do with decimals, so I'm guessing that stays at zero. If there are two ASCII characters per MI, then the ASCII data laid out is: ADDR CONTENT ---------------- MI x MM MI x+1 /D MI x+2 D What would be ideal would be to move this all to 5 consecutive Integers, say, MI Y0 through Y4, then grab Y3 and Y4 and then put them on Y2 and Y3. This would kill the ASCII code for "/". Then I could grab Y0 through Y3 and put them in an ASCII set, e.g. MI Z0 and MI Z1. This would all be irrelevant if I could go RTC to String and then just knock out character 3, but that option doesn't seem to exist. Am I completely off base? I want to make a filename that consists of MMDDhhmm.udt on the SD card. That way, every time we create a new .udt file, we can immediately see the date and time of file creation. But I can't do this if I can't strip out the separators, because we can't exceed 8 characters. Any ideas welcome. The examples and documentation don't cover this, in my experience. Fred Mason
MVP 2023 Joe Tauser Posted October 12, 2011 MVP 2023 Report Posted October 12, 2011 It's a bit convoluted, but I would suggest building your MMDDhhmm number in an ML and then doing a NUM to ASCII on it. SI 32 contains DDMM, so the first thing to do is divide it by 100 to knock it to DD only. The remainder MM will be in SL 4, so you can multiply it by 100 and add it back resulting in MMDD. Next multiply this by 10,000 and put it in an ML to get MMDD0000. Add SI 31 HHMM to this ML to get MMDDHHMM. Now when you run it through the NUM to ASCII block with length 8 you should get your string in four consecutive MIs. Joe T.
bc_fred Posted October 12, 2011 Author Report Posted October 12, 2011 Joe: This is brilliant. Thanks so much. Fred
Anthony Posted October 12, 2011 Report Posted October 12, 2011 Hi Guys, You can use the String tools to create any string you want. This is part of the beauty of them. Here is an example program that takes the RTC to ASCII for the date and the time, Removes the "/" from the date and the ":" from the Time, then truncates the strings down to four chars, and then merges the two strings creating your file name. It is also worth mentioning, that we added a few new formats to the RTC to ASCII to support files names (legal file name chars are numbers, letters and the "_"). string tools to make file name MMDDhhmm.vlp
bc_fred Posted October 13, 2011 Author Report Posted October 13, 2011 Anthony: This is also brilliant. If Unitronics ever sees fit to put a procedural language in (and document it!), life will be sweet. Thanks to you both. Fred
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now