![]() |
Forum Index : Microcontroller and PC projects : LOC and LOF...
Author | Message | ||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9586 |
Two exceptionally handy functions in MMBASIC are LOC and LOF. I've had a bit of a look around on the net, but I am unable to find out what these commands are actually short for. It is only academic, but do the letters LOC and LOF "Mean" something or are they short for something? Most of the other keywords make sense, such as LEN(length), DIM(dimension) FOR/NEXT, DO/LOOP etc, but these two serial port commands have always made me wonder what the letters are actually short for....... Smoke makes things work. When the smoke gets out, it stops! |
||||
JohnS Guru ![]() Joined: 18/11/2011 Location: United KingdomPosts: 4033 |
LOC = location I always understood, but seems to have morphed weirdly. Don't think LOF existed back then! John |
||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3282 |
Originally LOC meant the read location in a random access file and LOF meant the length of a file. But when they were applied to COM ports the meanings morphed into something else. Perhaps you should ask Bill to explain! Geoff Geoff Graham - http://geoffg.net |
||||
MicroBlocks![]() Guru ![]() Joined: 12/05/2012 Location: ThailandPosts: 2209 |
RTFM.:) [code] For a file this will return the current length of the file in bytes [/code] LOF = Length Of File Microblocks. Build with logic. |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9586 |
Thanks for those posts, guys - it is all useful and interesting information. LOF has really made me very happy in my latest experiment. The PICAXE would send the data, THEN execute the next command. MMBASIC does not - it drops the data to send into the buffer, then executes the next command right away, while the TXD buffer is being emptied in the background - that is fabulous, as it allows my code to move to something else, and the PIC32 empties the buffer in the background - wonderful, and serial messaging bliss. ![]() Although, it did take a SMALL amount of head scratching at first, to find out why the RF module was only "Blipping" when I sent it the data. Pseudo PICAXE code was: Enable RF module SEROUT data to module Disable RF module When I ported that across to MMBASIC: Pin(14)=1 'Enable RF module Print #1,"UUUUUUUUUUTESTING RF MODULES." + chr$(13) Pin(14)=0 ...MMBASIC was disabling the RF module before it could actually send the data! ![]() The addition of the line Do:Loop until LOF(#1)=256 solved that problem, and I now have plans to put a quick check of something else inside that loop, so MMBASIC can check something else while it is waiting for the serial buffer to empty, THEN it can disable the RF module. Beautiful. ![]() ![]() ![]() Smoke makes things work. When the smoke gets out, it stops! |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |