If you try the attached code, on the simulator, TIMER1 does not work and remains blocked. If you eliminate the start function call everything goes perfectly, it seems to be timer1=0 inside the function that is causing the problems.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Look ok to me. Loaded the HEX and set a break at address 0x112, and. it breaks as expected with addresses 0x15-0x14 set to 0x0002 ( as time1 with have incremented during the interrupted. This called interrupt latency and is expected).
So, I do not see the issue.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Tried it in Real Sim. Addresses for Timer1 ( 14 and 15 ) are incrementing. With a Break at line 0x114 the program reaches it as expected. So, Timer1 is incrementing.
And, walking the program using {F7} shows Timer1 incrementing.
Last edit: Anobium 2023-11-19
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I thank you for being interested quickly, you are a truly very helpful person. I just wanted to point out this anomaly, I solved it by simply avoiding the function for timer1, so see if you want to find out more, I'm available if necessary.
By the end of the year I will also leave a donation to support GCB
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The issue is directly related to calling a Function ( rather than a Sub ) and not assigning the result to a variable.
Try putting a NOP after start, or put a NOP after start, try compiling with "BASIC code as comments", or, assign the Function dummayvar=start (create the variable dummyvar). Any of these will generate the correct ASM.
My difference to you...I always compile with "BASIC code as comments",
I have a long time to understand why TIMER1 didn't work, the start function completely blocked TIMER1!! How come?
Sorry, I do not understand the question.
Can you help me understand what is happening or not happening?
Sorry, I do not understand the question.
Can you help me understand what is happening or not happening?
If you try the attached code, on the simulator, TIMER1 does not work and remains blocked. If you eliminate the start function call everything goes perfectly, it seems to be timer1=0 inside the function that is causing the problems.
In the simulator if you check the TMR1L and TMR1H registers you will see that the counting does not take place and they remain stationary.
Which simulator?
The usual RealPicSimulator, I only tested this code to better understand the problem it created for me on another program.
Look ok to me. Loaded the HEX and set a break at address 0x112, and. it breaks as expected with addresses 0x15-0x14 set to 0x0002 ( as time1 with have incremented during the interrupted. This called interrupt latency and is expected).
So, I do not see the issue.
In my opinion it's not an Interrupt problem it's just that TIMER1 remains stopped!
Try this and see the simple changes and TIMER1 register
Tried it in Real Sim. Addresses for Timer1 ( 14 and 15 ) are incrementing. With a Break at line 0x114 the program reaches it as expected. So, Timer1 is incrementing.
And, walking the program using {F7} shows Timer1 incrementing.
Last edit: Anobium 2023-11-19
In fact, in the second test everything works, in the first it doesn't, The problem is inside the "TIMER1=0" function which gives some kind of problem
Sorry, with the first GCB I am getting the timer increment.
Post the first line of your ASM. I want to see versions etc.
;Program compiled by GCBASIC (1.01.00 2023-11-15 (Windows 64 bit) : Build 1300) for Microchip MPASM/MPLAB-X Assembler using FreeBASIC 1.07.1/2023-11-15 CRC29
Thank you. We are on the same build. So, that rules out that issue.
The emulator - I am seeing the Timer1 registers increment. So, If you wish I can try on real hardware on Tuesday. But, I expect this to work.
Can you video your issue?
I thank you for being interested quickly, you are a truly very helpful person. I just wanted to point out this anomaly, I solved it by simply avoiding the function for timer1, so see if you want to find out more, I'm available if necessary.
By the end of the year I will also leave a donation to support GCB
Please send me your Sim project file and the hex. I want to resolve for you.
Thank you for your donation. Funds are needed. Not making much progress, last year was a lot easy to raise the funds.
Tomorrow I'll post a new program that highlights the timer block.
Thank you
Try this code, it doesn't work TIMER1 stopped gpio.0 does not change****
Sorry and the opposite this one doesn't work, the previous one works
The program below works in my copy of Real Simulator v1.3.0.0
I get a flashing LED.
This is code - is the the correct code?
I recommend you compare the ASM, try the project with my HEX.
Your HEX works mine NOT!!!
Crikey. I will investigate.
I am travelling for this morning. Check back this p.m.
The issue is directly related to calling a Function ( rather than a Sub ) and not assigning the result to a variable.
Try putting a NOP after
start
, or put a NOP afterstart
, try compiling with "BASIC code as comments", or, assign the Functiondummayvar=start
(create the variabledummyvar
). Any of these will generate the correct ASM.My difference to you...I always compile with "BASIC code as comments",
The compiler should not do what it is doing.
Incorrect ASM.
should be
I will change the compiler to resolve this bug.
What does it mean "BASIC code as comments", can you give me an example
I tried this and it works
' -- Impostazioni TIMER1
InitTimer1 Osc, PS1_8 ' 16_bit interrupt Ticket 250 mS
TMR1IF = 0
inton ' Enable ALL interrupts
StartTimer 1 'start timer1
start
nop
'timer1=0:sec=0