External Interruption 18F2550 and 18F14K50

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

Moderator: Benj

Post Reply
Genilsonsa
Posts: 150
Joined: Mon Oct 15, 2012 5:19 pm
Has thanked: 12 times
Been thanked: 18 times
Contact:

External Interruption 18F2550 and 18F14K50

Post by Genilsonsa »

I'm trying to use an external interrupt with the pic 18f2550 and 18f14k50, however on my hardware it does not work correctly. I made a simple program to send a given letter F by the HID usb so when the External intervention is triggered in PORTB 0. but it keeps sending the lyrics without stopping. You can help me.
Attachments
Interface de Musica Microplay 2017 USB.fcfx
(11.08 KiB) Downloaded 359 times

Genilsonsa
Posts: 150
Joined: Mon Oct 15, 2012 5:19 pm
Has thanked: 12 times
Been thanked: 18 times
Contact:

Re: EXTERNAL INTERRUPTION 18F2550 AND 18F14K50

Post by Genilsonsa »

In the proteus it simulates perfectly when there is a change of state of portb 0, however in my hardware it always sends the letter again and again. It seems that it gets lost inside the routine.

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: EXTERNAL INTERRUPTION 18F2550 AND 18F14K50

Post by Benj »

Hello,

What does your hardware look like. Specifically the circuitry connected to the interrupt pin. Are you switching the pin rail to rail e.g. Voltages close to VCC and VSS?

Also do you need the icon to read B0 into variable credito in your program? Maybe this is having an effect?

Genilsonsa
Posts: 150
Joined: Mon Oct 15, 2012 5:19 pm
Has thanked: 12 times
Been thanked: 18 times
Contact:

Re: External Interruption 18F2550 and 18F14K50

Post by Genilsonsa »

Hello Benj thanks again for replying to me. My hardware is a button when triggered it goes to the GND. I will try putting the input icon associated with the credito B0 and I will test.

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: External Interruption 18F2550 and 18F14K50

Post by Benj »

With the switch do you have a pull up resistor to VCC to pull the signal when the switch is not pressed. This stops the input from floating and potentially oscillating which may be causing the unwanted interrupts you are seeing.

An example of correct switch wiring is shown here - Active Low.
https://www.matrixtsl.com/wikiv7/index. ... e#Examples

The 1k resistors are not strictly necessary if the pin is only ever configured as an input but the 10K certainly are required.

Genilsonsa
Posts: 150
Joined: Mon Oct 15, 2012 5:19 pm
Has thanked: 12 times
Been thanked: 18 times
Contact:

Re: External Interruption 18F2550 and 18F14K50

Post by Genilsonsa »

Hello Benj thanks again for replying to me. My hardware is already with 10k pull up resistor and I placed the input icon associating the variable credit and also did not work on my hardware.

Genilsonsa
Posts: 150
Joined: Mon Oct 15, 2012 5:19 pm
Has thanked: 12 times
Been thanked: 18 times
Contact:

Re: External Interruption 18F2550 and 18F14K50

Post by Genilsonsa »

Hello Benj I did another test program. When triggered the interrupt on the B0 the LED blinks 10 times in 1 second and worked perfectly on my hardware. Only does not work when I use the USBHID to send it repeats the letter several times.

Genilsonsa
Posts: 150
Joined: Mon Oct 15, 2012 5:19 pm
Has thanked: 12 times
Been thanked: 18 times
Contact:

Re: External Interruption 18F2550 and 18F14K50

Post by Genilsonsa »

This program here worked perfectly on my hardware. Only when I use USB HID with the interrupt that give this error it seems that it can not get out of the interrupt. I already tried in flowcode 5 and 6 and gives the same error. I also used INT0, INT1 and INT2 and Gives the same error.
Attachments
Interface de Musica Microplay USB 2017 OK.fcf
(20 KiB) Downloaded 366 times

Genilsonsa
Posts: 150
Joined: Mon Oct 15, 2012 5:19 pm
Has thanked: 12 times
Been thanked: 18 times
Contact:

Re: External Interruption 18F2550 and 18F14K50

Post by Genilsonsa »

Hi everyone I have not yet discovered this problem of external interruption, however I'm putting the project that nothing else is a USB keyboard hid to connect to the pc so the keyboard and button when it triggers the perfectly sends letter to the PC via USB. Just the key that uses external interruption that keeps repeating without stopping. I am grateful without someone can help me.

Genilsonsa
Posts: 150
Joined: Mon Oct 15, 2012 5:19 pm
Has thanked: 12 times
Been thanked: 18 times
Contact:

Re: External Interruption 18F2550 and 18F14K50

Post by Genilsonsa »

Actually I did several tests to use the interrupt of pic 18f2550 and 18f14k50. What I realized was that when you use interrupt INT0, INT1 and INT2 and create a MACRO for any function (Light Led, Write a string on the LCD) etc.etc.etc works normally. Program enters Macro of INTERRUPTION executes the function and returns to the point that stopped normally with no problem. I did test in several HARWARE. Okay.

Genilsonsa
Posts: 150
Joined: Mon Oct 15, 2012 5:19 pm
Has thanked: 12 times
Been thanked: 18 times
Contact:

Re: External Interruption 18F2550 and 18F14K50

Post by Genilsonsa »

Now in relation to the use of interrupt macro int0, int1 and int2 and inside the same you want to write a string in USB HID presents this bug of repeating without stopping the string. I did several test and always presents same defect in both flowcode 5, 6 and 7. I noticed that the program enters the MACRO of the Interruption returns to the point that stopped, however it presents this BUG of repeating without stopping the string. I did all the possible test and nothing, however I did a palliative that solved my problem here was Of when I trigger interrupt B0 I created the macro only with the value I wanted to write to USB and after the program returns from the interruption that I send to write to USBHID. Thanks to Benj for trying to help me.
I would use the interruption in the traditional way. But I could not.
Attachments
Interface de Musica Microplay 2017 USB flo7.fcfx
(12.95 KiB) Downloaded 333 times

Post Reply