Hello all,

I'm newbie, the goal of my project it's to use only RA0 in ADC mode and
the rest of TRISA in a digital input but, in this setting don't work.

Any help will be appreciated.

Thanks a lot and regards

giorgio

The Code :

'************************************************* ***************
'* Name : CONTROLLER.BAS *
'* Author : [select VIEW...EDITOR OPTIONS] *
'* Notice : Copyright (c) 2008 [select VIEW...EDITOR OPTIONS] *
'* : All Rights Reserved *
'* Date : 26/11/2008 *
'* Version : 1.0 *
'* Notes : *
'* Chip : PIC16F88 *
'************************************************* ***************
INCLUDE "MODEDEFS.BAS"
define OSC 4
adval VAR BYTE
i var BYTE
RPM VAR BYTE




ADCON0.7 = 1 ' right justify result
ANSEL = %00000001 ' set AN0 analog, rest digital
CMCON = 7 ' analog comparators off

TRISA = %00001111 'RA.0:3 Input
TRISB = %00000000 'all PORTB output

Output PORTB.4 ' set RB0 as output
Output PORTB.5 ' set RB1 as output

loop:
ADCIN 0,adval
IF adval < 90 THEN
HIGH PORTB.4
endif

IF adval > 100 THEN
LOW PORTB.4
endif

COUNT PORTA.2,250,RPM
for i = 1 to rpm
toggle PORTB.5
PAUSE 25
NEXT i
LOW PORTB.5
GOTO loop 'repeat