Hello Every Body!
I'm using a 16F877A Microcontroller connected to a PC using USART, The terminal program on the PC sends some commands to the MUC in order to perform certain task and the MCU should send a message as response for that command:
for example: the MCU measures the temeperature form its analogue input, if I send the command "Temp" from the PC the MCU should respond to me by sending the temperature read. the problem here is after I read the command I can't check its value as following:
Code:
Device = 16F877A
Xtal 8
Declare LCD_Interface 4
Declare LCD_RSPin PORTB.0
Declare LCD_ENPin PORTB.1
Declare LCD_DTPin PORTB.4
Declare Adin_Res 10 ' 10-bit result required
Declare Adin_Tad FRC ' RC OSC chosen
Declare Adin_Stime 50 ' Allow 50us sample time
ADCON1= %10000000
Input PORTA
Dim Digital As Float
Dim Analogue As Float
Dim Temp As Float
Dim RSI[3] As Byte
Main:
Digital = ADIn 0
Analogue = (Digital * 5) / 1024
Temp = Analogue * 100
Print At 1,1,"Temp.: ",Dec Temp
SerIn PORTC.1,1,1000,[Str RSI]
If Str(RSI) = "Tem" Then
SerOut PORTC.0,396,["Temperature: ",Dec Temp ,10,13]
End If
GoTo Main
I'm getting an error at the IF-Then Statement
anyway to do the required. In General how can check for a string like this.
Thank You!
|
Hi, its great to see you
visiting our forum. Why not try Proton Compiler for FREE?
Download the FREE version
of Proton Compiler, Its called Amicus18
and its available from HERE
|