12F675 - How to configure the INTCON command to activate the various interrupts?


Closed Thread
Results 1 to 14 of 14

Hybrid View

  1. #1
    Join Date
    Feb 2022
    Posts
    54


    Did you find this post helpful? Yes | No

    Default Re: 12F675 - How to configure the INTCON command to activate the various interrupts?

    Hi,
    In fact, I'm more of a PICAXE user and I transform my "simple" codes with PBP to program small PICs.
    I was trying to use interrupts...
    The subtleties of the PICs are therefore quite nebulous for me and my English is not flexible and subtle enough to understand the mysteries of the data sheets.
    In fact what I wanted to do initially seemed easy to me... but it doesn't seem to be the case

    I just want to vary a variable named MODE from 0 to 3, 0 to 3, ..., when port GP0 (which has a pull-up resistor to Vcc) goes to zero state.

    If someone could help me out with just this little routine, that would be great.
    Thanks in advance.

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    2,631


    1 out of 1 members found this post helpful. Did you find this post helpful? Yes | No

    Default Re: 12F675 - How to configure the INTCON command to activate the various interrupts?

    Code:
    '****************************************************************
    '*  Name    : ioc-demo-12f675.BAS                               *
    '*  Author  : richard                                           *
    '*  Notice  : Copyright (c) 2023 caveat emptor                  *
    '*          : All Rights Reserved                               *
    '*  Date    : 22/04/2023                                        *
    '*  Version : 1.0                                               *
    '*  Notes   : 12f675 ioc gpio.0                                 *
    '*          :                                                   *
    '****************************************************************
    #CONFIG
    cfg = _INTRC_OSC_NOCLKOUT
    cfg&= _WDT_ON
    cfg&= _PWRTE_OFF
    cfg&= _MCLRE_ON
    cfg&= _BODEN_ON
    cfg&= _CP_OFF
    cfg&= _CPD_OFF
      __CONFIG cfg
    #ENDCONFIG
    DEFINE INTHAND    poll
    wsave VAR BYTE    $20     SYSTEM      
    ssave VAR BYTE    BANK0   SYSTEM     
    
    
    mode  var byte
    DUMMY VAR BYTE
    
    
    INPT  VAR GPIO.0
    LED   VAR GPIO.1
    
    
    cmcon = 7
    ANSEL = 0
    TRISIO.0 = 1
    TRISIO.1 = 0
    IOC.0 = 1
    
    
    
    
    MODE = 3      
    DUMMY = GPIO
    INTCON = 001000
    LED = 1
    
    
    MAIN:
        IF  ! MODE THEN
            LED = 0
            pause 1000
            LED = 1
            mode = 3
            DUMMY = GPIO
            INTCON = 001000
        endif 
        PAUSE 10
    GOTO MAIN
    
    
    
    
    asm
    poll
        MOVWF wsave 
        SWAPF STATUS,W 
        BCF STATUS,RP0 
        MOVWF ssave 
        
        BANKSEL _mode
        clrf _mode    
        
        SWAPF ssave,W
        MOVWF STATUS 
        SWAPF wsave,F 
        SWAPF wsave,W 
    ENDASM

    Name:  zorb.jpg
Views: 35728
Size:  146.1 KB
    Last edited by richard; - 22nd April 2023 at 11:19.
    Warning I'm not a teacher

  3. #3
    Join Date
    May 2013
    Location
    australia
    Posts
    2,631


    Did you find this post helpful? Yes | No

    Default Re: 12F675 - How to configure the INTCON command to activate the various interrupts?

    wasn't really happy with previous attempt

    these are better one with dt ints one without
    Attached Files Attached Files
    Warning I'm not a teacher

  4. #4
    Join Date
    Feb 2022
    Posts
    54


    Did you find this post helpful? Yes | No

    Default Re: 12F675 - How to configure the INTCON command to activate the various interrupts?

    Hi, Richard,
    I will carefully read your .txt files.
    But I really only master Basic... not really ASM
    Last edited by zorgloub; - 24th April 2023 at 10:32.

  5. #5
    Join Date
    May 2013
    Location
    australia
    Posts
    2,631


    Did you find this post helpful? Yes | No

    Default Re: 12F675 - How to configure the INTCON command to activate the various interrupts?

    I will carefully read your .txt files.
    not sure if I have to point out the obvious but
    what sort of file would "ZORB.pbp.txt" if you took the ".txt" off the end ?
    [the pbp forum will not allow a pbp file to be uploaded , you need to mask its type with a .txt extension]


    But I really only master Basic... not really ASM
    such a limited outlook

    good luck employing interrupts in any other way with such limited chips as 12f675
    Warning I'm not a teacher

  6. #6


    Did you find this post helpful? Yes | No

    Default Re: 12F675 - How to configure the INTCON command to activate the various interrupts?

    " not sure if I have to point out the obvious" but you often have some degrading, demeaning cutting comment to people seeking help. Basically a reflection of yourself......

    please delete this

  7. #7
    Join Date
    May 2013
    Location
    australia
    Posts
    2,631


    Did you find this post helpful? Yes | No

    Default Re: 12F675 - How to configure the INTCON command to activate the various interrupts?

    I will carefully read your .txt files.
    i read that as either a lack of understanding on how files are uploaded onto the forum or
    a intimation that i have uploaded something weird, unusual or incorrect. i don't know which
    but either way since it was specifically pointed out an explanation was warranted


    not sure if I have to point out the obvious but...
    makes it clearer why the txt extension is there and how to deal with it, just in case an explanation was
    necessary




    but you often have some degrading, demeaning cutting comment to people seeking help. Basically a reflection of yourself......
    really
    Warning I'm not a teacher

Similar Threads

  1. Basic problem with interrupts and sleep command
    By Davidmarks in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 21st February 2012, 01:21
  2. CONFIGURE & OSCCON & meProg configure
    By SUNFLOWER in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 19th February 2011, 21:25
  3. How to activate ccp3 on portB.5 of 16f777 ?
    By abdullahsavas in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 16th June 2010, 08:17
  4. EEPROM Write command with interrupts??
    By Elnino in forum General
    Replies: 4
    Last Post: - 23rd November 2009, 06:44
  5. intcon?
    By jonas2 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 23rd September 2009, 11:07

Members who have read this thread : 1

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts