Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : Commenting out lines
Author | Message | ||||
Talbit Senior Member Joined: 07/06/2011 Location: AustraliaPosts: 210 |
Gents, If I were to comment out a lot of unnecessary lines with the ' will this slow down the program? i.e. will my program run faster if I have no comments? Talbit Talbit |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3194 |
Removing spaces and comments will save some time, but not a lot. The interpreter steps over them at high speed - it takes about 50nS (ie, 50 billionths of a second) to skip each character. So a comment of 20 characters would take about 1uS to skip, not long. Geoff Geoff Graham - http://geoffg.net |
||||
Talbit Senior Member Joined: 07/06/2011 Location: AustraliaPosts: 210 |
Thanks Geoff, I have used your elegant parsing of the GPRMC and have my GPS clock updating smack and the PPS (and doing other things). I set the timer to look at the time it takes to diplay the time and date to the LCD. It looks like it's 62 to 63 ms from the calling of your LCD routine and back again. I can see the slight delay between the PPS LED and the LCD update. Can we write to the LCD with a faster routine? I'm not asking you to do it but just asking! Regards Talbit Trevor Talbit |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3194 |
I do not think that you could speed it up by much. But, how about this for an idea. After you receive the time and pulse your led, why don't you time 938 mS after the pulse then write the time for the next second to the LCD. It will be in sync. If you are after split second accurate timekeeping you will also need to consider the delay involved in receiving and decoding the GPRMC string. From what I know, the second starts at the start of the string. That means that your program will only discover that a new second has occurred about 130 mS after the event. You could adjust your delay to also take that into account. Geoff Geoff Graham - http://geoffg.net |
||||
Talbit Senior Member Joined: 07/06/2011 Location: AustraliaPosts: 210 |
Geoff, Thanks once again for your replies. Yes - after I received your reply this morning I thought of just that. Let me tell you what I have done. I need a clock for seismic use, i.e. to place minute, hour and day marks on a seismic drum recorder “Helicorder”. This is called “SLOW CODE”. I can’t find a clock that will do it. The “Truetime” clocks are the only ones that could do it but are no longer available and if you can get one then they are frightfully expensive. The problem with the GPS is that the NMEA string arrives AFTER the PPS. You can see this when you just display the NMEA string when it arrives – it’s about 250ms after the PPS. I built your GPS car computer and it too suffers from this. The Maximite is an ideal solution. I have the time marks pretty spot on although I’m yet to measure them on a CRO using the PPS as the reference. The time marks are the most important thing but as I said the update of the LCD is acceptable but still noticeable. What other people do is to have a free running clock and slowly correct it using the PPS. This means that if the GPS is lost then the clock still runs but gradually loses sync. I could go this way. With the Maximite code I have written, I read the port at 19200, I parse the $GPRMC, add 1 second to the time and wait for the PPS. When the PPS arrives, I immediately toggle a MM pin for the SLOW CODE – then I update the display. It all works very well – apart from the delay in the LCD. So the idea of the delay from the PPS to just before the next PPS is a better way to go. I’ll work on that approach next. Do you think anyone would be interested in what I’m doing? Should I bother posting my code? Regards Trevor Talbit |
||||
vasi Guru Joined: 23/03/2007 Location: RomaniaPosts: 1697 |
Hi Trevor, Any open source project matter for Maximite (the more complex the better). If no one from here have a use for it, is important for Maximite portfolio (the projects are the best recommendation for Maximite). Thank you for your effort and contribution. Vasi Hobbit name: Togo Toadfoot of Frogmorton Elvish name: Mablung Miriel Beyound Arduino Lang |
||||
Talbit Senior Member Joined: 07/06/2011 Location: AustraliaPosts: 210 |
Thanks Vasi, What is the correct procedure to post the code. Isn't there a special place on this forum to place code? It is about 3 pages long. Trevor Talbit |
||||
Gizmo Admin Group Joined: 05/06/2004 Location: AustraliaPosts: 5078 |
You can use the CODE tags to place code within a post. Its the little "code" button. You can also use Dons Maximite files space on the Maximite site http://www.themaximitecomputer.com Glenn The best time to plant a tree was twenty years ago, the second best time is right now. JAQ |
||||
Print this page |