Thanks for the reply. However there is still the max freqency of 65535 problem. Here is your code modified for different display and a video.https://youtu.be/g0k_cdQhXZs
I'm trying counting with 1000 every 1ms interrupts and adding the timer1 overflows every 1ms clearing timer1 each time.
Running a timer0 1ms int and timer1 count overflow is interesting. I either get alternate 65535 or 1Hz or no display frequency and slow mo printing of just the 1 time print "Frequency=". lots of fun
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This code counts timer1 overflows in every ms and adds them up 1000 times. There's still the over flow at 65535 Hz and 60KHz reads around 59590 every second. Don't know why it misses pulses.
There's a line commented out that stops it printing frequency. So the display is stopping timer0?.
GLCDDrawString (0,64,str(number_of_timer1_overflows),ILI9341_white)
So the display is stopping timer0?.
#chip mega328p, 16 ;freqency meter using input on portD.5#option explicit#include<glcd.h>;#define GLCD_TYPE GLCD_TYPE_ILI9341#define GLCD_DC portb.2 ; DIGITAL_10 'HW Data command line DC#define GLCD_CS portd.7 ; DIGITAL_7 ' Chip select line CS#define GLCD_RESET portd.4 ; DIGITAL_4 ' Reset line Tie high..not needed#define GLCD_DO portb.3 ; DIGITAL 11 'HW Data out | MOSI SDI#define GLCD_SCK portb.5 ; DIGITAL_13 'HW Clock Line SCK#define ILI9341_HardwareSPI ' remove/comment out if you want to use software SPI.#define GLCD_EXTENDEDFONTSET1GLCDfntDefaultsize=2GLCDRotate(landscape)GLCDCLSILI9341_BLACK;dimnumber_of_timer1_overflows,number_of_1ms_interrupts,temp_timer1aswordnumber_of_1ms_interrupts=0DimFrequencyasLong;OnInterruptTimer0OverflowCallevery1msInitTimer0Osc,PS_0_64StartTimer0;Inittimer1(EXT,PRE0_1)OninterruptTimer1OverflowCallCounter1Overflow;Cleartimer1number_of_timer1_overflows=0Starttimer1;GLCDDrawString(0,0,"Frequency =",ILI9341_YELLOW)do;GLCDDrawString(0,64,str(number_of_timer1_overflows),ILI9341_white);withthislineitneverprintsfreqency?;if10001msinterruptsoccurredifnumber_of_1ms_interrupts=1000thenstoptimer1Frequency=Frequency*65536+timer1GLCDDrawString(158,0,str(Frequency)+" Hz ",ILI9341_white)clearTimer1number_of_1ms_interrupts=0StartTimer1endifLoop;subCounter1Overflownumber_of_timer1_overflows=number_of_timer1_overflows+1EndSub;subevery1msSettimer0,6'1.002msstoptimer1temp_timer1=timer1;storetimer1valuenumber_of_1ms_interrupts=number_of_1ms_interrupts+1Frequency=Frequency+number_of_timer1_overflows;totalcounter1overflowsnumber_of_timer1_overflows=0;resetnumber_of_timer1_overflowsfornext1msSettimer1,temp_timer1;restoretimer1valueStartTimer1endsub
Last edit: stan cartwright 2017-07-04
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I edited my previous post.It never gets past -- if number_of_1ms_interrupts = 1000 then, so timer0 interrupt is not increasing the var number_of_1ms_interrupts. I searched the glcd include for int.
From the data sheet I don't know if the hardware spi is using the timers.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
OK. I need the source, the LST file and the ASM file. I cannot recreate your code and I am aware that you have some updates to your installation so we do need to see these files to understand.
To my knowledge there are no interrupts in the GLCD code, but, the ASM will tell me a lot more.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This was revealing to me. Probably a problem of my making. You version of the compiler was either issued by me to test something or you could have built this yourself - but, we need to get you on a release the majority of the dev team are using so they can support you. To my knowledge they are not on the patch release you are using.
So, no worry. We just need to get you on a release that is supported and others have the same build.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Indeed. No one else would have made that mistake from it being mentioned once in a help example :)
The answer is out there...somewhere.....not obvious. Bora Da :)
ps my sig gen goes tits above 800KHz...from a mate's duff box it seems.
and I want one like you got for £30 odd quid init ...serious
Last edit: stan cartwright 2017-07-18
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
STR() - The Str function will convert a number into a string. number can be any byte or word variable, or a fixed number between 0 and 65535 inclusive.
Do you think we should update the Help? If yes. Send me some words and I can add to the Help. Please indicate which section etc.
Thank you.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
time lag. I made a mistake others could...with a stretch
Don't assume anything. GCB is different to other basic. Most problems are me not reading the instructions.
It's basic jim but not as you knew it
Last edit: stan cartwright 2017-07-18
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have updated the Help. Published on the web already. The next release will include updates to the IDE Help, improved IDE helper and more examples in the Help with respect to STR() and VAL().
I'll use the online help from now. Scaleing pi is loads of fun but exceeded my attention span. In school trig was as useful as learning Welsh. It was Welsh or latin and they didn't write prescriptions in Welsh then and I didn't want to know how high a flagpole was.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for the reply. However there is still the max freqency of 65535 problem. Here is your code modified for different display and a video.https://youtu.be/g0k_cdQhXZs
I'm trying counting with 1000 every 1ms interrupts and adding the timer1 overflows every 1ms clearing timer1 each time.
Running a timer0 1ms int and timer1 count overflow is interesting. I either get alternate 65535 or 1Hz or no display frequency and slow mo printing of just the 1 time print "Frequency=". lots of fun
I tried using your code with 18f25k22 but the hardware spi uses portC.0. Is that the input pin for ext timer1 count? ie T1CKI
This code counts timer1 overflows in every ms and adds them up 1000 times. There's still the over flow at 65535 Hz and 60KHz reads around 59590 every second. Don't know why it misses pulses.
There's a line commented out that stops it printing frequency. So the display is stopping timer0?.
GLCDDrawString (0,64,str(number_of_timer1_overflows),ILI9341_white)
So the display is stopping timer0?.
Last edit: stan cartwright 2017-07-04
We need the full code. Please attach. Why ? I don't know if you are using hardware twi or any other accessories.
I edited my previous post.It never gets past -- if number_of_1ms_interrupts = 1000 then, so timer0 interrupt is not increasing the var number_of_1ms_interrupts. I searched the glcd include for int.
From the data sheet I don't know if the hardware spi is using the timers.
OK. I need the source, the LST file and the ASM file. I cannot recreate your code and I am aware that you have some updates to your installation so we do need to see these files to understand.
To my knowledge there are no interrupts in the GLCD code, but, the ASM will tell me a lot more.
Files with error line.
This was revealing to me. Probably a problem of my making. You version of the compiler was either issued by me to test something or you could have built this yourself - but, we need to get you on a release the majority of the dev team are using so they can support you. To my knowledge they are not on the patch release you are using.
So, no worry. We just need to get you on a release that is supported and others have the same build.
I just checked the release logs for the compiler. We need anyone helping you, with this, on v.0.97.02 RC 7 or greater.
@Stan. We need you on the same build also - otherwise the mismatch in release may cause issues.
asm file
The overflow after 65535 was due to me using glcdprint (x,y,str(longvar),colour). I should have used str32(varlong).
Oh dear. Oh dear.
Indeed. No one else would have made that mistake from it being mentioned once in a help example :)
The answer is out there...somewhere.....not obvious. Bora Da :)
ps my sig gen goes tits above 800KHz...from a mate's duff box it seems.
and I want one like you got for £30 odd quid init ...serious
Last edit: stan cartwright 2017-07-18
STR() - The Str function will convert a number into a string. number can be any byte or word variable, or a fixed number between 0 and 65535 inclusive.
Do you think we should update the Help? If yes. Send me some words and I can add to the Help. Please indicate which section etc.
Thank you.
time lag. I made a mistake others could...with a stretch
Don't assume anything. GCB is different to other basic. Most problems are me not reading the instructions.
It's basic jim but not as you knew it
Last edit: stan cartwright 2017-07-18
Yes, others may have the same syntax error. Send through all Help file updates please to assist others on the same journey.
Anobium. Joe User likes that and what is the equivelent of floats.. in less than 10 words, You don't win anything though :(
I have updated the Help. Published on the web already. The next release will include updates to the IDE Help, improved IDE helper and more examples in the Help with respect to STR() and VAL().
If you want the latest CHM get it here: http://gcbasic.sourceforge.net/help/output/ There are many formats - remember if you download the CHM to your computer you will have to UNBLOCK the file. See http://digital.ni.com/public.nsf/allkb/B59D2B24D624B823862575FC0056F3D0 for more information.
I'll use the online help from now. Scaleing pi is loads of fun but exceeded my attention span. In school trig was as useful as learning Welsh. It was Welsh or latin and they didn't write prescriptions in Welsh then and I didn't want to know how high a flagpole was.