Great News - Change log entry: 615 New Millis Initial formal release of millis.h
It is ready for real time (Pun Intended) and will be included in the upcoming release of Great Cow BASIC as a core Library.
It has been extensively tested on all PIC (10,12,16,18) and AVR families supported by GCBASIC and example files will be included in the release.
The holdup was caused by uncovering a couple of low level compiler errors which have now been fixed so, whilst Evan and I have been silent for the past few weeks, millis was never dead it was still being used as a debug tool to stress test the compiler.
It has already proven useful in a couple of projects too so I expect to see more when it is formally released with the New Compiler and the community get to use it too.
Here is a n example for the Arduino Mega to whet your appetites
''500mSflashfora1HzsquarewaveonPIN13(PORTB.7)'#chip mega2560,16 ' Declare the Target Processor and Speed#option explicit ' Require Explicit declaration of Variables#include<millis.h> ' Include the Library#define LED PORTB.7 ' Define the LED Pin - Digital Pin 2#define LEDRate 500 ' Flash rate in mS'SetupDirLEDOut'MaketheLEDPinanOutputLED=0DimCurMs,LstMsasword'declareworkingvariables'Main'Thislooprunsoverandoverforever.LstMs=0CurMs=0'Main'Thislooprunsoverandoverforever.DoCurMs=millis()ifCurMs-LstMs>=LEDRatethen'requiredTimehasElapsedLED=!LED'SoTogglestateofLEDLstMs=CurMs'AndRecordToggleTimeendifLoopEND
Cheers
Chris
Last edit: Chris Roper 2019-04-04
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Chris, this is really awesome. I always envyed the millis function from arduino. When you say it will be part of core library, does that mean you don't have to use the include? It will be part of the compiler? Thanks again for your effort! Evan too of course!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Good question, I know that it will be distributed with the new release as "Millis.h" but I am not sure if it will be auto included or not. That would be up to Evan when he packages up the release.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
millis.h and the demos will be in the next release.
millis will always require #include <millis.h> as millis has depedencies in terms of the setting up the timer that requires the use of specific clock freqencies.</millis.h>
millis supports PIC and AVR, and the widest set of frequencies. These frequencies are supported.
But, the 'use case' of odd frequencies cannot be automatiically handled and therefore the user can #include and the set user constant to initialise the millis correctly.
Summary: yes - in the release, no - not automatically included.
@Chris. More to add?
Last edit: Anobium 2019-04-08
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Just to Clarify that in the Arduino Environment Millis only had to support one frequency, 16Mhz.
But due to the wide range of frequencies supported by Microchip and the Use of Phase Locked Loops to derive the Clock bus in newer Devices, the GCBASIC version of Millis() was designed from the start to support any binary multiple Clock speed, i.e. 2Mh, 4MHz etc all the way up to 48Mhz and possibly higher.
So if you get a warning that your speed is not supported just choose the nearest binary multiple in your #Chip Statement.
I agree with Evan, as there is the possibility of a warning it should not auto include.
Cheers
Chris
EDIT:
For clarity Arduino Millis actually had to support 1, 2, 4, 8, 12, 16, 20 and 24 but had Issues with 12, 20 and 24Mhz. GCBASIC avoids the issue by sticking with the Binary progressions.
Last edit: Chris Roper 2019-04-05
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Great News - Change log entry: 615 New Millis Initial formal release of millis.h
It is ready for real time (Pun Intended) and will be included in the upcoming release of Great Cow BASIC as a core Library.
It has been extensively tested on all PIC (10,12,16,18) and AVR families supported by GCBASIC and example files will be included in the release.
The holdup was caused by uncovering a couple of low level compiler errors which have now been fixed so, whilst Evan and I have been silent for the past few weeks, millis was never dead it was still being used as a debug tool to stress test the compiler.
It has already proven useful in a couple of projects too so I expect to see more when it is formally released with the New Compiler and the community get to use it too.
Here is a n example for the Arduino Mega to whet your appetites
Cheers
Chris
Last edit: Chris Roper 2019-04-04
Chris, this is really awesome. I always envyed the millis function from arduino. When you say it will be part of core library, does that mean you don't have to use the include? It will be part of the compiler? Thanks again for your effort! Evan too of course!
Good question, I know that it will be distributed with the new release as "Millis.h" but I am not sure if it will be auto included or not. That would be up to Evan when he packages up the release.
millis.h and the demos will be in the next release.
millis will always require #include <millis.h> as millis has depedencies in terms of the setting up the timer that requires the use of specific clock freqencies.</millis.h>
millis supports PIC and AVR, and the widest set of frequencies. These frequencies are supported.
But, the 'use case' of odd frequencies cannot be automatiically handled and therefore the user can #include and the set user constant to initialise the millis correctly.
Summary: yes - in the release, no - not automatically included.
@Chris. More to add?
Last edit: Anobium 2019-04-08
Just to Clarify that in the Arduino Environment Millis only had to support one frequency, 16Mhz.
But due to the wide range of frequencies supported by Microchip and the Use of Phase Locked Loops to derive the Clock bus in newer Devices, the GCBASIC version of Millis() was designed from the start to support any binary multiple Clock speed, i.e. 2Mh, 4MHz etc all the way up to 48Mhz and possibly higher.
So if you get a warning that your speed is not supported just choose the nearest binary multiple in your #Chip Statement.
I agree with Evan, as there is the possibility of a warning it should not auto include.
Cheers
Chris
EDIT:
For clarity Arduino Millis actually had to support 1, 2, 4, 8, 12, 16, 20 and 24 but had Issues with 12, 20 and 24Mhz. GCBASIC avoids the issue by sticking with the Binary progressions.
Last edit: Chris Roper 2019-04-05