Would you like to react to this message? Create an account in a few clicks or log in to continue.

You are not connected. Please login or register

PIC enhanced Mid-Range core and 16F1826.

2 posters

Go to page : Previous  1, 2, 3

Go down  Message [Page 3 of 3]

51PIC enhanced Mid-Range core and 16F1826. - Page 3 Empty Interupts Testing Sat Jan 22, 2022 9:04 am

MSABU



Mixed results on that front.
INT (PIN RB0) working great : catches the interrupt every time it is triggered.

Timer 0 Overflow : Running on INTOSC. The TMR0 register increases properly but the interrupt is never generated on overflow.

USART receives : works only once. Interrupt is triggered when sending a value or character but only once. When sending again nothing happens.

arcachofo

arcachofo

INT (PIN RB0) working great : catches the interrupt every time it is triggered.
Nice, PORT INT interrupts marked as working.

Timer 0 Overflow : Running on INTOSC. The TMR0 register increases properly but the interrupt is never generated on overflow.
Timer0 overflow interrupt is working in my test circuit.
Can you attach here circuit and firmware (source code)?

USART receives : works only once. Interrupt is triggered when sending a value or character but only once. When sending again nothing happens.
I have no test circuit for this, just tested serial echo in Serial Monitor.
Can you attach here circuit and firmware (source code)?

53PIC enhanced Mid-Range core and 16F1826. - Page 3 Empty Compillation issue Sat Jan 22, 2022 8:30 pm

MSABU



Something else came up. I can only test up to R857.
I have bzr version R875 and it does not generate the appimage.
Compilation stops with :

In file included from ../src/mcusim/e_mcu.h:26,
from ../src/mcusim/e_mcu.cpp:20:
../src/mcusim/mcutimer.h:25:10: fatal error: mcuprescaled.h: No such file or directory
25 | #include "mcuprescaled.h"
| ^~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:3457: build/objects/e_mcu.o] Error 1

Any idea ??

arcachofo

arcachofo

../src/mcusim/mcutimer.h:25:10: fatal error: mcuprescaled.h: No such file or directory
Sorry I forgot to upload those files.
Solved at Rev 880.

EDIT:
xml files for MCUs have been refactored.

arcachofo

arcachofo

Hi.
Don't use Rev 880, it has an ugly error, use 881 instead.

56PIC enhanced Mid-Range core and 16F1826. - Page 3 Empty TIMER 0 Overflow Sun Jan 23, 2022 12:04 am

MSABU



Here is the error message I get when running the sim :

Interrupts::retI Error: No active Interrupt

The circuit has nothing but the 16F1826 alone with an LED on RB3 to visualize the interrupt.
Here is the code :
Code:
'Select chip 4 MHz
#CHIP  16f1826,16
#OPTION Explicit
#config OSC = INTOSC, WDT = OFF, MCLRE=OFF

IntOn

  TMR0CS = 0  'TIMER 0 on Internal instruction cycle clock (F OSC /4)
  PSA = 0    'Prescaler is assigned to the Timer0 module
  PS0 = 0  'Prescaler Rate Select bits  Timer0 Rate 1 : 2
  PS1 = 0  '
  PS2 = 0  '
  TMR0IE = 1    'TIMER 0 Interupt enabled
  TMR0IF = 0    'Make sure that Interupt Flag is cleared
  ' Define the USART port
  #define USART_BAUD_RATE 9600
  #define USART_BLOCKING
  #define USART_DELAY off
  #define SerInPort RB1
  #define SerOutPort RB2

; ----- Define Port Directions
Dir SerInPort IN
Dir SerOutPort OUT

   HSerPrint "Test 16F1826 USART Communication"
   HSerPrintCRLF

  On Interrupt Timer0Overflow Call readTMR0

Do
   Wait 50 ms
Loop

Sub readTMR0
   RB5 = 1
   TMR0IF = 0
   HSerPrint "TMR0 Interupt"
   HSerPrintCRLF
   RB5 = 0
End Sub

end


arcachofo

arcachofo

Thanks.
I'm getting the interrupts, so at least interrupts are triggered.

Here is the error message I get when running the sim :
Interrupts::retI Error: No active Interrupt
This is an interesting one...
I think what is happening is that HSerPrint inside interrupt routine is taking longer that the next Timer0 interrupt.
And this case is not being handled correctly.

And I'm not getting the complete first msg: "Test 16F1826 USART Communication"
Not sure but probably the first interrupts start to fire before this msg is fully written.

arcachofo

arcachofo

arcachofo wrote:I think what is happening is that HSerPrint inside interrupt routine is taking longer that the next Timer0 interrupt.
And this case is not being handled correctly.

And I'm not getting the complete first msg: "Test 16F1826 USART Communication"
Not sure but probably the first interrupts start to fire before this msg is fully written.
Yes, definetly HSerPrint inside interrupt routine is making both things.

The error: "Interrupts::retI Error: No active Interrupt" is not related to 16F1826.
I'm trying to catch this problem, but it only happens some times.

arcachofo

arcachofo

Testing Timer2 something weird is happenig:
With XC8 compiler it breaks __delay_ms()

Lets see what happens if you test Timer 2 in gcbasic.

60PIC enhanced Mid-Range core and 16F1826. - Page 3 Empty Compilation issue Sun Jan 23, 2022 10:09 am

MSABU



Still no luck with compiling R881, looks like another file might be missing "esp01.png". I have looked into other versions to locate it but no success.

See compiler output :

make: *** No rule to make target '../src/icons/components/esp01.png', needed by 'qrc_application.cpp'. Stop.

MSABU



Arcachofo wrote:I think what is happening is that HSerPrint inside interrupt routine is taking longer that the next Timer0 interrupt.

I have removed all HserPrint and still no output from the Timer 0 Overflow routine.

arcachofo

arcachofo

Still no luck with compiling R881, looks like another file might be missing "esp01.png". I have looked into other versions to locate it but no success.

See compiler output :

make: *** No rule to make target '../src/icons/components/esp01.png', needed by 'qrc_application.cpp'. Stop.
Hopefully solved at Rev 885.

I have removed all HserPrint and still no output from the Timer 0 Overflow routine.
You probably need last changes to make it work.

63PIC enhanced Mid-Range core and 16F1826. - Page 3 Empty Compilation issue Mon Jan 24, 2022 12:04 am

MSABU



Back in the game with R888.
Confirming as well that Timer 0 overflow triggers the interrupt properly.
I am able to output long serial strings by deactivating the interrupts within the subroutine.

However same behavior on Rx interrupt, It fires when first receiving something but then stops firing for whatever gets sent after the 1st one.

arcachofo

arcachofo

Back in the game with R888.
Confirming as well that Timer 0 overflow triggers the interrupt properly.
I am able to output long serial strings by deactivating the interrupts within the subroutine.
Nice.
And sorry for the inconvenience with missing files.
Then we consider Timer0 working.

However same behavior on Rx interrupt, It fires when first receiving something but then stops firing for whatever gets sent after the 1st one.
Ok, I will have a look and let you know when it is solved.

arcachofo

arcachofo

However same behavior on Rx interrupt, It fires when first receiving something but then stops firing for whatever gets sent after the 1st one.
I fixed some issuess related to PIC interrupts, not related to Usart RC Interrupt, but it is working for me now.
If it does not work for you, please share your code to test it.

Sponsored content



Back to top  Message [Page 3 of 3]

Go to page : Previous  1, 2, 3

Permissions in this forum:
You cannot reply to topics in this forum