Instant Interrupts - Revisited


Closed Thread
Results 1 to 40 of 773

Hybrid View

  1. #1
    Join Date
    Jan 2010
    Posts
    2


    Did you find this post helpful? Yes | No

    Smile Interrupt timer1 PIC16F628A definitions

    Hi,
    I want to start my home project to control ventilation fan by time period ON and time period OFF and to use LCD out for interface.
    I have just started to write a code in Micro Code studio Plus v.3.0.0.5 with compiler PICBasic PRO v2.50C.

    I made a starting (main) interrupt code as a basis for rest algorithm later. It is based on some desired info I have looked on the internet pages. Seems to be workable and started to compile this code. When compiling I have got some results like assembler errors as following:
    Error xxx.asm 125[225] undefined symbol 'halfsec'
    Error xxx.asm 126[225] undefined symbol 'halfsec'
    Error xxx.asm 128[225] undefined symbol 'halfsec'
    Error xxx.asm 129[225] undefined symbol 'unsec'
    Error xxx.asm 137[225] undefined symbol 'interr'

    As for me I can not understand those results at this stage and have no idea what was wrongin my code. Would you be so kind to look at my sourse code and help me to fix this problem in order to continue my project. Thank you inadvance and any ideas are appresiated.

    Here is the code example for my project:

    @ DEVICE pic16F628A, XT_OSC
    @ DEVICE pic16F628A, WDT_ON
    @ DEVICE pic16F628A, PWRT_ON
    @ DEVICE pic16F628A, MCLR_OFF
    @ DEVICE pic16F628A, BOD_ON
    @ DEVICE pic16F628A, LVP_OFF
    @ DEVICE pic16F628A, CPD_OFF
    @ DEVICE pic16F628A, PROTECT_OFF

    DEFINE OSC 4
    define INTHAND Myint ' Define interrupt handler

    counter var word 'to operate with unsec variable in main program

    wsave var byte $20 system
    ssave var byte bank0 system
    psave var byte bank0 system

    halfsec var byte
    unsec var word
    interr var byte

    halfsec = 0 'clear the time variables
    unsec = 0
    interr = 0

    INTCON = %11000000 'enable GIE and PEIE
    T1CON = %00110101 'Configure TMR1 with clock/4 and prescaler 1/8
    PIE1.0 = 1 'enable interrupt TMR1 overflow

    goto Main ' Skip around interrupt handler

    ASM ; Assembly language interrupt handler
    ; Save W, STATUS and PCLATH registers
    Myint MOVWF wsave
    SWAPF STATUS,W
    CLRF STATUS
    MOVWF ssave
    MOVF PCLATH,W
    MOVWF psave
    ; Interrupt code
    MOVLW 221
    MOVWF TMR1L
    MOVLW 11
    MOVWF TMR1H
    BCF PIR1,0
    INC halfsec
    BTFSS halfsec,1
    GOTO xxx
    CLRF halfsec
    INC unsec
    ; Restore PCLATH, STATUS and W registers
    xxx MOVF psave,W
    MOVWF PCLATH
    SWAPF ssave,W
    MOVWF STATUS
    SWAPF wsave,F
    SWAPF wsave,W
    BSF interr,0 ;just a flag...
    RETFIE
    ENDASM

    Main: 'Start of the main program

    counter = unsec ' Or do something else...

    goto Main ' Return to the main program
    end ' End

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Hi nupass,
    welcome to the forum.

    First, you really should start a new thread for this as it does not seem to have much to do with this one.
    Dave
    Always wear safety glasses while programming.

  3. #3


    Did you find this post helpful? Yes | No

    Default

    Nupass,

    Try putting under scores in front of your variable within the asm routine

    halfsec var byte
    unsec var word
    interr var byte

    Asm

    _halfsec
    _unsec
    _interr

    endasm

    It's in the manual

  4. #4
    Join Date
    Jan 2010
    Posts
    2


    Did you find this post helpful? Yes | No

    Thumbs up

    Dear Mark_S,
    Thank you for your welcome, I'am appresiated.
    So, I was followed by your suggestion, and put underscore at the beginning of my variables...

    ... then ... success!!!

    It is easier than to make a koffee, just you need some skills... Assembler for me it's a horroble thing...

    Well, you have been very helpfull and I have learned some...
    Thank you a lot ones again.

    To be conitue...

Similar Threads

  1. Clock using Instant Interrupts
    By PICpocket in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 16th February 2009, 21:43
  2. DT instant interrupts with mister_e keypad
    By Tomexx in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 26th November 2008, 20:02
  3. DT's Instant Interrupts trouble
    By Tomexx in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 24th November 2008, 20:48
  4. Keypad and DT's Instant Interrupts
    By Homerclese in forum General
    Replies: 11
    Last Post: - 27th April 2007, 06:32
  5. Replies: 1
    Last Post: - 1st November 2006, 03:11

Members who have read this thread : 6

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