Support QRP CoA Everywhere

Saturday 29 August 2009

M1KTA QRP TCVR - s, vswr and voltage meters



Ok added the feedback for the VSWR, rig PSU and smeter.
I will have to play with the callibration of the smeter but that should be easy enough. Right now just the voltages are displayed as I will need to refine the amplifier and/or voltage divider networks correctly to get them right. When that works I'll flip the smeter over to bars running againt the meter scale on the second row. The vswr also should update the power out level.

The ADC are only running as 8bit which seems to be more than enough, will be using a 5V reference (4.913V or something like that).

The smeter is probably the most complex to get right:
The way it will work is a voltage (in volts) for the S-meter output of the receiver for each S meter reading was be measured.

S0 2.400V
S5 2.412V
S5 2.431V
S7 2.497V
S8 2.578V
S9 2.561V
S9+10 2.755V
S9+20 2.895V

FSD is just 0-500mV

Then I could use the ADC value to determine the s-meter reading.

An alternative is I might use the method qrp2004 applied and not bother with any of this and just record the S9+20 level as the maximum signal and the S0 level as the minimum signal. You can then use fractions of the voltage at S9+20 stored in a lookup table for the different smeter values and the the S-meter reading can be determined. The reason why this might be better is that you can callibrate the smeter. It is probably all relative anyway.

The PIC mikrobasic isn't rocket science. I basically have signals coming into PortA.0, PortA.1 and PortA.2 of the PIC16F877A which are operating as ADC and that converts the values.

An early set of code was:

sub procedure lcdvolts
Lcd_Cmd(LCD_CURSOR_OFF) ' Cursor off
Lcd_Out(2, 30,"V")
end sub

sub procedure voltmeter

'volt meter NB right now FSD is 4.99V!
adc_rd = ADC_read(2) ' get ADC value from RA2
tlong = adc_rd*5000
adc_rd = tlong >> 10
ch = adc_rd div 1000 ' prepare value for diplay

Lcd_Chr(2, 26, 48+ch) ' write ASCII at 2nd row, 26th column
Lcd_Chr(2, 27, ".")

ch = (adc_rd div 100) mod 10
Lcd_Chr(2, 28, 48+ch)

ch = (adc_rd div 10) mod 10
Lcd_Chr(2, 29, 48+ch)

end sub

sub procedure lcdsmeter
Lcd_Cmd(LCD_CURSOR_OFF) ' Cursor off
Lcd_Out(2, 1,"1 3 5 7 9")
CustomChar1(2, 10)
CustomChar2(2, 11)
CustomChar3(2, 12)
CustomChar4(2, 13)
end sub

sub procedure smeter

'smeter NB right now FSD is 4.99V!
adc_rd = ADC_read(0) ' get ADC value from RA0
tlong = adc_rd*5000
adc_rd = tlong >> 10
ch = adc_rd div 1000 ' prepare value for diplay

Lcd_Chr(1, 9, 48+ch) ' write ASCII at 1st row, 9th column
Lcd_Chr(1, 10, ".")

ch = (adc_rd div 100) mod 10
Lcd_Chr(1, 11, 48+ch)

ch = (adc_rd div 10) mod 10
Lcd_Chr(1, 12, 48+ch)

ch = adc_rd mod 10
Lcd_Chr(1, 13, 48+ch)

end sub

sub procedure lcdvswr
Lcd_Cmd(LCD_CURSOR_OFF) ' Cursor off
Lcd_Out(1, 37,"SWR")
end sub

sub procedure vswrmeter
'vswr NB right now FSD is 4.99V!
adc_rd = ADC_read(1) ' get ADC value from RA1
tlong = adc_rd*5000
adc_rd = tlong >> 10
ch = adc_rd div 1000 ' prepare value for diplay

Lcd_Chr(1, 32, 48+ch) ' write ASCII at 1st row, 32nd column
Lcd_Chr(1, 33, ".")

ch = (adc_rd div 100) mod 10
Lcd_Chr(1, 34, 48+ch)

ch = (adc_rd div 10) mod 10
Lcd_Chr(1, 35, 48+ch)

ch = adc_rd mod 10
Lcd_Chr(1, 36, 48+ch)
end sub


Now trying to figure out the I2C or SPI routines to control the DSP and DDS as they will be on a separate dsPIC and PIC or AVR.

No comments: