PICmicro & dsPIC >> PICmicro & dsPIC

Pages: 1
winchymatt



Reged: Mar 09 2004
Posts: 29
Loc: Hants, UK
Interrupts on a PIC32MX device
      #96042 - Tue Feb 03 2009 10:36 PM

Hi,

I'm currently trying to migrate an existing dsPIC33 project across to a PIC32MX device, I have managed to port most of the code, but have got stuck on how to use the interrupts on the PIC32 device.

If anyone has any examples, or useful links.. please let me know.

Many thanks,

--------------------
M@


Post Extras: Print Post   Remind Me!   Notify Moderator  
winchymatt



Reged: Mar 09 2004
Posts: 29
Loc: Hants, UK
Re: Interrupts on a PIC32MX device [Re: winchymatt]
      #96062 - Wed Feb 04 2009 02:53 AM

Well I thought I had made some progress, I found the following MACROS to be incorrect in the PIC32.H file:

Code:
 
// Oscillator Selection bits
// macro: FPLLODIV(s)
// creates the config setting for the default postscaler for PLL bits
// where PLL output divided is dived by 2^(s)
// pre: 0 <= s <= 7
#define __FPLLODIV(s) (0xFFF8FFFF | ((s)<<16))

#define FPPLODIV_1 __FPPLODIV(0)
#define FPPLODIV_2 __FPPLODIV(1)
#define FPPLODIV_4 __FPPLODIV(2)
#define FPPLODIV_8 __FPPLODIV(3)
#define FPPLODIV_16 __FPPLODIV(4)
#define FPPLODIV_32 __FPPLODIV(5)
#define FPPLODIV_64 __FPPLODIV(6)
#define FPPLODIV_128 __FPPLODIV(7)
#define FPPLODIV_256 __UNPROG



The error being a misspelling of FPPLODIV... which should be FPLLODIV...

So fixed this, found a "Getting Started" tutorial on interrupts, ran the tutorial, all ok, switch back to my PIC33F ported application,
make some adjustments, hit compile.. the compiler makes all of the files without errors:

Code:

Make: The target "C:\Work\Projects\PIC\C\p.Brain-ds24 HexEngine\PIC32\output\analogue.p1" is up to date.
Make: The target "C:\Work\Projects\PIC\C\p.Brain-ds24 HexEngine\PIC32\output\bluetooth.p1" is up to date.
Make: The target "C:\Work\Projects\PIC\C\p.Brain-ds24 HexEngine\PIC32\output\calibrat.p1" is up to date.
Make: The target "C:\Work\Projects\PIC\C\p.Brain-ds24 HexEngine\PIC32\output\cmd_calib.p1" is up to date.
Make: The target "C:\Work\Projects\PIC\C\p.Brain-ds24 HexEngine\PIC32\output\cmd_config.p1" is up to date.
Make: The target "C:\Work\Projects\PIC\C\p.Brain-ds24 HexEngine\PIC32\output\cmd_ctrl.p1" is up to date.
Make: The target "C:\Work\Projects\PIC\C\p.Brain-ds24 HexEngine\PIC32\output\cmd_norm.p1" is up to date.
Make: The target "C:\Work\Projects\PIC\C\p.Brain-ds24 HexEngine\PIC32\output\command.p1" is up to date.
Make: The target "C:\Work\Projects\PIC\C\p.Brain-ds24 HexEngine\PIC32\output\command_api.p1" is up to date.
Make: The target "C:\Work\Projects\PIC\C\p.Brain-ds24 HexEngine\PIC32\output\config_functions.p1" is up to date.
Make: The target "C:\Work\Projects\PIC\C\p.Brain-ds24 HexEngine\PIC32\output\delay.p1" is up to date.
Make: The target "C:\Work\Projects\PIC\C\p.Brain-ds24 HexEngine\PIC32\output\eeprom.p1" is up to date.
Make: The target "C:\Work\Projects\PIC\C\p.Brain-ds24 HexEngine\PIC32\output\file.p1" is up to date.
Make: The target "C:\Work\Projects\PIC\C\p.Brain-ds24 HexEngine\PIC32\output\legik.p1" is up to date.
Make: The target "C:\Work\Projects\PIC\C\p.Brain-ds24 HexEngine\PIC32\output\main.p1" is up to date.
Make: The target "C:\Work\Projects\PIC\C\p.Brain-ds24 HexEngine\PIC32\output\movecube.p1" is up to date.
Make: The target "C:\Work\Projects\PIC\C\p.Brain-ds24 HexEngine\PIC32\output\pod.p1" is up to date.
Make: The target "C:\Work\Projects\PIC\C\p.Brain-ds24 HexEngine\PIC32\output\podeng.p1" is up to date.
Make: The target "C:\Work\Projects\PIC\C\p.Brain-ds24 HexEngine\PIC32\output\podscrn.p1" is up to date.
Make: The target "C:\Work\Projects\PIC\C\p.Brain-ds24 HexEngine\PIC32\output\ps2gamepad.p1" is up to date.
Make: The target "C:\Work\Projects\PIC\C\p.Brain-ds24 HexEngine\PIC32\output\serial.p1" is up to date.
Make: The target "C:\Work\Projects\PIC\C\p.Brain-ds24 HexEngine\PIC32\output\speed.p1" is up to date.
Make: The target "C:\Work\Projects\PIC\C\p.Brain-ds24 HexEngine\PIC32\output\t1_isr.p1" is up to date.
Make: The target "C:\Work\Projects\PIC\C\p.Brain-ds24 HexEngine\PIC32\output\WIIControl.p1" is up to date.
Make: The target "C:\Work\Projects\PIC\C\p.Brain-ds24 HexEngine\PIC32\output\pwm.p1" is up to date.
Make: The target "C:\Work\Projects\PIC\C\p.Brain-ds24 HexEngine\PIC32\output\interupt.p1" is up to date.
Make: The target "C:\Work\Projects\PIC\C\p.Brain-ds24 HexEngine\PIC32\output\initcode.p1" is up to date.
Executing: "C:\Program Files\HI-TECH Software\PICC32\PRO\9.60\bin\picc32.exe" -oHexEngine_P32n.elf -mHexEngine_P32n.map --summary=default,-psect,+class,+mem,-hex --interrupts=multi,boot,rom --output=default analogue.p1 bluetooth.p1 calibrat.p1 cmd_calib.p1 cmd_config.p1 cmd_ctrl.p1 cmd_norm.p1 command.p1 command_api.p1 config_functions.p1 delay.p1 eeprom.p1 file.p1 legik.p1 main.p1 movecube.p1 pod.p1 podeng.p1 podscrn.p1 ps2gamepad.p1 serial.p1 speed.p1 t1_isr.p1 WIIControl.p1 pwm.p1 interupt.p1 initcode.p1 --chip=32MX320F128H -P --runtime=default,+clear,+init,-keep,+stack,+heap,+gpr,+nmi,+cp0,+soft,+config,+clib,+plib,+perform --opt=default,+asm,+speed,-space,9 --warn=0 --isa=mips32r2 -DPBRAIN_P32 -D__DEBUG=1 -g --asmlist "--errformat=Error [%n] %f; %l.%c %s" "--msgformat=Advisory[%n] %s" "--warnformat=Warning [%n] %f; %l.%c %s"
HI-TECH C PRO for the PIC32 MCU Family candidate build 3453 V9.60PL1
Copyright (C) 1984-2008 HI-TECH SOFTWARE
Serial number: HCPIC32-xxxxx




but crashes shortly after with the windows error message:

cgpic32.exe has encountered a problem and needs to close. We are sorry for the inconvenience.

???

--------------------
M@


Post Extras: Print Post   Remind Me!   Notify Moderator  
Neil_K

***

Reged: Mar 10 2005
Posts: 1824
Loc: NY,USA
Re: Interrupts on a PIC32MX device [Re: winchymatt]
      #96072 - Wed Feb 04 2009 03:01 AM

If you found errors in a header file contact Support.
The may also want to see you project if it is crashing the compiler.


Post Extras: Print Post   Remind Me!   Notify Moderator  
winchymatt



Reged: Mar 09 2004
Posts: 29
Loc: Hants, UK
Re: Interrupts on a PIC32MX device [Re: winchymatt]
      #96082 - Wed Feb 04 2009 04:00 AM

Well, it turns out the "Speed" optimisation setting is what's crashing the compiler. But I'm now dealing with a bunch of other error messages.

I will submit a support query soon.

--------------------
M@


Post Extras: Print Post   Remind Me!   Notify Moderator  
winchymatt



Reged: Mar 09 2004
Posts: 29
Loc: Hants, UK
Re: Interrupts on a PIC32MX device [Re: winchymatt]
      #96092 - Wed Feb 04 2009 04:12 AM

WooHoo!

Got it to compile.. however there was one more error which is worthy of hi-tech support:

If I use "sscanf" in my code, the following error occurs:


Error [499] ; 0. undefined symbol:
__scanf_buf_(HexEngine_P32n.obj)


--------------------
M@


Post Extras: Print Post   Remind Me!   Notify Moderator  
luckyAdministrator
Microchip staff
*****

Reged: Oct 06 2003
Posts: 1215
Loc: Brisbane, Australia
Re: Interrupts on a PIC32MX device [Re: winchymatt]
      #96112 - Wed Feb 04 2009 07:36 AM

Quote:

HI-TECH C PRO for the PIC32 MCU Family candidate build 3453 V9.60PL1
Copyright (C) 1984-2008 HI-TECH SOFTWARE
Serial number: HCPIC32-xxxxx







I'd recommend using the official 9.60PL1 release, rather than the earlier candidate release.
Also, you may find it useful to use the Microchip-compatible peripheral library which includes many examples.

--------------------
Matt Luckman


Post Extras: Print Post   Remind Me!   Notify Moderator  
winchymatt



Reged: Mar 09 2004
Posts: 29
Loc: Hants, UK
Re: Interrupts on a PIC32MX device [Re: lucky]
      #96122 - Wed Feb 04 2009 07:38 AM

Quote:

Quote:

HI-TECH C PRO for the PIC32 MCU Family candidate build 3453 V9.60PL1
Copyright (C) 1984-2008 HI-TECH SOFTWARE
Serial number: HCPIC32-xxxxx







I'd recommend using the official 9.60PL1 release, rather than the earlier candidate release.
Also, you may find it useful to use the Microchip-compatible peripheral library which includes many examples.




I have most working now, but have submitted a couple of support questions WRT printf/sprintf issues.

Indecently, where can I get 9.60 PL1 ?

EDIT: Found it.. will install and give it a go.

--------------------
M@

Edited by winchymatt (Wed Feb 04 2009 07:42 AM)


Post Extras: Print Post   Remind Me!   Notify Moderator  
winchymatt



Reged: Mar 09 2004
Posts: 29
Loc: Hants, UK
Re: Interrupts on a PIC32MX device [Re: winchymatt]
      #96142 - Wed Feb 04 2009 07:45 AM

Installed and tested V9.60 PL1. Same issues so will wait for support response.

--------------------
M@


Post Extras: Print Post   Remind Me!   Notify Moderator  
jamz_az
stranger


Reged: Aug 03 2012
Posts: 1
Re: Interrupts on a PIC32MX device [Re: winchymatt]
      #237202 - Fri Aug 03 2012 12:19 PM

Not trying to hijack this thread but,,,

I am having very similar issues also using the Hitech MX32 example code in the /samples dir for INT routines, many errors on compile.

These examples don't seem to even compile without errors.
I've tried many the SPI, TimerInt and get compiler errors. I'm running the latest HTC PIC32 dnld in lite mode.
What good are all these examples that don't work.

Did you ever get this working or an answer for the issue?


Post Extras: Print Post   Remind Me!   Notify Moderator  
Neil_K

***

Reged: Mar 10 2005
Posts: 1824
Loc: NY,USA
Re: Interrupts on a PIC32MX device [Re: jamz_az]
      #237212 - Sat Aug 04 2012 08:27 AM

This forum is effectively closed.
Try posting at the Microchip Forum. (Microchip bought Hi-Tech)


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1



Extra information
0 registered and 10 anonymous users are browsing this forum.

Moderator:  mikerj, jtemples, jeff, Dan Henry, Andrew L 

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is enabled
      UBBCode is enabled

Rating:
Topic views: 20612

Rate this topic

Jump to

Contact Us | Privacy statement HI-TECH Software

Powered by UBB.threads™ 6.5.5