Here is your code with the configs added in. The PBP inc file has been commented out.
I even programmed a chip. I named the file "invent"
Code:
'************************************************* ***************
'* Name : CONTROLLER.BAS *
'* Author : Giorgio Rossi *
'* Notice : Copyright (c) 2008 Invento S.r.l. *
'* : All Rights Reserved *
'* Date : 26/11/2008 *
'* Version : 1.0 *
'* Notes : *
'* Chip : PIC16F88 *
'************************************************* ***************
Asm
ERRORLEVEL -306
ERRORLEVEL -205
Endasm
INCLUDE "MODEDEFS.BAS"
@__CONFIG _CONFIG1, _CP_OFF & _CCP1_RB3 & _DEBUG_OFF & _WRT_PROTECT_OFF & _CPD_OFF & _LVP_OFF & _BODEN_OFF & _MCLR_OFF & _PWRTE_OFF & _WDT_OFF &_XT_OSC
TRISA = %00000001 'RA0 Input
TRISB = %00000000 'all PORTB output
ANSEL = %00000001'only porta.0 is analogue
ADCON1 = 7'right justify the result(top bits are read as zero)
CMCON = 7 'Turn off comparators
adval VAR BYTE
i var BYTE
RPM VAR BYTE
' 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
PAUSE 500
loop:
ADCIN 0,adval
serout PORTB.6,n2400, [$FE, 1]
serout PORTB.6,n2400, [$FE, 2, "pressione ", #adval]
serout PORTB.6,n2400, [$FE, $C0, "giri", #rpm]
IF adval < 90 THEN
HIGH PORTB.4
endif
IF adval > 120 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
<img src="http://www.picbasic.co.uk/forum/attachment.php?attachmentid=3041&stc=1&d=122833886 7" />
Bookmarks