Menu

PIC16F18857 and Interrupt-On-Change

jackjames
2019-09-06
2020-12-21
<< < 1 2 3 4 > >> (Page 2 of 4)
  • Anobium

    Anobium - 2020-11-10

    You want my help? Then, please do what I ask.

    The main.c you posted cannot compile and therefore is invalid. Do not edit or comment main.c. Attach to the post - do not post within the post.

     
  • Megha Bhirade

    Megha Bhirade - 2020-11-10

    i need some expert guys support so I asked u help..
    i enabled that macros in the main.. because I referred interrupt on change example from microchip website.... they told to open that

     
  • Anobium

    Anobium - 2020-11-10

    I am offering, but, you need to provide the info else I will be guessing.

     
  • Megha Bhirade

    Megha Bhirade - 2020-11-12

    Hi,
    IOC is working fine..i selected positive edge detection and it is working fine for Switch pressing..
    after switch pressing some times multiple times LED is toggling means looking like denouncing is happening...

    how to avoid that denouncing in IOC..
    because I need to switch only for final application
    .

     
  • Anobium

    Anobium - 2020-11-12

    Excellent.

    Whilst you are in the ISR handler. DIsable the interrupt, then do a simple loop with a delay and check the switch is still down, exit the loop and then Enable the interrupt before exiting the ISR handler.

     
  • Megha Bhirade

    Megha Bhirade - 2020-11-12

    can I achieve this by using timer interrupt?
    how to proceed using timer interrupt ?

     
    • Anobium

      Anobium - 2020-11-12

      yes you can - this will make things overly complicated.
      just use delay( 10 ).. then check the switch state. keep things simple.

       
  • Megha Bhirade

    Megha Bhirade - 2020-11-12

    hi,
    can you explain me how to acheive it from your previous Post.
    checking the switch status u r suggesting...

    please tell me with proper steps starting from Switch press

     
    • Anobium

      Anobium - 2020-11-12

      Are you a student ? are we writing your homework?

       
  • Megha Bhirade

    Megha Bhirade - 2020-11-12

    i am employee of one company....
    i am thinking of using interrupt but my technical head is not satisfied with my ideas
    .so I am asking your help

     
    • Anobium

      Anobium - 2020-11-12

      Technical lead may not that wrong in terms of having an idea and not being able to implement and support. The idea is rather odd approach.

       
  • Megha Bhirade

    Megha Bhirade - 2020-11-12

    so many people suggest to use timer... so I told that...
    using timer only 2 methods....

    just please explain your idea..it could help me

     
    • Anobium

      Anobium - 2020-11-12

      As I said.

      In the event handler/ISR. Turn off the IOC interrupt. Call a wait 10. Check the switch is depressed. Set a flag(a bit variable) to confirm that the event happened and 10ms later it was still depressed. The enable the IOC interrupt and exit the event handler/ISR.

      There is no need for an additional timer unless you are being paid by the hour of coding ... in which case we can advise you to make this far more complicated. :-)

       
  • Megha Bhirade

    Megha Bhirade - 2020-11-12

    thanks yar

     
  • Megha Bhirade

    Megha Bhirade - 2020-11-12

    i got approval for this concept.... but one more challenge is i need to disable the interrupt for perticular pin.... means if Port B 5 pin is generating IOC means i need to disable only 5 th pin and i should get IOC from B6 pin ...

    how to handle?

     
    • Anobium

      Anobium - 2020-11-12

      unset the flag for then port you are inspecting. then, set that specific port.

       
  • Megha Bhirade

    Megha Bhirade - 2020-11-12

    ok i understood..
    flag variable i need to set in the interrupt ISR and need to use in the main function.
    am i need to use it as extern or volatile??

    means the variable type?

     
  • Anobium

    Anobium - 2020-11-12

    global variable.

     
  • Megha Bhirade

    Megha Bhirade - 2020-11-15

    thanks yar for your support.....
    i need one more help u know how to write data in data eeprom using MPLAB MCC

     
    • Anobium

      Anobium - 2020-11-16

      In MCC add the 'Data EE Routines'. This will add all the apis.

      You should be using DATAEE_WriteByte(uint16_t bAdd, uint8_t bData) and DATAEE_ReadByte(uint16_t bAdd) The use of these two methods are very easy.

       
  • Megha Bhirade

    Megha Bhirade - 2020-11-19

    Hi,
    i am using above API for my application....

    using data write i am writing 0x34 at 0xF000 address..
    and after writing I am reading using read API for same address 0xF000...

    i am receiving the updated value 0x34 in receive variable...

    is it proper?? means I am not finding the updated value in data memory window...
    but received variable is getting updated value..

    please clarify me

     
    • Anobium

      Anobium - 2020-11-19

      No idea what you mean.

      If you write 0x34 and then read 0x34 then this is good.

      But, I am sure I am missing the issue here. Please restate.

       
  • Megha Bhirade

    Megha Bhirade - 2020-11-19

    i mean to say that....
    using API only I am reading and writing but after writing...
    target memory viewes will have data eeprom window..
    that should update... pickit3 debugger i am using to write program..
    anything i need to set in debugger??

     
    • Anobium

      Anobium - 2020-11-19

      I still do not understand.

       
  • Megha Bhirade

    Megha Bhirade - 2020-11-19

    Hi,
    it is related to tool setting...
    no worries i found solution

     
<< < 1 2 3 4 > >> (Page 2 of 4)

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.