PIC16F616
.................... setup_vref(VREF_HIGH|REFERENSSI);
0278: MOVLW 8C This I understand W = 8C
0279: MOVWF 19 This I understand W -> 19 (VRCON)
.................... setup_comparator(CP1_C3_VREF | CP1_OUT_ON_A2 | CP1_INVERT);
027A: MOVLW B7 This I understand W = B7
027B: MOVWF 1A This I understand W -> 1A (CM1CON0)
027C: CLRF 1B This I understand 1B = 00 (CM2CON0)
027D: CLRF 1C This I understand 1C = 00 (CM2CON1)
027F: BSF 03.5 ???? SET but what
0281: CLRF 1A 1A = 00 (CM1CON0) WHY????
0282: CLRF 19 19 = 00 (VRCON) WHY????
monsters_inc
Joined: 18 Jan 2010 Posts: 14
Posted: Thu Feb 18, 2010 2:36 am
Hi.
027F: BSF 03.5 this switch to data memory bank 1(STATUS register bit 5 = 1)
0281: CLRF 1A SRCON1 = 0 (address = 80h+1Ah = 9Ah)
0282: CLRF 19 SRCON0 = 0 (address = 80h+19h = 99h)
Look at page 15 and 18 of datasheet for PIC16F616
Best regards.
jjude
Joined: 12 Nov 2007 Posts: 37
Posted: Thu Feb 18, 2010 3:23 am
monsters_inc wrote:
Hi.
027F: BSF 03.5 this switch to data memory bank 1(STATUS register bit 5 = 1)
0281: CLRF 1A SRCON1 = 0 (address = 80h+1Ah = 9Ah)
0282: CLRF 19 SRCON0 = 0 (address = 80h+19h = 99h)
Look at page 15 and 18 of datasheet for PIC16F616
Best regards.
Okay.
But i need comparator 1 "hysteresis".
.................... setup_comparator(CP1_C3_VREF | CP1_OUT_ON_A2 | CP1_INVERT | CP1_HYST);
027A: MOVLW B7 I understand W = B7
027B: MOVWF 1A I understand W -> 1A (CM1CON0)
027C: CLRF 1B I understand 1B = 00 (CM2CON0)
027D: CLRF 1C I understand 1C = 00(CM2CON1)
027E: MOVLW 80 I understand W = 80
027F: BSF 03.5 I understand SET BANK 1
0280: MOVWF 1A I understand W -> 9A (SRCON1)
0281: CLRF 19 I understand 99 = 00 (SRCON0)
SRCON0 and 1 set LATCH, not HYSTERESIS.
But if hysteresis is enabled, CM2CON1 bit 3 must set "1".
setup_comparator(CP1_C3_VREF | CP1_OUT_ON_A2 | CP1_INVERT | CP1_HYST);
THIS NOT WORK??? PCWH4.099
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
Posted: Thu Feb 18, 2010 12:12 pm
The generated ASM code appears to be buggy. You need to write
directly to the PIC registers as a work-around.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum