02-19-2009 07:37 AM
Hi everyone!
I'm working with the MCB2300 development board and want to program the microcontroller (NXP LPC2378) with LabVIEW Embedded for ARM. In the moment I'm trying to detect an external interrupt. Is there any possibility to do this in LabVIEW without using a c-node? I know that you can use a timed loop or a VI as an interrupt handler for timer interrupts. If you click the "Creates a new interrupt handler VI"-Button in the "manage interrupts"-dialog, you get a new VI with a case structure and a vector, which is the selector. Unfortunately the help gives no further information.
It would be very kind, if somebody with more know-how than me could give me a tip, how to go on...
Regards
Joscha
02-19-2009 11:28 AM
Joscha,
Based upon your description I understand what you are trying to do, and I believe this should be possible in LabVIEW. I will be escelating your question to our ARM developers. My question for you is what version of LabVIEW and the ARM Embedded development module are you using?
Cheers,
Mark
02-19-2009 10:58 PM
Also, do you simply want access to a button as an external interrupt, or any GPIO?
In order to use a new interrupt, you will need to create some c files (for initialization of the interrupt, etc.) and modify an XML file. I'm sure you can find out the details of this process through further talks with support.
good luck!
02-20-2009 07:18 AM - edited 02-20-2009 07:20 AM
Thanks for your quick answers.
I'm working with following versions:
LabVIEW 8.51
Embedded Module for ARM Microcontrollers 1.0 (I'm not really sure, but there are no ARM CAN Vis available like in version 1.1)
I need access to interrupts of any GPIO (would be great) or to interrupts of the EINT-pins
Regards
Joscha
02-20-2009 12:12 PM - edited 02-20-2009 12:13 PM
Hi Joscha,
I threw together a quick example that uses external interrupt 0 (the blue button on the MCB2300).
Download this zip file and extract it over your Keil\Embedded\RealView folder. Once the files are in the proper location, you will need to create a new MCB2300 target in your project to see the changes.
A short explanation of the files...
ExtInt0.c and ExtInt0.h
- used for initializing the interrupt and clearing the interrupt once it fires
LV_RV_ExtInt_config.vi
- this is the dialogue that pops up when you click "Configure..." on the manager interrupts page (in build spec) and allows you to specify level vs edge triggering and polarity
LPC2378_Append_Initialization.vi
- i had to change this to add a case for the new interrupt, such that the initialization function is called properly
interrupt.xml
- this is the file that ties the whole thing together, if you scroll to the bottom you can see where I added the new interrupt. The XML format is standard to LabVIEW structures.
thanks
edit: Also, you probably want to avoid using P2.10 for anything else while you are using this interrupt.
02-20-2009 04:47 PM
Thank you very much!
I will try to make it run as soon as possible (next tuesday).
Regards,
Joscha
02-24-2009 07:03 AM - edited 02-24-2009 07:11 AM
Hi Gmg!
I tried to make your example run today, but unfortunately I had some problems. After I had copied the files in the folders you described I couldn't choose no interrupts in the "manage interrupts" window (image1) anymore ("Kein Pfad" means "No path"). I think it has to do with the interrupt.xml file, if I work with the original version of this file, everything runs correctly (without the new interrupt, of course).
If I try to build my project (with the new interrupt.xml), I get the second error (image2). The first line of the message means: "Convert back from XML to Emb_Read_Interrupt_XML.vi.
I'm programming my code in a generic and not a MCB2300 project, by the way. In this way I'm able to use all the GPIOs easily. Am I right, if I think, that I only have to copy the xml-file in the LPC2378-folder?
Regards,
Joscha
02-24-2009 11:30 AM
Hello Joscha.
I guess I was a bit hasty in creating this example and assumed backwards compatibility. The above posted example will work in 8.6 and later.
That said, I've attached the interrupt.xml files that will work for 8.5. I've attached one for the MCB2300 and the LP2378 as they are not interchangable (they contain relative paths). You will need to rename them to interrupt.xml after placing them in their respective folders.
02-26-2009 09:10 AM
Hi Gmg!
With the new interrupt.xml everything runs correctly! This is big step for my work, thank you very much! I tried to add another external interrupt (EINT3 / PIN 2.13), but had no success.
You can download my added / adjusted files below. Again, there are no interrupts to choose in the "manage interrupts" window. So maybe there is something wrong with the interrupt.xml again. It would be very kind, if you could take a short look over my files.
Is there any possibility to detect every edge of the signal (positve and negative), by the way? One way could be to change the value of the EXTPOLAR register after every interrupt...
Regards,
Joscha
02-26-2009 11:58 AM
Glad to hear it worked for you.
If you look at the top of your XML you will see the line <Dimsize>4</Dimsize>. This is the size of your interrupt array. Since you added an interrupt you should change this value to 5.
I took a quick look at the user manual for the lpc2378 and there is no mode for triggering on both edges. Thus you will need to toggle EXTPOLAR after each interrupt. I suggest doing this in a prefunction (must modify the XML to call this) or postfunction for your interrupt.