A/D coversion and the entire code simulation is ok, except when values for AN0 are set small.
Then the LCD does not show "Input is too low".
P.S.: The logarythmic signal detector (ahaed of the MCU circuit) output is ca. 0.45 VDC (broadband noise signal) without any input signal applied. In this case I want to display the above message.
again:
Lcdcmdout LcdClear
ADC_Read 0, ADCRead 'Result of A/D conversion from AN0
ADCResult = ADCRead*5/1024
Lcd_Out(1,1, "ADC OUT = " + #ADCResult +" V")
If ADCResult<0.5 Then
Lcd_Out(2,1, "Input is too low")
Else
dBmResult = (ADCResult-ZEROXING)*SLOPE
Lcd_Out(2,1, "PWR = " + #dBmResult + " dBm")
Endif
WaitMs 500
Goto again 'Make a new A/D conversion
Goto main
End
Then the LCD does not show "Input is too low".
P.S.: The logarythmic signal detector (ahaed of the MCU circuit) output is ca. 0.45 VDC (broadband noise signal) without any input signal applied. In this case I want to display the above message.
again:
Lcdcmdout LcdClear
ADC_Read 0, ADCRead 'Result of A/D conversion from AN0
ADCResult = ADCRead*5/1024
Lcd_Out(1,1, "ADC OUT = " + #ADCResult +" V")
If ADCResult<0.5 Then
Lcd_Out(2,1, "Input is too low")
Else
dBmResult = (ADCResult-ZEROXING)*SLOPE
Lcd_Out(2,1, "PWR = " + #dBmResult + " dBm")
Endif
WaitMs 500
Goto again 'Make a new A/D conversion
Goto main
End