pic 18f47k40 timer interrupt problem

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 7.

Moderator: Benj

Post Reply
TaliG
Posts: 52
Joined: Fri Apr 07, 2017 1:55 am
Location: Greece
Has thanked: 16 times
Been thanked: 14 times
Contact:

pic 18f47k40 timer interrupt problem

Post by TaliG »

Hi,
I am working with a pic18F47k40 device and I am getting errors while trying to compile in .hex. (see attached pic)
In simulation everything works fine.

Project compiles fine into .hex and runs ok in hardware if I do not use timer interupts, timers or interrupts in general.

Can this problem be related to PIC32 interrupts problem?
viewtopic.php?f=63&t=18182

Thank you.
Attachments
Untitled1.png
(54.3 KiB) Downloaded 6104 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: pic 18f47k40 timer interrupt problem

Post by Benj »

Hello,

Thanks for letting us know.
Can this problem be related to PIC32 interrupts problem?
No this is just a register naming problem in the device definition file. Let me investigate for you and it should be a relatively easy fix.

TaliG
Posts: 52
Joined: Fri Apr 07, 2017 1:55 am
Location: Greece
Has thanked: 16 times
Been thanked: 14 times
Contact:

Re: pic 18f47k40 timer interrupt problem

Post by TaliG »

Thank you very much for your prompt response.

I have also noticed some PWM component properties (PWM pin, Remap pin) cannot be configured.

Thanks

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: pic 18f47k40 timer interrupt problem

Post by Benj »

Hello,

Right here are some updated definition files for the device family which should solve all the timer interrupt related compile errors and hopefully provide some PWM pins.
PIC_update.zip
(70.43 KiB) Downloaded 327 times

TaliG
Posts: 52
Joined: Fri Apr 07, 2017 1:55 am
Location: Greece
Has thanked: 16 times
Been thanked: 14 times
Contact:

Re: pic 18f47k40 timer interrupt problem

Post by TaliG »

Amazing! :shock:

I will test tomorrow and confirm but I am quite confident it is going to work :D

Many thanks!

TaliG
Posts: 52
Joined: Fri Apr 07, 2017 1:55 am
Location: Greece
Has thanked: 16 times
Been thanked: 14 times
Contact:

Re: pic 18f47k40 timer interrupt problem

Post by TaliG »

Hi,

Timer interrupts tested and working on hardware except timer0.

Interrupt On Change (IOC) produces the same compiler errors like TimerInterupt did.
Also on the options menu only RB4-7 and only on both edges is available to choose from, while in the datasheet Port A, B, C and pinRE3, rising or falling edge are available.

Interrupt on PIN (INTn pin) produces the same compiler errors like TimerInterupt did.
Also in the properties menu there is no option to choose any pin (port A and B can be chosen according to datasheet)

ADC input using EBM003_Thermistor component always defaults to AN0 (RA0) on harware regardless what channel is choosen in component properties.

PWM output does not work on hardware I tried everything :(. PWM output on 16f690 hardware works ok.
I have noticed Mplab Code Configurator lets you configure PWM3 on RA0-5 and PORTD, PWM4 on RA0-5 and PORTC.
I have also noticed that it uses the PPS module in the code it produses in order to configure all the pins. (I dont know if that helps)


Any help would be appreciated.
Thanks

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: pic 18f47k40 timer interrupt problem

Post by Benj »

Hello,

Thanks for letting me know.
Timer interrupts tested and working on hardware except timer0.
Hopefully Timer 0 should also be working now.
Interrupt On Change (IOC) produces the same compiler errors like TimerInterupt did.
Interrupt on PIN (INTn pin) produces the same compiler errors like TimerInterupt did.
These should also now be fixed and configurable.
PIC.zip
(75.57 KiB) Downloaded 297 times
Investigating the other issues now.

TaliG
Posts: 52
Joined: Fri Apr 07, 2017 1:55 am
Location: Greece
Has thanked: 16 times
Been thanked: 14 times
Contact:

Re: pic 18f47k40 timer interrupt problem

Post by TaliG »

Hex compile test with INTon Pin :(

I could not get timer0int to work :(

Thank you for your great support :) I will investigate the rest when i come back from work.
Attachments
12.png
(11.48 KiB) Downloaded 6043 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: pic 18f47k40 timer interrupt problem

Post by Benj »

Hello,

I'm not getting those compile errors any more with the latest definitions so hopefully they are fixed, maybe you need to re-open Flowcode?

I have improved the PWM CAL component now so that the alternate remap pin banks are now available for you to use.

The file needs to be copied into your "Flowcode 7/Components" directory before restarting Flowcode.
cal_pwm.fcpx
(9.78 KiB) Downloaded 296 times
I'll see if I can find out now why the PWM is not firing up for you, probably due to the timer differences on these devices.

TaliG
Posts: 52
Joined: Fri Apr 07, 2017 1:55 am
Location: Greece
Has thanked: 16 times
Been thanked: 14 times
Contact:

Re: pic 18f47k40 timer interrupt problem

Post by TaliG »

I am very sorry.
My mistake on unpacking and replacing the files :oops:

Timer0 tested and works nicely on the hardware
IOC fixed and works on the harware.
INTn Pin fixed and works on hardware.
Very nice job with INTnPin and IOC pin select properties. :D

About the PWM Im getting this compiler error
PWM.png
(27.74 KiB) Downloaded 6029 times
Please have a look at the code mplab code configurator produses for CCP1-2 and PWM3-4
I will try to use the C code block and some or all of the genarated code in the attachment to enable the PWM. I hope it doesnt explode or anything :mrgreen:

Anyway
Thanks alot for your support!
Attachments
mcc_generated_files.rar
(151.01 KiB) Downloaded 272 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: pic 18f47k40 timer interrupt problem

Post by Benj »

Thanks for letting me know.

Hopefully the last set of updates files here. These should fix the compilation errors for channels 3 and 4 and also allow the PWM to spring into life on all channels and timer options.
PIC.zip
(76.08 KiB) Downloaded 277 times
Let me know how you get on.

TaliG
Posts: 52
Joined: Fri Apr 07, 2017 1:55 am
Location: Greece
Has thanked: 16 times
Been thanked: 14 times
Contact:

Re: pic 18f47k40 timer interrupt problem

Post by TaliG »

Thanks Benj!

Compilation errors gone.

Sadly , I could not get a PWM output to work though :(

Thanks for your help!

Post Reply