Searching \ for '[PIC] 3 Phase PWM using 16f777 please help' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/microchip/ios.htm?key=pwm
Search entire site for: '3 Phase PWM using 16f777 please help'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] 3 Phase PWM using 16f777 please help'
2008\08\27@045227 by Brenno wlaker

flavicon
face

hi everyone,

i have been reading the AN889 Vf control using the pic16f777
microcontroller(link at bottom of the page to micrchip site with datasheet
and project code in zip file). I have used the code provided in mpab but i
have come across a few issues. All i requre is the 3 PWM signals which is
varies frequency by use of a trimpot on RA1, fwd/rev control and run/stop.
over voltage and under voltage and fualt current is not required, i hav been
trying to remove these sections of code so i could have signal generation.
My ASM skills r very basic could anyoe please help me!!

regards

Brendan

LINK:
www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1824&appnote=en012129
--
View this message in context: www.nabble.com/3-Phase-PWM-using-16f777-please-help-tp19118657p19118657.html
Sent from the PIC - [PIC] mailing list archive at Nabble.com.

2008\08\27@211746 by cdb

flavicon
face
Could you elaborate on what the issues are,  that are causing you
problems?

Colin

:: have been reading the AN889 Vf control using the pic16f777
:: microcontroller(link at bottom of the page to micrchip site with
:: datasheet
:: and project code in zip file). I have used the code provided in
:: mpab but i
:: have come across a few issues. All i requre is the 3 PWM signals
:: which is
:: varies frequency by use of a trimpot on RA1, fwd/rev control and
:: run/stop.
:: over voltage and under voltage and fualt current is not required,
:: i hav been
:: trying to remove these sections of code so i could have signal
:: generation.
:: My ASM skills r very basic could anyoe please help me!!
--
cdb, spam_OUTcolinTakeThisOuTspambtech-online.co.uk on 28/08/2008

Web presence: http://www.btech-online.co.uk  

Hosted by:  http://www.1and1.co.uk/?k_id=7988359







2008\08\28@003608 by Brenno wlaker

flavicon
face



Thanks your for the reply!! In the datasheet there is a shematic that is for
the motor driver, inverter bridge, communications and basic connections to
the pic. what i have done is simplify the circuit to just the control
switches PWM output and LEDS that indicate the function of the pic. I have
programmed my chip with the code and press the start stop button and the
program seems to stop there ( i am using an  LED on the pwm output to check
for correct generation of the PWM), in the coding in the interuprt service
routine there is a section of code that i think checks the current
(CHECK_FAULT) and voltage levels (CONV_IS_BUS_VOLTAGE) for save opertaion
mode. These readings come from sections of the schematic i dont need to
build such as the motor driver and inverter bridge. i think the program gets
stuck in these parts somewhere i have tried to take them out of the coding
but with little sucess, i just need the 3 signals to generate between the
5-60Hz range when u vary the trimpot on RA1. Any ideas on what i should
remove? like i said my ASM is not that great havent done it for a few years
and all the methods to generate the digital sinoudoidal PWM for omtor
control use the lookup table method in assembler language. i have placed the
code main section of code below

Thanks for ur help

;**************************************************************************************
;PROGRAM                :        VF CONTROL OF 3-PHASE INDUCTION MOTOR (MAIN ROUTINE)
;MICROCONTROLLER        :        PIC16F777
;CRYSTAL FREQUENCY        :        20MHZ
;**************************************************************************************
;AUTHOR                        :        RAKESH PAREKH, MICROCHIP TECHNOLOGY INC.
;DATE                        :        15-DEC-2003
;VERSION                :        V1.0
;APPLICATION NOTE        :        AN889
;**************************************************************************************
;*
;* Software License Agreement
;*
;* The software supplied herewith by Microchip Technology Incorporated
;* (the “Company”) for its PICmicro® Microcontroller is intended and
;* supplied to you, the Company’s customer, for use solely and
;* exclusively on Microchip PICmicro Microcontroller products. The
;* software is owned by the Company and/or its supplier, and is
;* protected under applicable copyright laws. All rights are reserved.
;* Any use in violation of the foregoing restrictions may subject the
;* user to criminal sanctions under applicable laws, as well as to
;* civil liability for the breach of the terms and conditions of this
;* license.
;*
;* THIS SOFTWARE IS PROVIDED IN AN “AS IS” CONDITION. NO WARRANTIES,
;* WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
;* TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
;* PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
;* IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
;* CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
;**************************************************************************************
;DESCRIPTION
;**************************************************************************************
;THIS SOFTWARE IMPLEMENTS VF CONTROL OF AC INDUCTION MOTOR IN OPEN LOOP
USING PIC16F777.
;THE MOTOR FREQUENCY IS CHANGED BY VARYING THE POTENTIOMETER, INTERFACED AT
RA1 PIN.
;VOLTAGE TO FREQUENCY RATIO IS MAINTAINED CONSTANT THROUGHOUT THE OPERATING
RANGE.
;**************************************************************************************
;FEATURES
;**************************************************************************************
;3 PHASE AC INDUCTION MOTOR RUN USING OPEN LOOP VF CONTROL
;START/STOP SWITCH INTERFACE (SWICTH AT RB1)
;ROTATION DIRECTION REVERSAL SWITCH INTERFACE (SWITCH AT RB0)
;MOTOR FREQUENCY SET BY POTENTIOMETER (POT AT RA1)
;MOTOR FREQUENCY IS LIMITED BETWEEN 5Hz AND 60Hz.
;LED INDICATION OF RUN/STOP AND FWD/REV STATUS OF MOTOR
;RUN/STOP LED AT RD1 AND FWD/REV LED AT RD0
;UV AND OV LIMIT
;UV_LED AT RD2 AND OV_LED AT RD3
;ACCELERATION AND DEACCELERATION TIME SETTING
;**************************************************************************************
;FLAGE MOTOR_DIRECTION = (0 FOR REVERSE) OR (1 FOR FORWARD)
;FLAGE MOTOR_RUNNING = (0 FOR STOP) OR (1 FOR RUN)
;RUN_STOP_LED = (ON FOR RUN) OR (OFF FOR STOP)
;FWD_REV_LED = (ON FOR FORWARD) OR (OFF FOR REVERSE)
;V_F_FLAG = (0 FOR ADC CHANNEL FOR F) OR (1 FOR ADC CHANNEL FOR V)
;UV_LED = (ON FOR UV LIMIT ACTIVATION) OR (OFF FOR VOLTAGE > UV LIMIT)
;OV_LED = (ON FOR OV LIMIT ACTIVATION) OR (OFF FOR VOLTAGE < OV LIMIT)
;**************************************************************************************
;NOTE
;USER CAN CHANGE THE MOTOR FREQUENCY LIMIT IN AD_CONV_COMPLETE ROUTINE
;IF ACCELERATION AND DECELERATION FEATURE IS NOT REQUIRED, COMMENT '#DEFINE
RAMP' IN PARAMETERS.INC
;**************************************************************************************
       LIST                P = P16F777
       __CONFIG H'2007',H'3FAA'
       __CONFIG H'2008',H'3FBC'
       INCLUDE                <P16F777.INC>
       INCLUDE                <PARAMETERS.INC>
;**************************************************************************************
       UDATA_SHR
W_TEMP                RES        1        ;LOCATION FOR SAVING 'WREG' DURING INTERRUPT
STATUS_TEMP        RES        1        ;LOCATION FOR SAVING 'STATUS' DURING INTERRUPT
FLAGS                RES        1        ;FLAGS REGISTERS USED TO INDICATE DIFFERENT STATUS
FREQ_REF_H        RES        1        ;REFERANCE FREQUENCY INPUT(MSB) IN TIME COUNTS
FREQ_REF_L        RES        1        ;REFERANCE FREQUENCY INPUT(LSB) IN TIME COUNTS
SET_FREQ        RES        1        ;REFERANCE FREQUENCY INPUT IN COUNTS
TEMP_LOC        RES        1        ;GENERAL PURPOSE TEMPORARY LOCATION
TEMP_LOC_1        RES        1        ;GENERAL PURPOSE TEMPORARY LOCATION
TEMP_LOC_2        RES        1        ;GENERAL PURPOSE TEMPORARY LOCATION
NO_1_LSB        RES        1        ;NUMERATOR(LSB) AND QUOTIENT(LSB) OR MULTIPLIER(LSB)
NO_1_MSB        RES        1        ;NUMERATOR(MSB) AND QUOTIENT(MSB) OR MULTIPLIER(MSB)
NO_2_LSB        RES        1        ;DENOMINATOR(LSB) OR MULTIPLICAND(LSB)
NO_2_MSB        RES        1        ;DENOMINATOR(MSB) OR MULTIPLICAND(MSB)
RESULT_LSB        RES        1        ;RESULT OF MULTIPLICATION(LSB)/REMAINDER(LSB)
RESULT_MSB        RES        1        ;RESULT OF MULTIPLICATION(MSB)/REMAINDER(MSB)
VDC_COUNT        RES        1        ;DIGITAL COUNT OF DC BUS VOLTAGE

       UDATA
TABLE_OFFSET1        RES        1        ;PHASE1 OFFSET TO THE SINE TABLE(0)
TABLE_OFFSET2        RES        1        ;PHASE2 OFFSET TO THE SINE TABLE(120)
TABLE_OFFSET3        RES        1        ;PHASE3 OFFSET TO THE SINE TABLE(240)
TMR2_INT_COUNT        RES        1        ;COUNTER TO MEASURE 4MS USING TMR2 OV INT
SINE_TABLE_RAM        RES        0X14        ;SINE TABLE
       
       EXTERN        SET_ADC_GO
       EXTERN        NEW_FREQ        
       EXTERN        FLAG_FREQ        
       EXTERN        DEC_COUNTER_LSB
       EXTERN        DEC_COUNTER_MSB
       EXTERN        ACC_COUNTER_LSB
       EXTERN        ACC_COUNTER_MSB
       EXTERN        TEMP_COUNTER_LSB
       EXTERN        TEMP_COUNTER_MSB
       EXTERN        TEMP_FREQ
               
       GLOBAL        SET_FREQ
       GLOBAL        FLAGS
       GLOBAL        NO_1_LSB
       GLOBAL        NO_1_MSB
       GLOBAL        NO_2_LSB
       GLOBAL        NO_2_MSB
       GLOBAL        SET_FREQ
       GLOBAL        FREQ_REF_L
       GLOBAL        FREQ_REF_H
       GLOBAL        TEMP_LOC
       GLOBAL        TEMP_LOC_1
       GLOBAL        TEMP_LOC_2
       GLOBAL        RESULT_MSB
       GLOBAL        RESULT_LSB
;**************************************************************************************
;MACRO FOR MULTIPLICATION - 8X8 UNSIGNED
;**************************************************************************************
MULT    MACRO   BIT                        ;MACRO FOR UNSIGNEDMULTIPLICATION
       BTFSC   NO_1_LSB,BIT
       ADDWF   RESULT_MSB,F
       RRF     RESULT_MSB,F
       RRF     RESULT_LSB,F
       ENDM                                ;END OF MACRO FOR MULTIPLICATION
       
;**************************************************************************************
;POWER ON RESET VECTOR LOCATION
;**************************************************************************************
STARTUP        CODE        0X00                        ;RESET VECTOR ADDRESS
       GOTO        START                                
       
       CODE        0X04                        ;INTERRUPT VECTOR LOCATION
       GOTO        ISR_INT                        ;GOTO INTERRUPT SERVICE ROUTINE

;**************************************************************************************
PROG0        CODE
START
;**************************************************************************************
;INITIALIZATION OF THE PORTS AND TIMERS
       BANKSEL        WDTCON
       CLRF        WDTCON
       CLRF        FLAGS                        ;CLEAR ALL FLAGS
       BANKSEL        FLAG_FREQ
       CLRF        FLAG_FREQ                ;CLEAR ALL FLAGS
       BCF        STATUS,RP1
       BSF        STATUS,RP0
       MOVLW        0X1F
       MOVWF        TRISB                        ;RB0-4 AND RB5-RB7 CONFIGURED AS INPUT AND OUTPUT
RESPECTIVELY
       MOVLW        0XF9
       MOVWF        TRISC                        ;RC1-RC2 CONFIGURED AS OUTPUT RESPECTIVELY
       MOVLW        0XF0
       MOVWF        TRISD                        ;RD0-3 AND RD4-RD7 CONFIGURED AS OUTPUT AND INPUT
RESPECTIVELY
       BCF        TRISE,4
       BCF        STATUS,RP0
       MOVF        PORTB,W
       MOVLW        0XF0                        ;TURN OFF ALL LEDS
       MOVWF        PORTD        
       
       MOVLW        0X0C
       MOVWF        CCP1CON                        ;CCP1,CCP2 AND CCP3 CONFIGURED TO PWM
       MOVWF        CCP2CON
       BSF        STATUS,RP0
       MOVWF        CCP3CON

       CALL        STOP_MOTOR                ;STOP MOTOR
       BANKSEL        PR2
       MOVLW        PR2_VALUE                ;LOAD PR2 VALUE TO PR2 REGISTER
       MOVWF        PR2
       BCF        STATUS,RP0
       BSF        T2CON,TMR2ON                ;TIMER2 ON
       CALL        COPY_TABLE_TO_RAM        ;COPY SINE TABLE FROM PROGRAM MEMORY TO RAM FOR
FASTER ACCESS
       
;**************************************************************************************
;INITIALIZE ADC REGISTERS
;**************************************************************************************
       BANKSEL        ADCON0
       MOVLW        0X91
       MOVWF        ADCON0                        ;CONFIGURE FOR 32TOSC AND CHANNEL FOR CONVERSION - RA2 (DC
BS VOLTAGE)
       BSF        STATUS,RP0
       MOVLW        0x0B                        ;CONFIGURE RA0-RA3 AS ANALOG INPUT
       MOVWF        ADCON1
       MOVLW        0X31                        ;SETTING OF ACQUISITION TIME FOR ADC (~25usec)
       MOVWF        ADCON2
       MOVLW        0X0F                        ;RA0-RA3 INPUT and RA4-RA7 OUTPUT
       MOVWF        TRISA
       BCF        STATUS,RP0
       BCF        PORTA,DRIVER_ENABLE        ;ENABLE INVERTER DRIVERS - IR2109
       
;**************************************************************************************
;TIMRE1 INITIALIZATION WITH PRESCALER - USED FOR SETTING OF MOTOR FREQ.
;**************************************************************************************
       MOVLW        0X31                        ;LOAD THE T1CON WITH CONTROL WORD
       MOVWF        T1CON                        ;FOR TMR1 ON AND PRESCALAR IS 1:8, INTERNAL CLOCK
       
;**************************************************************************************
;TIMRE0 INITIALIZATION WITH PRESCALER - USED FOR ACCELERATION,DECELERATION
;AND ADC TRIGGER FOR FREQ. CONV.
;**************************************************************************************
       BCF        STATUS,RP0
       CLRF        INTCON                        ;DISABLE ALL INTERRUPTS AND FLAGS ASSOCIATED WITH
       CLRF        PIR1                        ;DISABLE ALL INTERRUPT FLAGS
       CLRF        PIR2                        ;DISABLE ALL INTERRUPT FLAGS
       BSF        STATUS,RP0
       CLRF        PIE1                        ;DISABLE ALL INTERRUPTS
       CLRF        PIE2                        ;DISABLE ALL INTERRUPTS

       MOVLW        0X03                        ;SET #POR AND #BOR FLAGS
       MOVWF        PCON
       BCF        STATUS,RP0
       BSF        INTCON,RBIE                ;ENABLE RB PORT CHANGE INTERRUPT FOR RB4
       BSF        INTCON,PEIE                ;PERIPHERAL INTERRUPTS ENABLE
       BSF        INTCON,GIE                ;GLOBAL INTERRUPT ENABLE

;**************************************************************************************
;INFINITE LOOP
;**************************************************************************************
LOOP
       BTFSS        FLAGS,TIMER1_OV_FLAG        ;IS TMR1 OV FLAG SET?
       GOTO        BYPASS                        ;NO
       BCF        FLAGS,TIMER1_OV_FLAG        ;CLEAR TMR1 OV FLAG
       CALL        UPDATE_PWM_DUTYCYCLES        ;YES, UPDATE THE PWM DUTY CYCLE WITH NEW VALUE
       CALL        UPDATE_TABLE_OFFSET        ;UPDATE 3 OFFSETS
BYPASS
       CALL        SET_ADC_GO                ;START AD CONVERSION AND CALCULATE TMR1 RELOAD VALUES
BASED ON POT SETTING
       CALL        KEY_CHECK                ;CHECK KEYS CHANGE
       GOTO        LOOP                        ;GO BACK TO MAIN LOOP
;******************************************************************
;INTERRUPT SERVICE ROUTINE
;******************************************************************
ISR_INT
       MOVWF        W_TEMP                        ;COPY W TO A TEMPORARY REGISTER
       SWAPF        STATUS,W                ;SWAP STATUS NIBBLES AND PLACE INTO W REGISTER
       MOVWF        STATUS_TEMP                ;SAVE STATUS TO A TEMPORARY REGISTER IN BANK0
       
       BANKSEL        PIR1
       ;BTFSC        INTCON,RBIF                ;RB INTERRUPT?
       ;GOTO        CHECK_FAULT                ;YES - OVER CURRENT FAULT
       BTFSC        PIR1,TMR1IF                ;TIMER1 OVERFLOW INTERRUPT?        
       GOTO        TIMER1_OVERFLOW                ;YES - INTERRUPT FOR UPDATING TMR1 REGISTERS BASED ON
POT SETTING
       BTFSC        PIR1,ADIF                ;ADC CONVERSION COMPLETE INTERRUPT?
       GOTO        AD_CONV_COMPLETE        ;YES - CONVERSON RESULT 'F - MOTOR FREQUENCY' OR 'V -
DC BUS VOLTAGE'
       BTFSC        PIR1,TMR2IF
       GOTO        TMR2_ISR
       
POPUP                                        ;RETRIEVE SAVED WREG AND STAUS REGISTER VALUES        
       SWAPF        STATUS_TEMP,W                ;SWAP ORIGINAL STATUS REGISTER VALUE INTO W (RESTORES
ORIGINAL BANK)
       MOVWF        STATUS                        ;RESTORE STATUS REGISTER FROM W REGISTER                                
       SWAPF        W_TEMP,F                ;SWAP W_TEMP NIBBLES AND RETURN VALUE TO W_TEMP
       SWAPF        W_TEMP,W                ;SWAP W_TEMP TO W TO RESTORE ORIGINAL W VALUE WITHOUT
AFFECTING STATUS
       RETFIE                                ;RETURN FROM INTERRUPT
;******************************************************************
TIMER1_OVERFLOW                                ;TMR1 OVERFLOW ISR
       MOVF        FREQ_REF_H,W
       MOVWF        TMR1H                        ;LOAD THE HIGHER BYTE OF SPEEDCOMMAND TO TMR1H
       MOVF        FREQ_REF_L,W
       MOVWF        TMR1L                        ;LOAD THE LOWER BYTE OF SPEEDCOMMAND TO TMR1L
       BSF        FLAGS,TIMER1_OV_FLAG
       BCF        PIR1,TMR1IF                ;CLEAR TMR1IF
       GOTO        POPUP
;******************************************************************
CHECK_FAULT
       MOVF        PORTB,F                        ;READ PORTB TO ITSELF TO END MISMATCH CONDITION        
       BTFSS        FLAGS,MOTOR_RUNNING
       GOTO        NO_ACTION
       BTFSS        PORTB,FAULT_BIT                ;CHECK FOR FAULT BIT
       GOTO        THERE_IS_FAULT                ;YES, FAULT OCCURRED, STOP MOTOR
       CALL        RUN_MOTOR_AGAIN                ;FAULT CLEARED?
NO_ACTION
       BCF        INTCON,RBIF                ;RUN MOTOR AGAIN
       GOTO        POPUP
               
THERE_IS_FAULT                                ;YES,FAULT IS THERE
       CALL        STOP_MOTOR                ;STOP MOTOR
       BCF        INTCON,RBIF        
       GOTO        POPUP
       
;*****************************************************************
AD_CONV_COMPLETE                        ;ADC INTERRUPT
       BCF        PIR1,ADIF                ;ADIF FLAG IS CLEARED FOR NEXT INTERRUPT
       BTFSS        FLAGS,V_F_FLAG                ;DOES CONVERSION RESULT REFLECT DC BUS VOLTAGE?
       GOTO        CONV_IS_FREQ                ;NO - READ RESULT AS POT SETTING OF FREQ.
       ;GOTO        CONV_IS_BUS_VOLTAGE        ;YES - READ RESULT AS DC BUS VOLTAGE

CONV_IS_FREQ
       BANKSEL        NEW_FREQ
       MOVF        ADRESH,W                ;READ AD CONVERSION RESULT
       MOVWF        NEW_FREQ                ;CHECK FOR LOWER AND UPPER ALLOWED LIMIT OF FREQ.
       SUBLW        0X13                        ;MINIMUM FREQUENCY SET TO 5HZ (SCALING FACTOR X4)
       BTFSS        STATUS,C                ;IS POT SETTING FOR FREQ, MORE THAT LOWER SET LIMIT?
       GOTO        CHECK_UPPER_LIMIT_FREQUENCY        ;YES - NOW CHECK UPPER LIMIT
       MOVLW        0X14                        ;NO - SET FREQ. TO LOWER ALLOWED LIMIT - 5HZ (X4)
       MOVWF        NEW_FREQ
       GOTO        POPUP

CHECK_UPPER_LIMIT_FREQUENCY        
       MOVLW        0XF1                                                
       SUBWF        NEW_FREQ,W                        
       BTFSS        STATUS,C                ;IS POT SETTING MORE THAN ALLOWED UPPER LIMIT OF FREQ?
       GOTO        POPUP                        ;NO - RETURN FROM INTERRUPT
       MOVLW        0XF0                        ;YES - SET FREQ TO UPPER ALLOWED LIMIT - 60HZ (X4)
       MOVWF        NEW_FREQ        
       GOTO        POPUP

;CONV_IS_BUS_VOLTAGE
       MOVF        ADRESH,W
       MOVWF        VDC_COUNT
       SUBLW        LIMIT_V_LOW                ;UV LIMIT SET TO 20% OF 115VAC = 92VAC
       BTFSS        STATUS,C                ;IS DC BUS VOLTAGE LESS THAN LOWER LIMIT?
       ;GOTO        CHECK_UPPER_LIMIT_VOLTAGE        ;NO - NOW CHECK UPPER LIMIT
       BSF        LED_PORT,UV_LED                ;YES - TURN ON LED TO INDICATE SAME
       CALL        STOP_MOTOR                ;STOP MOTOR
       BCF        FLAGS,MOTOR_RUNNING        ;CLEAR MOTOR_RUNNING FLAG
       GOTO        POPUP                        ;RETURN FROM INTERRUPT

;CHECK_UPPER_LIMIT_VOLTAGE
       MOVLW        LIMIT_V_HIGH                ;OV LIMIT SET TO 20% OF 115VAC = 138VAC
       SUBWF        VDC_COUNT,W
       BTFSS        STATUS,C                ;IS DC BUS VOLTAGE MORE THAN UPPER LIMIT?
;        GOTO        VOLTAGE_WITHIN_LIMIT        ;NO
       BSF        LED_PORT,OV_LED                ;YES - TURN ON LED TO INDICATE SAME
       CALL        STOP_MOTOR                ;STOP MOTOR
       BCF        FLAGS,MOTOR_RUNNING        ;CLEAR MOTOR_RUNNING FLAG
       GOTO        POPUP                        ;RETURN FROM INTERRUPT



;******************************************************************
TMR2_ISR
       BCF        PIR1,TMR2IF
       BANKSEL        TMR2_INT_COUNT
       DECFSZ        TMR2_INT_COUNT,F
       GOTO        POPUP

       MOVLW        0X50
       MOVWF        TMR2_INT_COUNT
       
       BANKSEL        FLAG_FREQ
       BSF        FLAG_FREQ,DELAY_4MS        ;SET 4MS DELAY FLAG
#IFNDEF        RAMP
       GOTO        POPUP
#ELSE
       BTFSS        FLAG_FREQ,CHANGE_FREQ        ;IS CHANGE IN FREQ REQUIRED?
       GOTO        POPUP                        ;NO - RETURN TO MAIN ROUTINE
       
       BTFSC        FLAG_FREQ,DEC_ACC_F        ;IS DECELEARTION REQUIRED?
       GOTO        ACC_FREQ                ;NO - ACCELERATION IS REQUIRED

DEC_FREQ
       BANKSEL        TEMP_COUNTER_LSB                                
       DECFSZ        TEMP_COUNTER_LSB,F        ;IS DEC_COUNTER_LSB ZERO AFTER DECREMENT?
       GOTO        POPUP                        ;NO - COME OUT OF INTERRUPT
       
       BANKSEL        TEMP_COUNTER_MSB
       MOVF        TEMP_COUNTER_MSB,F
       BTFSS        STATUS,Z                ;IS DEC_COUNTER_MSB ZERO?
       GOTO        DECREASE_TEMP_DEC_COUNTER_MSB        ;NO

       DECF        SET_FREQ,F                ;DECREASE SET_FREQ COUNT BY 1

       BANKSEL        DEC_COUNTER_LSB                ;RELOAD DEC_COUNTER TO TEMP_COUNTER
       MOVF        DEC_COUNTER_LSB,W
       BANKSEL        TEMP_COUNTER_LSB
       MOVWF        TEMP_COUNTER_LSB

       BANKSEL        DEC_COUNTER_MSB
       MOVF        DEC_COUNTER_MSB,W
       BANKSEL        TEMP_COUNTER_MSB
       MOVWF        TEMP_COUNTER_MSB
       
       GOTO        POPUP
       
DECREASE_TEMP_DEC_COUNTER_MSB
       DECF        TEMP_COUNTER_MSB,F        ;DECREASE DEC_COUNTER_MSB BY 1
       GOTO        POPUP
       
ACC_FREQ
       BANKSEL        TEMP_COUNTER_LSB
       DECFSZ        TEMP_COUNTER_LSB,F        ;IS ACC_COUNTER_LSB ZERO AFTER DECREMENT?
       GOTO        POPUP                        ;NO - COME OUT OF INTERRUPT
       
       BANKSEL        TEMP_COUNTER_MSB
       MOVF        TEMP_COUNTER_MSB,F
       BTFSS        STATUS,Z                ;IS ACC_COUNTER_MSB ZERO?
       GOTO        DECREASE_TEMP_ACC_COUNTER_MSB        ;NO

       INCF        SET_FREQ,F                ;INCREASE SET_FREQ COUNT BY 1

       BANKSEL        ACC_COUNTER_LSB                ;RELOAD ACC_COUNTER TO TEMP_COUNTER
       MOVF        ACC_COUNTER_LSB,W
       BANKSEL        TEMP_COUNTER_LSB
       MOVWF        TEMP_COUNTER_LSB

       BANKSEL        ACC_COUNTER_MSB
       MOVF        ACC_COUNTER_MSB,W
       BANKSEL        TEMP_COUNTER_MSB
       MOVWF        TEMP_COUNTER_MSB

       GOTO        POPUP                                
       
DECREASE_TEMP_ACC_COUNTER_MSB
       DECF        TEMP_COUNTER_MSB,F        ;DECREASE ACC_COUNTER_MSB BY 1
       GOTO        POPUP
#ENDIF
;*************************************************************************
;THIS ROUTINE WILL UPDATE THE PWM DUTY CYCLE ON CCPX ACCORDING TO THE
;OFFSET TO THE TABLE WITH 0-120-240 DEGREES.
;THIS ROUTINE SCALES THE PWM VALUE FROM THE TABLE BASED ON THE FREQUENCY TO
KEEP V/F
;CONSTANT AND LOADS THEM IN APPROPRIATE CCPX REGISTER DEPENDING ON SETTING
OF FWD/REV FLAG
;*************************************************************************
UPDATE_PWM_DUTYCYCLES                                
       MOVLW        LOW(SINE_TABLE_RAM)
       MOVWF        FSR                        ;BASE ADDRESS OF SINE TABLE IN RAM IS LOADED TO FSR
       BANKSEL        TABLE_OFFSET1
       MOVF        TABLE_OFFSET1,W                ;TABLE_OFFSET1 IS COPIED TO WREG
       ADDWF        FSR,F                        ;ADRESS TO BE READ=SINE TABLE BASE ADRESS + TABLE_OFFSET1
       BANKISEL        SINE_TABLE_RAM
       MOVF        INDF,W                        ;COPY SINE TABLE VALUE, POINTED BY FSR, TO WREG
       BTFSC        STATUS,Z                ;CHECK IS VALUE READ ZERO?
       GOTO        PWM1_IS_0                ;YES, GOTO PWM1_IS_0
       MOVWF        NO_1_LSB                ;NO, SINE TABEL VALUE X SET_FREQ TO SCALE TABLE VALUE BASED
ON FREQUENCY SETTING
       CALL        MUL_8X8                        ;CALL ROUTINE FOR UNSIGNED 8x8 BIT MULTIPLICATION
       MOVF        RESULT_MSB,W                ;8 MSB OF 16 BIT RESULT IS STORED
       MOVWF        TEMP_LOC                ;AT TEMP_LOC - THIS REPRESENT PWM DUTY CYCLE VALUE FOR
PHASE 1
       GOTO        UPDATE_PWM2                ;GO FOR UPDATING PWM DUTY CYCLE FOR 2ND PHASE
PWM1_IS_0
       CLRF        TEMP_LOC                ;CLEAR PWM DUTY CYCLE VALUE FOR PHASE 1

UPDATE_PWM2
       MOVLW        LOW(SINE_TABLE_RAM)
       MOVWF        FSR                        ;BASE ADDRESS OF SINE TABLE IN RAM IS LOADED TO FSR
       BANKSEL        TABLE_OFFSET2
       MOVF        TABLE_OFFSET2,W                ;TABLE_OFFSET2 IS COPIED TO WREG
       ADDWF        FSR,F                        ;ADRESS TO BE READ=SINE TABLE BASE ADRESS + TABLE_OFFSET2
       BANKISEL        SINE_TABLE_RAM
       MOVF        INDF,W                        ;COPY SINE TABLE VALUE, POINTED BY FSR, TO WREG
       BTFSC        STATUS,Z                ;CHECK IS VALUE READ ZERO?
       GOTO        PWM2_IS_0                ;YES, GOTO PWM2_IS_0
       MOVWF        NO_1_LSB                ;NO, SINE TABEL VALUE X SET_FREQ TO SCALE TABLE VALUE BASED
ON FREQUENCY SETTING
       CALL        MUL_8X8                        ;CALL ROUTINE FOR UNSIGNED 8x8 BIT MULTIPLICATION
       MOVF        RESULT_MSB,W                ;8 MSB OF 16 BIT RESULT IS STORED
       MOVWF        TEMP_LOC_1                ;AT TEMP_LOC_1 - THIS REPRESENT PWM DUTY CYCLE VALUE FOR
PHASE 2
       GOTO        UPDATE_PWM3                ;GO FOR UPDATING PWM DUTY CYCLE FOR 3RD PHASE

PWM2_IS_0
       CLRF        TEMP_LOC_1                ;CLEAR PWM DUTY CYCLE VALUE FOR PHASE 2
       
UPDATE_PWM3
       MOVLW        LOW(SINE_TABLE_RAM)
       MOVWF        FSR                        ;BASE ADDRESS OF SINE TABLE IN RAM IS LOADED TO FSR
       BANKSEL        TABLE_OFFSET3
       MOVF        TABLE_OFFSET3,W                ;TABLE_OFFSET3 IS COPIED TO WREG
       ADDWF        FSR,F                        ;ADRESS TO BE READ=SINE TABLE BASE ADRESS + TABLE_OFFSET3
       BANKISEL        SINE_TABLE_RAM
       MOVF        INDF,W                        ;COPY SINE TABLE VALUE, POINTED BY FSR, TO WREG
       BTFSC        STATUS,Z                ;CHECK IS VALUE READ ZERO?
       GOTO        PWM3_IS_0                ;YES, GOTO PWM3_IS_0
       MOVWF        NO_1_LSB                ;NO, SINE TABEL VALUE X SET_FREQ TO SCALE TABLE VALUE BASED
ON FREQUENCY SETTING
       CALL        MUL_8X8                        ;CALL ROUTINE FOR UNSIGNED 8x8 BIT MULTIPLICATION
       MOVF        RESULT_MSB,W                ;8 MSB OF 16 BIT RESULT IS STORED
       MOVWF        TEMP_LOC_2                ;AT TEMP_LOC_2 - THIS REPRESENT PWM DUTY CYCLE VALUE FOR
PHASE 3
       GOTO        SET_PWM12                ;GO FOR CHECKING DIRECTION OF MOTOR ROTATION REEQUIRED

PWM3_IS_0
       CLRF        TEMP_LOC_2                ;CLEAR PWM DUTY CYCLE VALUE FOR PHASE 3

SET_PWM12
       BANKSEL        CCPR1L        
       BTFSS        FLAGS,MOTOR_DIRECTION        ;IS MOTOR_DIRECTION FLAG SET FOR FORWARD
ROTATION?
       GOTO        ROTATE_REVERSE                ;NO - GO FOR REVERSE ROTATION
       MOVF        TEMP_LOC,W
       MOVWF        CCPR1L                        ;COPY TEMP_LOC AND TEMP_LOC_1 VALUES TO
       MOVF        TEMP_LOC_1,W                ;CCPR1L AND CCPR2L RESPECTIVELY FOR
       MOVWF        CCPR2L                        ;FOR FORWARD ROTATION OF MOTOR
       BSF        STATUS,RP0
       MOVF        TEMP_LOC_2,W                
       MOVWF        CCPR3L                        ;COPY TEMP_LOC_2 TO CCPR3L
       BCF        STATUS,RP0
       BSF        LED_PORT,FWD_REV_LED        ;TURN ON FWD_REV_LED TO INDICATE FORWARD ROTATION
OF MOTOR
       RETURN
               
ROTATE_REVERSE
       MOVF        TEMP_LOC_1,W                ;COPY TEMP_LOC_1 AND TEMP_LOC VALUES TO
       MOVWF        CCPR1L                        ;CCPR1L AND CCPR2L RESPECTIVELY FOR
       MOVF        TEMP_LOC,W                ;FOR REVERSE ROTATION OF MOTOR
       MOVWF        CCPR2L
       BSF        STATUS,RP0
       MOVF        TEMP_LOC_2,W
       MOVWF        CCPR3L                        ;COPY TEMP_LOC_2 TO CCPR3L
       BCF        STATUS,RP0
       BCF        LED_PORT,FWD_REV_LED        ;TURN OFF FWD_REV_LED TO INDICATE REVERSE ROTATION
OF MOTOR
       RETURN
               
;*******************************************************************************
;THIS ROUTINE UPDATES THE OFFSET POINTERS TO THE TABLE AFTER EVERY ACCESS
;*******************************************************************************
UPDATE_TABLE_OFFSET
       BANKSEL        TABLE_OFFSET1
       BTFSS        FLAGS,OFFSET1_FLAG        ;IF SET INCR. ON TABLE
       GOTO        DECREMENT_OFFSET1
       MOVLW        (SINE_TABLE_ENTRIES-1)        ;CHECK FOR THE LAST VALUE ON THE TABLE
       SUBWF        TABLE_OFFSET1,W
       BTFSC        STATUS,C        
       GOTO        CLEAR_OFFSET1_FLAG
       INCF        TABLE_OFFSET1,F                ;INCREMENT OFFSET1
       GOTO        UPDATE_OFFSET2
CLEAR_OFFSET1_FLAG
       BCF        FLAGS,OFFSET1_FLAG
DECREMENT_OFFSET1
       DECFSZ        TABLE_OFFSET1,F                ;DECREMENT OFFSET1
       GOTO        UPDATE_OFFSET2
       BSF        FLAGS,OFFSET1_FLAG

UPDATE_OFFSET2
       BANKSEL        TABLE_OFFSET2
       BTFSS        FLAGS,OFFSET2_FLAG        ;IF SET INCR. ON TABLE
       GOTO        DECREMENT_OFFSET2
       MOVLW        (SINE_TABLE_ENTRIES-1)        ;CHECK FOR THE LAST VALUE ON THE TABLE
       SUBWF        TABLE_OFFSET2,W
       BTFSC        STATUS,C
       GOTO        CLEAR_OFFSET2_FLAG
       INCF        TABLE_OFFSET2,F                ;INCREMENT OFFSET2
       GOTO        UPDATE_OFFSET3
CLEAR_OFFSET2_FLAG
       BCF        FLAGS,OFFSET2_FLAG
DECREMENT_OFFSET2
       DECFSZ        TABLE_OFFSET2,F                ;DECREMENT OFFSET2
       GOTO        UPDATE_OFFSET3
       BSF        FLAGS,OFFSET2_FLAG

UPDATE_OFFSET3
       BANKSEL        TABLE_OFFSET3
       BTFSS        FLAGS,OFFSET3_FLAG        ;IF SET INCR. ON TABLE
       GOTO        DECREMENT_OFFSET3
       MOVLW        (SINE_TABLE_ENTRIES-1)        ;CHECK FOR THE LAST VALUE ON THE TABLE
       SUBWF        TABLE_OFFSET3,W
       BTFSC        STATUS,C
       GOTO        CLEAR_OFFSET3_FLAG
       INCF        TABLE_OFFSET3,F                ;INCREMENT OFFSET3
       RETURN        
CLEAR_OFFSET3_FLAG
       BCF        FLAGS,OFFSET3_FLAG
DECREMENT_OFFSET3
       DECFSZ        TABLE_OFFSET3,F                ;DECREMENT OFFSET3
       RETURN
       BSF        FLAGS,OFFSET3_FLAG
       RETURN        

;*******************************************************************************
;THIS ROUTINE CHECKS FOR THE KEYS STATUS. 2 KEYS ARE CHECKED, RUN/STOP AND
;FORWARD(FWD)/REVERSE(REV)  
;*******************************************************************************
KEY_CHECK
       BANKSEL        PORTB
       BTFSS        PORTB,RUN_STOP_KEY        ;IS RUN_STOP_KEY PRESSED?
       GOTO        RUN_STOP_KEY_PRESSED        ;YES
       BTFSC        FLAGS,MOTOR_RUNNING        ;IS MOTOR RUNNING?
       GOTO        FWD_REV_CHECK                ;YES
       RETURN

RUN_STOP_KEY_PRESSED
       BTFSS        FLAGS,MOTOR_RUNNING        ;IS MOTOR ALREADY RUNNING?
       GOTO        RUN_MOTOR                ;MO

       CALL        STOP_MOTOR                ;STOP MOTOR
       BANKSEL        LED_PORT
       BCF        LED_PORT,RUN_STOP_LED
       BCF        FLAGS,MOTOR_RUNNING        ;CLEAR FLAG TO INDICATE THE SAME
WAIT_1
       BTFSS        PORTB,RUN_STOP_KEY        ;INFINITE LOOP TILL THE TIME PRESSED SWITCH IS
RELEASED
       GOTO        WAIT_1        
       RETURN
       
RUN_MOTOR
       CALL        RUN_MOTOR_AGAIN
       BANKSEL        LED_PORT
       BSF        LED_PORT,RUN_STOP_LED
       BSF        FLAGS,MOTOR_RUNNING
WAIT_2
       BTFSS        PORTB,RUN_STOP_KEY        ;INFINITE LOOP TILL THE TIME PRESSED SWITCH IS
RELEASED
       GOTO        WAIT_2

FWD_REV_CHECK
       BANKSEL        PORTB
       BTFSC        PORTB,FWD_REV_KEY        ;FWD/REV KEY PRESSED?
       RETURN                                ;NO
       CALL        STOP_MOTOR
       
       MOVLW        0X64                        ;ADJUST THIS PARAMETER TO SET TIME BETWEEN CHANGE OF DIRECTION
OF ROTOATION OF MOTOR
       MOVWF        TEMP_LOC_2
WAIT_FOR_MOTOR_TO_STOP
       CALL        DELAY
       DECFSZ        TEMP_LOC_2,F
       GOTO        WAIT_FOR_MOTOR_TO_STOP
       
       CALL        RUN_MOTOR_AGAIN
       BANKSEL        PORTB
       MOVF        FLAGS,W
       ANDLW        0X01
       BTFSS        STATUS,Z
       GOTO        SET_REV_DIRECTION

SET_FWD_DIRECTION
       BSF        FLAGS,MOTOR_DIRECTION
WAIT_3
       BTFSS        PORTB,FWD_REV_KEY        ;INFINITE LOOP TILL THE TIME PRESSED SWITCH IS
RELEASED
       GOTO        WAIT_3
       RETURN

SET_REV_DIRECTION
       BCF        FLAGS,MOTOR_DIRECTION
WAIT_4
       BTFSS        PORTB,FWD_REV_KEY        ;INFINITE LOOP TILL THE TIME PRESSED SWITCH IS
RELEASED
       GOTO        WAIT_4
       RETURN

;*******************************************************************************
;THIS ROUTINE STOPS THE MOTOR BY DRIVING THE PWMS TO 0% DUTY CYCLE. ALSO
DISABLE
;SELECT INTERRUPT TO MAINTAIN STOP CONDITION OF MOTOR
;*******************************************************************************
STOP_MOTOR
       BANKSEL        PIE1
       BCF        PIE1,TMR1IE
       BCF        PIE1,TMR2IE
       BCF        PIE1,ADIE
       BCF        FLAGS,TIMER1_OV_FLAG
       CLRF        CCPR3L
       BCF        STATUS,RP0
       BCF        PORTA,DRIVER_ENABLE
       CLRF        CCPR1L
       CLRF        CCPR2L
       BANKSEL        TABLE_OFFSET1
       CLRF        TABLE_OFFSET1
       BANKSEL        TABLE_OFFSET2
       CLRF        TABLE_OFFSET2
       BANKSEL        TABLE_OFFSET3        
       CLRF        TABLE_OFFSET3
       MOVLW        0X14
       MOVWF        SET_FREQ                ;RESET MOTO FREQUENCY TO 5Hz
       BANKSEL        NEW_FREQ
       MOVWF        NEW_FREQ
       BANKSEL        TEMP_FREQ
       MOVWF        TEMP_FREQ
       RETURN
;*******************************************************************************
;THIS ROUTINE STARTS MOTOR FROM PREVIOUS STOP WITH MOTOR PARAMETERS
INITIALIZED
;*******************************************************************************
RUN_MOTOR_AGAIN
       CALL        INIT_MOTOR_PARAMETERS
       BANKSEL        PIE1
       BSF        PIE1,TMR1IE
       BSF        PIE1,ADIE
       BSF        PIE1,TMR2IE        
       BANKSEL        TMR2_INT_COUNT
       MOVLW        0X50
       MOVWF        TMR2_INT_COUNT
       RETURN

;*******************************************************************************
;THIS ROUTINE INITIALIZES THE PARAMETERS REQUIRED FOR MOTOR INITIALIZATION.
;*******************************************************************************

INIT_MOTOR_PARAMETERS
       BANKSEL        TABLE_OFFSET1
       MOVLW        0X09                        ;INITIALIZE THE TABLE OFFSETS TO 3 REGISTERS
       MOVWF        TABLE_OFFSET1                ;SUCH THAT THEY HAVE 120 DEG. PHASE SHIFT WITH EACH
OTHER
       
       BANKSEL        TABLE_OFFSET2
       MOVLW        0X03
       MOVWF        TABLE_OFFSET2
       
       BANKSEL        TABLE_OFFSET3        
       MOVLW        0X0F
       MOVWF        TABLE_OFFSET3
       
       BSF        FLAGS,OFFSET1_FLAG        ;OFFSET FLAGS INITIALIZATION
       BCF        FLAGS,OFFSET2_FLAG
       BCF        FLAGS,OFFSET3_FLAG

       BANKSEL        TMR1H
       MOVLW        0XF9                        ;TIMER1 INITIALISATION
       MOVWF        FREQ_REF_H
       MOVWF        TMR1H
       MOVLW        0X37        
       MOVWF        TMR1L        
       MOVWF        FREQ_REF_L
       MOVLW        0XB1
       MOVWF        TMR0
       BSF        FLAGS,TIMER1_OV_FLAG
       BSF        PORTA,DRIVER_ENABLE
       RETURN

;*******************************************************************************
;ROUTINE FOR 8*8 BIT MULTIPLICAION
;*******************************************************************************
MUL_8X8  
       CLRF    RESULT_MSB
       CLRF    RESULT_LSB
       MOVF    SET_FREQ,W                ;MOVE THE MULTIPLICAND TO W REG.
       BCF     STATUS,C                    ;CLEAR THE CARRY BIT IN THE STATUS REG.
       MULT    0
       MULT    1
       MULT    2
       MULT    3
       MULT    4
       MULT    5
       MULT    6
       MULT    7
       RETLW   0

;*******************************************************************************
;UPON INITIALIZATION THE SINE TABLE CONTENTS ARE COPIED TO THE RAM FROM
;PROGRAM MEMORY
;*******************************************************************************
COPY_TABLE_TO_RAM
       BANKSEL        SINE_TABLE_RAM
       BANKISEL        SINE_TABLE_RAM
       MOVLW        LOW(SINE_TABLE_RAM)
       MOVWF        FSR
       MOVLW        0X13
       MOVWF        TEMP_LOC
       CLRF        TEMP_LOC_1
COPY_AGAIN
       MOVLW        HIGH(SINE_TABLE)
       MOVWF        PCLATH        
       MOVF        TEMP_LOC_1,W
       CALL        SINE_TABLE
       MOVWF        INDF
       INCF        TEMP_LOC_1,F
       INCF        FSR,F
       DECFSZ        TEMP_LOC,F
       GOTO        COPY_AGAIN

       MOVLW        LOW(SINE_TABLE_RAM)        ;FSR POINTS TO THE STARTING OF THE TABLE
       MOVWF        FSR
       RETURN                

;*******************************************************************************
;GENERAL PURPOSE DELAY ROUTINE - PRESENT DELAY TIME ~38msec
;*******************************************************************************
DELAY
       MOVLW        DELAY_COUNT1
       MOVWF        TEMP_LOC
DEC_TEMP_LOC
       MOVLW        DELAY_COUNT2
       MOVWF        TEMP_LOC_1
DEC_TEMP_LOC_1
       DECFSZ        TEMP_LOC_1,F
       GOTO        DEC_TEMP_LOC_1
       DECFSZ        TEMP_LOC,F
       GOTO        DEC_TEMP_LOC
       RETURN        

;*******************************************************************************
;EQUATION USED FOR CALCULATION OF SINE TABLE ENTRIES = (SIN(ANGLE)+1)*FF/2
;ANGLES ARE FROM 270 DEG. TO 90 DEG. STEP SIZE = 10 DEG.
;*******************************************************************************
TABLE        CODE        0X0005
SINE_TABLE
       ADDWF        PCL,F
       RETLW        0X00
       RETLW        0X01
       RETLW        0X07
       RETLW        0X11
       RETLW        0X1D
       RETLW        0X2D
       RETLW        0X3F
       RETLW        0X53
       RETLW        0X69
       RETLW        0X7F
       RETLW        0X95
       RETLW        0XAB
       RETLW        0XBF
       RETLW        0XD1
       RETLW        0XE1
       RETLW        0XED
       RETLW        0XF7
       RETLW        0XFD
       RETLW        0XFF
;*******************************************************************************
;END OF FILE
;*******************************************************************************
       END

--
View this message in context: www.nabble.com/3-Phase-PWM-using-16f777-please-help-tp19118657p19194063.html
Sent from the PIC - [PIC] mailing list archive at Nabble.com.

2008\08\31@051307 by cdb

flavicon
face
I have had only time to have a quick look at the datasheet and AN889.

However, if you are just going by the LED as an indicator of the PWM
working, at 20KHz you aren't going to see much, it'll always look on.

Have you tried tracing the program flow in MPLAB?

If you are not using the ADC for current/voltage feedback then you
will have a problem here, as part of the reload value comes from the
reading.

A quick way to get you working might be to copy the setup details for
the PWM from either the datasheet for the 16F777 or the code snippet
in the AN889. I looked in the software download file, and there seems
to be a header file missing in the zip.

I'll look more closely when I get time.

Colin


:: what i have done is simplify the circuit to just the control
:: switches PWM output and LEDS that indicate the function of the pic
--
cdb, .....colinKILLspamspam@spam@btech-online.co.uk on 31/08/2008

Web presence: http://www.btech-online.co.uk  

Hosted by:  http://www.1and1.co.uk/?k_id=7988359









'[PIC] 3 Phase PWM using 16f777 please help'
2008\09\02@071302 by Brenno wlaker
flavicon
face


hey colin,

thank for gettin back to me. i have finally had a chance to have a good look
at the program and the flow charts in the datasheet. From my understanding
the SET_ADC_GO sets up the frequency measurements and to also set up samples
from the DC BUS. What i have done is turn off th DC BUS measurement, when it
is called in the AD_CONV_COMPLETE function i removed this section as well as
it says in the datasheet it is used to detect just safe voltage operation n
shutdown the motor when it is out of range. I could be wrong but that is
just how i read it. The section CHECK_FAULT seems to just check safe current
opertion as well and was easy to removie. And like i said my assemlber is
not that great haha the program compiles fine if u use mplab 6.5,  newer
versions seems to compile differently i had troubles as well

thanks for your time

regards

Brendan
--
View this message in context: www.nabble.com/3-Phase-PWM-using-16f777-please-help-tp19118657p19268214.html
Sent from the PIC - [PIC] mailing list archive at Nabble.com.

More... (looser matching)
- Last day of these posts
- In 2008 , 2009 only
- Today
- New search...