Hopefully these code tags show up properly and this is the place to paste the code, I am new at this
Code:
' Name : dtime.pbp
' Compiler : PICBASIC PRO Compiler 2.60
' Assembler : PM or MPASM
' Target PIC : 40-pin 16F887
' Hardware : Lab-X1
' Oscillator : 20MHz external crystal
'set device type
'fl pic16f887
' Define LCD registers and bits
DEFINE LCD_DREG PORTD
Define LCD_DBIT 4
Define LCD_RSREG PORTE
Define LCD_RSBIT 0
Define LCD_EREG PORTE
Define LCD_EBIT 1
ANSEL = %00000001 ' Set AN0-AN7 to digital with the exeption of AN0
ANSELH = %00000000 ' Set AN8 and higher channels to digital operation
'**********************************************************
dtime VAR WORD
res1 VAR WORD
res2 VAR WORD
res3 VAR WORD
'Set up cap = 2uf pin b.5 to VDD
'nom resistance b.5-b.6 350ohm
'nom resistance b.5-b.4 5ohm
'TRISA = %11111111 ' Set PORTA to all input
Low PORTE.2 ' LCD R/W line low (W)
PAUSE 500 ' Wait .5 second
mainloop:
'measure strain gage resistance
TRISB.6 = 0
TRISB.4 = 1
HIGH portb.6
LOW portb.5
PAUSE 10
RCTIME portb.5,0,dtime
res1 = ((dtime*175)/10)
'measure wiring resistance loop
TRISB.6 = 1
TRISB.4 = 0
HIGH portb.4
LOW portb.5
PAUSE 10
RCTIME portb.5,0,dtime
res2 = ((dtime*175)/10)
res3 = res1-res2
LCDOUT $fe, 1 ' Clear LCD
LCDOUT "Raw ", DEC res1 ' Display value R1
LCDOUT $fe, $88
LCDOUT "Wirie ", DEC res2 ' Display value R2
LCDOUT $fe, $c0
LCDOUT "Gage ", DEC res3 ' Display value R3 PAUSE 1000 ' Wait 1 second
GOTO mainloop
End
Bookmarks