conflict of timer1

Started by Ashwin Sathyanarayanan July 17, 2006
Dear all,
I am using a LCD display using pins 5,6,7 & 9 to display on my LCD. And i am Using the input capture pin to measure display the freq. I was wondering if there is a conflict of the timer 1 by any chnace in these 2 functions. Because i am not able to disply the required frequency on the LCD. Cab any one please hwlp me out on this front. Thanks in advace.
Regards,
Ashwin

Option Explicit
' Pin 5 LCD.11 |-- d7
' Pin 6 LCD.12 |-- d6
' Pin 7 LCD.13 |-- d5
' Pin 8 LCD.14 |-- d4
' Pin 9 LCD.4 |-- rs
' GND LCD.5 |-- rw
' Pin 10 LCD.6 |-- e
' Fernando Alonso CampeĆ³n

Public Const LCDClear As Byte = &H01
Public Const LCDCrsrHome As Byte = &H02
Public Const LCDCrsrL1 as byte = &H80
Public Const LCDCrsrL2 as byte = &HC0
Public Const LCDCrsrLeft As Byte = &H10
Public Const LCDCrsrRight As Byte = &H14
Public Const LCDDispLeft As Byte = &H18
Public Const LCDDispRight As Byte = &H1C
Private Const LCD_rs As Byte = 9
Private Const LCD_e As Byte = 10

Public sub LCDIni()

call PutPin(LCD_rs,0)
call Sleep(0.02)
call PonvalorH(bx00110000)
call PulseOut(LCD_e, 1, 1)
call Sleep(0.005)
call PonvalorH(bx00110000)
call PulseOut(LCD_e, 1, 1)
call Sleep(0.005)
call PonvalorH(bx00110000)
call PulseOut(LCD_e, 1, 1)
call Sleep(0.005)
call PonvalorH(bx00100000)
call PulseOut(LCD_e, 1, 1)
call LCDCmd(bx00001100)
call LCDCmd(bx00000110)
call LCDCmd(LCDclear)

End sub

Public Sub LCDCmd(ByVal Valor as Byte)

call PutPin(LCD_rs,0)
call WrtLcd(valor)

End sub

Public sub LCDDat(ByVal Valor as Byte)

call PutPin(LCD_rs,1)
call WrtLcd(Valor)

End sub

Sub WrtLcd(Valor as Byte)

call PonvalorH(Valor)
call PulseOut(LCD_e, 1, 1)
call PonvalorL(Valor)
call PulseOut(LCD_e, 1, 1)

End sub

Sub PonvalorH(ByVal Valor as Byte)

call PutPin(8,GetBit(Valor,7))
call PutPin(7,GetBit(Valor,6))
call PutPin(6,GetBit(Valor,5))
call PutPin(5,GetBit(Valor,4))
call Sleep(0.001)
End sub

Sub PonvalorL(ByVal Valor as Byte)

call PutPin(8,GetBit(Valor,3))
call PutPin(7,GetBit(Valor,2))
call PutPin(6,GetBit(Valor,1))
call PutPin(5,GetBit(Valor,0))
call Sleep(0.001)

End sub

Public Sub PrintLCD(ByVal Cad As String)

Dim Length As Integer
Dim Ch As String * 1
Dim bCh As Byte
Dim x As Integer

Length = Len(Cad)
For x = 1 To Length
Ch = Mid(Cad, x, 1)
bCh = Asc(Ch)
Call LCDDat(bCh)
Next

End Sub

next Sub program

Option Explicit

Public Sub Main()


Dim PulseTrain(1 To 3) As New UnsignedInteger
dim pulse as New UnsignedInteger
dim freq as New UnsignedInteger

Call PutPin(12, 2)

Call InputCapture(PulseTrain, 2, 1)
pulse= PulseTrain(1)+PulseTrain(2)
freq= 1\pulse

call LCDIni()
call printLCD("Handheld Tensiometer")
call lcdcmd(LCDCrsrL2 + 4)
call printlcd(cstr(freq))

call printLCD("Calib Set")


End Sub
M.S.Ashwin
33B Nanyang Avenue,
Nanyan Heights,
#02-03, Room 3,
Singapore 639805

---------------------------------
Do you Yahoo!?
Get on board. You're invited to try the new Yahoo! Mail Beta.