Error reading ADC channel 5 and 6 routine, PIC 16F684

Moderator: Benj

jeflores
Posts: 12
Joined: Fri Apr 06, 2012 7:37 am
Contact:

Error reading ADC channel 5 and 6 routine, PIC 16F684

Postby jeflores » Fri May 10, 2013 12:57 am

; { FC_CAL_Enable_ADC ; function begin
MOVLW 0x07
ANDWF FC_CAL_Ena_0006D_arg_Conv_Speed, W
MOVWF CompTempVar2234
SWAPF CompTempVar2234, W
ANDLW 0xF0
MOVWF gbl_adcon1
BCF STATUS, RP0
MOVF FC_CAL_Ena_0006D_arg_Channel, W
XORLW 0x00
BTFSC STATUS,Z
GOTO label23
XORLW 0x03
BTFSC STATUS,Z
GOTO label24
XORLW 0x06 //This corresponds to the channel 5, edited by jeflores
BTFSC STATUS,Z
GOTO label25
XORLW 0x03 //This corresponds to the channel 6, edited by jeflores
BTFSC STATUS,Z
GOTO label26
GOTO label27

Error reading ADC routine
It is using 4 adc flowcode components 0,1,2 and 3.
reading channels 0, 3, 5 and 6 of a PIC 16F684.
the program generated and loaded into the microcontroller does not work, when reviewing the code does not appear selecionados corresponding channels in the code snippet you can see that the ports are assigned as port 0,3,6,3.
This is an error of flowcode to generate external functions.
Can you help me fix it please?

NOTE: The program compiles without errors.

to continue reviewing the code I found this snippet which also has error function expression (SWITCH), with 4 picks, 1 to 4.

FCM_INT_TM_00063
; { FCM_INT_TMR1_LEER_AD ; function begin
BCF STATUS, RP0
MOVF gbl_FCV_PWM_OUT, W
SUBLW 0x00
BTFSC STATUS,C
MOVF gbl_FCV_PWM_OUT+D'1', W
BTFSC STATUS,Z
GOTO label31
MOVLW 0x01
SUBWF gbl_FCV_PWM_OUT, F
MOVF gbl_FCV_PWM_OUT+D'1', F
BTFSS STATUS,C
DECF gbl_FCV_PWM_OUT+D'1', F
MOVF gbl_FCV_PWM_OUT, W
BSF STATUS, RP0
MOVWF FCD_PWM0_S_00051_arg_nDuty
BCF STATUS, RP0
MOVF gbl_FCV_PWM_OUT+D'1', W
BSF STATUS, RP0
MOVWF FCD_PWM0_S_00051_arg_nDuty+D'1'
CALL FCD_PWM0_S_00051
label31
CLRF gbl_FCV_NEX_CONV_AD
label32
INCF gbl_FCV_NEX_CONV_AD, W
MOVWF gbl_FCV_NEX_CONV_AD
MOVF gbl_FCV_NEX_CONV_AD, W
XORLW 0x01 ; corresponds to the value 1
BTFSC STATUS,Z
GOTO label33
XORLW 0x03 ; corresponds to the value 2
BTFSC STATUS,Z
GOTO label36
XORLW 0x01 ; corresponds to the value 3
BTFSC STATUS,Z
GOTO label38
XORLW 0x07 ; corresponds to the value 4
BTFSC STATUS,Z
GOTO label43
GOTO label45
label33


to continue reviewing the code I found this snippet which also has error function expression (SWITCH)

label74
MOVF gbl_FCV_STATE_MACHINE, W
XORLW 0x01 ; corresponds to the value 1
BTFSC STATUS,Z
GOTO label75
XORLW 0x03 ; corresponds to the value 2
BTFSC STATUS,Z
GOTO label76
GOTO label77
label75

User avatar
Benj
Matrix Staff
Posts: 13749
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4116 times
Been thanked: 3891 times
Contact:

Re: Error reading ADC channel 5 and 6 routine, PIC 16F684

Postby Benj » Fri May 10, 2013 9:10 am

Hello,

Please can you attach your Flowcode source fcf file and I will have a look into the issues for you.

jeflores
Posts: 12
Joined: Fri Apr 06, 2012 7:37 am
Contact:

Re: Error reading ADC channel 5 and 6 routine, PIC 16F684

Postby jeflores » Sat May 11, 2013 7:21 pm

In reviewing the code and discovered that simulate without error, as implemented did not know the function of selection, thanks for your attention.