'************************************************************************* '* TBB 206 PLL-Test for Bosch KF428 T - Version 1.1 - * '* Written and copyright 2006 by Armin Graewe, Muenster, Germany * '* www.agfunk.de * DF1QE * phone +49-2533-3322 * '* * '* Discussions about this subject at : www.circuitsonline.net/view/25374 * '* * '* This program may be disributed free in it's original only. * '* This copyright text must be left original and may not be modified. * '* Modifications of the program itself are allowed for personal use only * '* and may not be distributed with the program. * '* This program is for personal ham radio use only ! * '* Any kind of commercial use is strictly forbidden ! * '* This program "is like it is" ! * '* I do not take any warranty for it's function ! * '* The use of this program is on your own risk ! * '* I do not take any responsibility for your computer hard- or software !* '* If you do not agree you may not use or even compile and start it ! * '************************************************************************* '************************************************************************* '* Connection of the KF428 T to the PC-LPT-Port : '* !!! All you do is on your own risk, I take no warranty !!! '* Attention when connecting the KF428 the PC be aware of electrostatic '* discharge. Remember you work in the heart of C-Mos devices ! '* Before you connect to the PC you should at least make a ground '* connection from the PC case to the KF428 case ! '* First you have to dismount the KF428 controller board. '* Then get some printconnectors for the pins, 15 and 18 pins long. '* Take 5 simple wires and solder them to a DB25 male connector for LPT. '* then solder the other side to the printconnectors like listed. '* If you look from the front to the KF428, '* the X2 connector is on the left and the X3 connector is on the right '* and pin 1 is at the front and pin 15 / 18 is at the rear. '* '* PC-LPT-Pin Signal KF428T-Pin '* '* 18 to 25 ----GND-----GND----- X3-9 '* 2 --------D0------SCLPLL-- X3-10 '* 3 --------D1------SDAPLL-- X3-11 '* 4 --------D2------CSPLL--- X3-8 '* 5 --------D3------CSPORT-- X3-13 '* '* You have to make some internal connection to get a basic function : '* '* X3-7 to X3-9 (by a switch) on/off switch '* X2-15 to X3-14 TX-Powercontrol '* X2-4 to X2-3 TX enable '* X2-6 to X2-3 (by a switch) PTT switch '* you can alternate connect X2-4 and X2-6 to X3-15 '* to get PTT control by software (Space key) '* '* To get audio function you need to add the following connections '* RX Audio : '* X2-9 to the + of a 1u capacitor and the - to end of a 10K potmeter '* the other end to ground (X2-3) '* X2-10 to the tap of the potmeter '* Squelch : '* X2-13 with a shottky or germanium diode to X2-11 '* (flow direction to X2-13) '* and from X2-11 a 10u capacitor to ground '* (This is not a good solution, but for experimental state it works) '* TX Audio : '* just connect X3-2 to X3-3 '* (Remark : you need a preamp mic with abt. 100mV output) '************************************************************************* ' And here a last remark to the program : ' Sorry for some "quick and dirty" programming. ' This was kind of a "one night" project and should just be a tool for ' further programming and test proposal not a fine user standard. ' I did intentionally a simple and low level programming to make it ' easy to port it to other platforms like assembler for example ' to put it in a singlechip CPU later. ' It's written in QuickBasic and should run on most QB interpreter ' or compiler. It was written in Microsoft QB 4.5 ' !!! Before you start you should read the program to understand it ' and make some modification for your environment. This is : ' 1. set it for your LPT-Port (found at the start of the programm) ' 2. the timing should be fine for any PC up to some hundred MC ' but if your PC is very quick you should enable one of the ' delay routines you find at the end of the programm. ' Anyhow, I whish you good luck with the experiments ! ' And please let me know your suggestions in the newsgroup. ' Here starts the programm : '-------------------------------------------------------------------------- DECLARE SUB bigzif (o%, l%, value%, chartype$, size%) COLOR 14, 1 CLS LOCATE 1, 12: PRINT "Testprogramm for PLL steering of Bosch KF428 T -Version 1.1-" LOCATE 2, 17: PRINT "Written by Armin Graewe, Muenster, Germany, DF1QE" LOCATE 24, 1: PRINT " ESC = End, m = Modcomp, 2 = Q2, 3 = Q3, 4 = Q4"; LOCATE 25, 1: PRINT " + = up, - = down, * = 1M up, _ = 1M down, Space = PTT, P = TX-Power"; '!!! enable the port you use here !!! '!!! remember some PCI boards use adresses around H6000 !!! 'ba% = &H378 'LPT 1 ba% = &H278 'LPT 2 'ba% = &H3BC 'LPT 3 OUT ba%, 0 'Port ini byte% = 0 clk% = 1 'Clock is D0 dat% = 2 'Data is D1 ena% = 4 'Enable PLL is D2 enb% = 8 'Enable 4094 is D3 tx% = 0 'Transmitter OFF 'tx% = 1 'Transmitter ON 'pwr% = 0 'TX Power HIGH pwr% = 1 'TX Power LOW 'fr = 6.25 'kHz Loopfrequency fr = 12.5 'kHz Loopfrequency fq = 12800 'kHz Referenzfrequency fzf = 21400 'kHz Intermediatefrequency 'frq = 425000 'kHz Channelfrequency start (for originally) frq = 435000 'kHz Channelfrequency start (for 70cm HAM) stp% = 1 'Factor X * fr for f+ and f- q4% = 0 'unused port bits in the 4094 q3% = 0 'you can use them for your own aplication q2% = 0 modcomp% = 4 'Modulation compensation control 'this is for keeping the deviation 'constant over the full frequency range '0 = max deviation, 7 = dev. reduce abt 25% GOSUB tbbini GOSUB inist2 GOSUB setrt GOSUB setnat GOSUB showbig GOSUB set4094 DO DO k$ = INKEY$ LOOP UNTIL k$ <> "" IF k$ = "+" THEN frq = frq + fr * stp% IF k$ = "-" THEN frq = frq - fr * stp% IF k$ = "*" THEN frq = frq + 1000 IF k$ = "_" THEN frq = frq - 1000 IF k$ = " " AND tx% = 0 THEN tx% = 1 GOSUB inist2 GOSUB set4094 ELSE IF k$ = " " AND tx% = 1 THEN tx% = 0 GOSUB inist2 GOSUB set4094 END IF END IF IF k$ = "p" AND pwr% = 0 THEN pwr% = 1 GOSUB set4094 ELSE IF k$ = "p" AND pwr% = 1 THEN pwr% = 0 GOSUB set4094 END IF END IF IF k$ = "m" THEN modcomp% = modcomp% + 1 modcomp% = modcomp% AND 7 GOSUB set4094 END IF IF k$ = "4" AND q4% = 0 THEN q4% = 1 GOSUB set4094 ELSE IF k$ = "4" AND q4% = 1 THEN q4% = 0 GOSUB set4094 END IF END IF IF k$ = "3" AND q3% = 0 THEN q3% = 1 GOSUB set4094 ELSE IF k$ = "3" AND q3% = 1 THEN q3% = 0 GOSUB set4094 END IF END IF IF k$ = "2" AND q2% = 0 THEN q2% = 1 GOSUB set4094 ELSE IF k$ = "2" AND q2% = 1 THEN q2% = 0 GOSUB set4094 END IF END IF GOSUB setnat GOSUB showbig LOOP UNTIL k$ = CHR$(27) END '++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ '***** GOSUBROUTINEN ***** '***** Set 4094 Port ***** set4094: LOCATE 19, 15: PRINT "4094 Port = "; IF pwr% = 0 THEN GOSUB sendnul 'Q8 = TX Powercontrol 0=H (10W) ELSE GOSUB sendone 'Q8 = TX Powercontrol 1=L (1W) END IF IF (modcomp% AND 4) = 0 THEN GOSUB sendnul 'Q7 = ModComp3 ELSE GOSUB sendone END IF IF (modcomp% AND 2) = 0 THEN GOSUB sendnul 'Q6 = ModComp2 ELSE GOSUB sendone END IF IF (modcomp% AND 1) = 0 THEN GOSUB sendnul 'Q5 = ModComp1 ELSE GOSUB sendone END IF IF q4% = 0 THEN GOSUB sendnul 'Q4 = unused ELSE GOSUB sendone END IF IF q3% = 0 THEN GOSUB sendnul 'Q3 = unused ELSE GOSUB sendone END IF IF q2% = 0 THEN GOSUB sendnul 'Q2 = unused ELSE GOSUB sendone END IF IF tx% <> 0 THEN GOSUB sendnul 'Q8 = TX Enable 0=enabled ELSE GOSUB sendone 'Q8 = TX Enable 1=disabled END IF GOSUB sendenb LOCATE 20, 17: PRINT "Modcomp = "; modcomp% LOCATE 21, 16: PRINT "TX-Power = "; IF pwr% = 0 THEN PRINT "high"; ELSE PRINT " low"; END IF RETURN '***** Init with STATUS 2 ***** inist2: LOCATE 15, 15: PRINT " Status 2 = "; GOSUB sendone 'usage of mfo1 (do not modify) GOSUB sendnul 'usage of mfo2 (do not modify) GOSUB sendone 'PD-Pol = pos=1 (do not modify) GOSUB sendnul 'Mod Output = push/pull=0 (do not modify) GOSUB sendone 'Preamp = aktiv=1 (do not modify) GOSUB sendnul 'Anti Back = 20ns GOSUB sendnul 'Sp. Verd 1 = aus=0 (do not modify) GOSUB sendnul 'Sp. Verd 2 = aus=0 (do not modify) GOSUB sendone 'Port 1 = Port 4066 (Looptime 0=fast) IF tx% = 0 THEN GOSUB sendnul 'Port 2 = Port RX/TX (0=RX) ELSE GOSUB sendone 'Port 2 = Port RX/TX (1=TX) END IF GOSUB sendone 'Divider = aktiv=1 (do not modify) GOSUB sendnul 'PD-Strom 1 = 1 mA GOSUB sendone 'PD-Strom 2 = 1 mA PRINT " "; '------------ GOSUB sendnul 'adr GOSUB sendone 'adr GOSUB sendnul 'adr GOSUB sendena RETURN '***** R-Divider ***** setrt: LOCATE 12, 35: PRINT "fr = "; fr; " KHz" LOCATE 12, 55: PRINT "Step = "; fr * stp%; " KHz" rteil = fq / fr LOCATE 16, 15: PRINT "R-Divider = "; PRINT USING "#####"; rteil; PRINT " $"; RIGHT$(" " + HEX$(rteil), 4); PRINT " "; 'GOSUB sendnul 'if you want to send 17 Bit to R-Divider FOR x% = 1 TO 16 IF (rteil AND 32768) = 0 THEN GOSUB sendnul ELSE GOSUB sendone END IF rteil = rteil * 2 AND 65535 NEXT x% PRINT " "; '------------ GOSUB sendone 'adr GOSUB sendnul 'adr GOSUB sendone 'adr GOSUB sendena RETURN '***** Set N/A-Divider ***** '*** Frquency calculation *** setnat: IF tx% = 1 THEN fosc = frq ELSE fosc = frq - fzf END IF LOCATE 12, 10 PRINT "fosc = "; PRINT USING "###,###.#"; fosc; PRINT " KHz" nateil = INT(fosc / fr) 'calculate total division ateil = nateil AND 127 'take out A-Divider nteil = nateil - ateil 'calculate N-Divider nteil = nteil / 64 'and shift 7 bits to the right nteil = nteil AND 4094 'Set LSB to 0, is alredy in A-Div MSB '** A-Divider ** LOCATE 17, 15: PRINT "A-Divider = "; PRINT USING " ###"; ateil; PRINT " $"; RIGHT$(" " + HEX$(ateil), 4); PRINT " "; FOR x% = 1 TO 7 IF (ateil AND 64) = 0 THEN GOSUB sendnul': PRINT "0"; ELSE GOSUB sendone': PRINT "1"; END IF ateil = ateil * 2 AND 127 NEXT x% '** N-Divider ** LOCATE 18, 15: PRINT "N-Divider = "; PRINT USING "#####"; nteil; PRINT " $"; RIGHT$(" " + HEX$(nteil), 4); PRINT " "; FOR x% = 1 TO 12 IF (nteil AND 2048) = 0 THEN GOSUB sendnul ': PRINT "0"; ELSE GOSUB sendone ': PRINT "1"; END IF nteil = nteil * 2 AND 4095 NEXT x% PRINT " "; '------------ GOSUB sendone 'adr GOSUB sendone 'adr GOSUB sendone 'adr GOSUB sendena RETURN '***** TBB206 Initialisation ***** tbbini: LOCATE 14, 15: PRINT " TBB ini = "; GOSUB sendclk GOSUB sendclk GOSUB sendclk GOSUB sendena RETURN '***** Port Routinen ***** sendnul: byte% = INP(ba%) AND NOT dat% OUT ba%, byte% GOSUB delay GOSUB sendclk PRINT "0"; RETURN sendone: byte% = INP(ba%) OR dat% OUT ba%, byte% GOSUB delay GOSUB sendclk PRINT "1"; RETURN sendclk: byte% = INP(ba%) OR clk% OUT ba%, byte% GOSUB delay byte% = INP(ba%) AND NOT clk% OUT ba%, byte% GOSUB delay RETURN sendena: byte% = INP(ba%) OR ena% OUT ba%, byte% GOSUB delay byte% = INP(ba%) AND NOT ena% OUT ba%, byte% GOSUB delay byte% = 0 OUT ba%, byte% GOSUB delay PRINT "/"; RETURN sendenb: byte% = INP(ba%) OR enb% OUT ba%, byte% GOSUB delay byte% = INP(ba%) AND NOT enb% OUT ba%, byte% GOSUB delay byte% = 0 OUT ba%, byte% GOSUB delay PRINT "\"; RETURN '***** Warteroutine ***** delay: RETURN FOR xxx% = 1 TO 10000: NEXT xxx% RETURN it = TIMER + .0001 DO LOOP UNTIL TIMER > it RETURN '***** Grossanzeige ***** showbig: IF tx% = 0 THEN COLOR 10, 1 ELSE COLOR 12, 1 END IF zif$ = STR$(frq) FOR x% = 2 TO 5 zif% = VAL(MID$(zif$, x%, 1)) IF x% = 5 THEN zif% = -1 bigzif 5, 1 + x% * 8, zif%, "", 1 NEXT x% FOR x% = 5 TO 7 zif% = VAL(MID$(zif$, x%, 1)) bigzif 5, 9 + x% * 8, zif%, "", 1 NEXT x% COLOR 14, 1 RETURN SUB bigzif (o%, l%, value%, chartype$, size%) 'gibt eine grossziffer auf dem bildschirm aus IF value% > 9 OR value% < -1 THEN EXIT SUB DIM v%(20) v%(0) = 63: v%(1) = 6: v%(2) = 91: v%(3) = 79: v%(4) = 102 v%(5) = 109: v%(6) = 125: v%(7) = 7: v%(8) = 127: v%(9) = 111 IF value% = -1 THEN v% = 128 'DP ELSE v% = v%(value%) END IF IF chartype$ = "" THEN chartype$ = "Û" ct% = ASC(chartype$) IF size% <= 1 OR size% > 3 THEN size% = 1 'cls FOR x% = o% TO o% + size% * 2 + 2 LOCATE x%, l%: PRINT STRING$(size% * 2 + 2, 32) NEXT x% 'a IF v% AND 1 THEN LOCATE o%, l%: PRINT STRING$(size% * 2 + 2, ct%) 'b IF v% AND 2 THEN FOR x% = 0 TO size% + 1 LOCATE o% + x%, l% + size% * 2 + 1: PRINT CHR$(ct%); NEXT x% END IF 'c IF v% AND 4 THEN FOR x% = 0 TO size% + 1 LOCATE o% + size% + 1 + x%, l% + size% * 2 + 1: PRINT CHR$(ct%); NEXT x% END IF 'd IF v% AND 8 THEN LOCATE o% + 2 * size% + 2, l%: PRINT STRING$(size% * 2 + 2, ct%) 'e IF v% AND 16 THEN FOR x% = 0 TO size% + 1 LOCATE o% + size% + 1 + x%, l%: PRINT CHR$(ct%); NEXT x% END IF 'f IF v% AND 32 THEN FOR x% = 0 TO size% + 1 LOCATE o% + x%, l%: PRINT CHR$(ct%); NEXT x% END IF 'g IF v% AND 64 THEN LOCATE o% + size% + 1, l%: PRINT STRING$(size% * 2 + 2, ct%) 'dp IF v% AND 128 THEN LOCATE o% + size% + 3, l%: PRINT " "; STRING$(1, ct%) END SUB