I have this configuration in my program
and this asm: (is for frequency meter)Code:' ******************************** LCD ************************************** DEFINE LCD_DREG PORTB 'Selection of the port B DEFINE LCD_DBIT 4 DEFINE LCD_RSREG PORTB 'RS on port RA1 DEFINE LCD_RSBIT 2 DEFINE LCD_EREG PORTB 'E on port RA0 DEFINE LCD_EBIT 3 DEFINE LCD_BITS 4 'Mode 4 bits DEFINE LCD_LINES 4 'LCD 4 lines of 16 caracter PAUSE 500 ' Define ADCIN parameters DEFINE ADC_BITS 8 'Set number of bits in result DEFINE ADC_CLOCK 3 'Set clock source (3=rc) DEFINE ADC_SAMPLEUS 50 'Set sampling time in uS INCLUDE "LCDbar_INC.bas" 'Include the BARgraph routines CMCON = 7 'PortA = digital I/O ANSEL = %00000111 'Will set RA2 as analog and all others as digital
and this asm: (is for frequency meter)Code:Asm movlw 0x10 ;PORTA 4 in entry movwf 0x5 MOVLW 0x37 option ;charge 00110111 in the register option MOVLW 0x10 ;init freq with RA4 in entry MOVWF _trisabuf EndAsm
My problem is the pot not adjust the volt. Show on lcd only if it is full. If i turn litle the pot the volt go to 0volt on lcd.Code:;;;;;;;;;;;;;;;;;;;;;;;;;;;; AUTHORIZATION OF COUNTING clrf TMR0 ; RAZ timer bsf _trisabuf,3 ; RA4 in entry and RA3 in entry authorization counting movf _trisabuf,W tris PORTA ;;;;;;;;;;;;;;;;;;;;;;;;;;;; BASE TIME movf _TEMPS,W movwf _COUNT1 dxxx nop decfsz _COUNT1 GoTo dxxx nop nop Call delay Call delay Call delay Call delay Call delay ;;;;;;;;;;;;;;;;;;;;;;;;;;; STOP OF COUNTING bcf _trisabuf,3 ;RA4 in entry and RA3 at Exit to block counting movf _trisabuf,W tris PORTA
If i remove the two code : tris PORTA on asm code at the end of code the pot adjust linear, but the frequency meter
is not show properly.
In the image the resistor is 47omh and the pot 47kohm




Bookmarks