Menu

New day new question

Help
2011-03-29
2013-05-30
  • Nobody/Anonymous

    12f683 again.  Trying to play with interupts and lost @ where to start. I tried things I thought would work but only confused myself worse. What I would like to do is set any pin to interupt and go to a sub. Read data sheet but am still pretty confused on the hardware setup.  Anyone have a little code or something to read that might get me started. Thanks

     
  • Djbillyd007

    Djbillyd007 - 2011-03-30

    This post  is me guess I didn't log in

     
  • gcha44

    gcha44 - 2011-03-30

    Hi,
    First you must define one port (GPIO) in input with DIR command  ( It must be configured as digital input , not A/D)
    Then you create a new sub handler for your interrupt
    Then you write "On interrupt GPIOchange call xxx (sub)"
    The program 'll execute that sub when a event 'll occur on this pin  and 'll return to the main loop
    See the chapter  "Interrupts" in  GCBasic.chm and "Interrupt-on-change" in 12F683 datasheet .

    If it's not enough , you can configure register IOC to determine what GPIO pin enable interrupt-on-change  (register 4-5  in datasheet  , 1=enable , 0=disable)

    Third , you write  Inton  to enable interrupts and you can execute  the main program

    GC

     
  • Djbillyd007

    Djbillyd007 - 2011-03-31

    Thanks that sent me in the right direction

     

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.