DT INT error


Closed Thread
Results 1 to 4 of 4

Thread: DT INT error

  1. #1
    Join Date
    Oct 2011
    Posts
    52

    Default DT INT error

    hi to all
    honest I read the DT_INTS and Timer,PWM operation again,I try to compile the example of Sine wave using DT interrupts by scalerobotics on this forum link http://www.picbasic.co.uk/forum/cont...-DT-interrupts, code gives the following error E:\PROJECT CODE\DT_INTS-18.BAS ERROR Line 23: Redefinition of VAR.
    I try to eliminate the error and redownload my "DT_INTS-18.bas" again but the problem still exit

    any one can help me

  2. #2
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default Re: sinusoidal PWM

    Are you compiling for the PIC18Fx431? Although the application note was written for the PIC16 chips, I used it as a guide to program a much more capable PIC18F2431 chip. The error has to do with redefining this variable:

    DEFINE INTLHAND INT_ENTRY_L ' Context saving for Low Priority Ints

    But not quite sure why you are getting that, without knowing more about your setup.
    http://www.scalerobotics.com

  3. #3
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default Re: DT INT error

    Since it was an error at the BASIC level, MCS should have highlighted the line. (you may need to double-click the error line)
    Which one was it?

    What chip are you using?

    What version of PBP are you using?

    Did you put the interrupt files in your PBP folder?

    Did you modify the program?

    Did you include anything else.

    Are you using the exact program scalerobitcs gave or are you trying to add it to your existing program.

    Help us out here.
    DT

  4. #4
    Join Date
    Oct 2011
    Posts
    52


    Did you find this post helpful? Yes | No

    Default Re: DT INT error

    Hi!

    I manage to compile and modify the example from that link www.picbasic.co.uk/forum/cont...-DT-interrupts, for pic 16877. Because the pic I want to use for three phase spwm signal is (16f777) which has 3 CCP module and I' m waiting for it to come the problem it is not includeded in ISIS simulator that is why I used pic 168777 having 2 CCP module for simulation and is present in ISIS and my college lab. I belive if I manage to generate two phase spwm it became eaasy for 3 phase spmw.

    here is the code and attachement of my output from ISIS and mysinelooktable and
    define OSC 4

    STEPCOUNT var byte
    STEPCOUNT1 var byte
    STEPCOUNT = 0 'pointer for phase one in sinearray
    STEPCOUNT1 = 0 'pointer for phase two in sine array
    ADCON0 = %00000000
    ADCON1 = %00000000

    TRISB = %11111111
    TRISC = %11111001 'PMW output for CCP1 AND CCP2
    TRISA = %11111111
    TMR2 = 117
    PR2 = 55 'set for 18Khz HPWM
    CCP1CON = %00001100 'set CCP1 for PWM OPERATION
    CCP2CON = %00001100 'set CCP2 for PWM OPERATION
    T2CON = %00000100 'TIMER2ON and prescale of 1:1

    sineval var byte[36]
    sineval[0] = 128
    sineval[1] = 150
    sineval[2] = 171
    sineval[3] = 191
    sineval[4] = 209
    sineval[5] = 225
    sineval[6] = 238
    sineval[7] = 247
    sineval[8] = 253
    sineval[9] = 255
    sineval[10] = 253
    sineval[11] = 247
    sineval[12] = 238
    sineval[13] = 225
    sineval[14] = 209
    sineval[15] = 191
    sineval[16] = 171
    sineval[17] = 150
    sineval[18] = 128
    sineval[19] = 105
    sineval[20] = 84
    sineval[21] = 64
    sineval[22] = 46
    sineval[23] = 30
    sineval[24] = 17
    sineval[25] = 8
    sineval[26] = 2
    sineval[27] = 0
    sineval[28] = 2
    sineval[29] = 8
    sineval[30] = 17
    sineval[31] = 30
    sineval[32] = 46
    sineval[33] = 64
    sineval[34] = 84
    sineval[35] = 105

    timerone var word
    Temp var byte
    Temp1 var byte

    INCLUDE "DT_INTS-14.bas" ; Base Interrupt System emp


    ASM

    INT_LIST macro ; IntSource, Label, Type, ResetFlag?
    INT_Handler TMR1_INT, _sine, ASM, yes
    endm
    INT_CREATE ; Creates the interrupt processor
    ENDASM

    T1CON = 000001 ; Prescaler = 1;1, TMR1 ON
    TMR1L = 255
    TMR1H = 254
    @ INT_ENABLE TMR1_INT ; Enable Timer 1 Interrupts

    timerone = 64980 ;gives about 50 htz sine
    Main:
    PAUSE 5

    GOTO Main

    '---[TMR1_INT - interrupt handler]------------------------------------------

    sine:
    TMR1L = timerone.byte0
    TMR1H = timerone.byte1

    TeMP = sineval[STEPCOUNT]
    CCP1CON.4 = Temp.0 ' bit 0
    CCP1CON.5 = Temp.1 ' bit 1
    CCPR1L = Temp >>2 'Bit 2-7

    TeMP1 = sineval[STEPCOUNT1]
    CCP2CON.4 = Temp.0 ' bit 0
    CCP2CON.5 = Temp.1 ' bit 1
    CCPR2L = Temp >>2 'Bit 2-7
    if stepcount = 36 then stepcount =0
    if stepcount1 = 24 then stepcount1 =0
    stepcount = stepcount +1
    stepcount = stepcount1 +1

    @ INT_RETURN



    any one can help me
    Attached Files Attached Files

Members who have read this thread : 1

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

Posting Permissions

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