DF7TV's notes on SI570/PICAXE experiments

This is a blog to document some of the experiments of DF7TV using the programmable crystal oscillator SI570 from Silicon Laboratories controlled by a PICAXE processor 28X1 from Revolution Education Ltd. The main components of the circuit "SRC11" are the SI570 DCO on a board made by David, WB6DHW, a PICAXE microprocessor 28X1, a Microchip I2C-EEPROM 24LC256(32kByte) and a (serially controlled) LCD.

Selection of predefined segment/frequency values at this time is accomplished by two simple potentiometers connected to two of the A/D converters of the processor. Divider values needed for the SI570 to be set to different frequencies are (once only and externally) calculated using the program "Si57x Programmer" by Silicon Laboratories and then are stored to the EEPROM together with some comment related to the segment/frequency. Depending upon the settings of the potentionmeters the related comment is displayed on the LCD and when the "Set" button is pressed the divider values stored with this accompanying comment are read from the EEPROM and transfered to the SI570 chip on the WB6DHW Si570 board. The SI570 will thus be set to the selected frequency.

Please be kindly informed that there are a lot of different possibilities to control the SI570 programmable crystal oscillator and the one shown here is only the way I decided to go. One of the reasons that I have chosen the PICAXE approach is that I wanted to be able to write the software myself -- the BASIC language used to program PICAXE processors and the very helpful manuals available at the site of Revolution Education Ltd. combined with the availability of an I2C interface at the 28X1 processor help a lot to reduce the time (...and the errors made) from idea to realisation.

Please have a look at the "softrock40" group at yahoogroups to get informations on other possible ways to go. Soon after the idea of using an SI570 oscillator came up on this list (around october 2007) a lot of ideas about its control began to evolve.

The schematic of the circuit SRC11 I am using for my first experiments is shown below.

  Schematic of the circuit SRC11 by DF7TV



# There is an error in the SRC11 schematic shown in this blog concerning the reset line /rst of PICAXE28X1: The "uP Reset" switch SW1 should be connected between pin 1 of PICAXE28X1 and ground.

   Thanks to Peter Gant, HA5RXZ who informed me about that error.


# Please see also DF7TV's notes on SoftRock RXTX experiments for further PICAXE experiments.





At the time I write this, i.e. March 29, 2008, I have already written some small pieces of software and already done some experiments using the circuit SRC11 but I will try to show my acitivities in a "blog-like" style. That is to say I'll use the current date within the blog and, for example, if I already installed some software I'll do that again at the date of the blog because I do not remember what pitfalls one may (...and I did) fall into. I would like this blog to be as helpful as possible for those interested in SI570/PICAXE experiments and so I'll try to remember how I began this project in January 2008 and tell the story with the correct sequence of events.

The code for the 28X1 processor in this blog is made available for personal use.

A big THANK YOU! to Cecil Bayona, K5NWA for supporting the presentation and discussion of projects at dspradio.org.

March 29, 2008

Thanks to a group buy organized by Tom Hoflich, KM5H I received three SI570 in January 2008. I ordered one of the CMOS and two of the LVDS version of the chip. The CMOS version will be used first.

  1. Reading the part number from the SI570: "CAC000141G"
  2. Generating a spec sheet for this SI570 using Silicon Laboratories' XO/VCXO Part Number Lookup
  3. Oscillator Part Number Information
    PART NUMBER: 570CAC000141DG
    Model Number: Si570 (Programmable XO)
    Output Format: CMOS
    VDD: 3.3V
    Output Enable Polarity: OE active high
    Temperature Stability: +/- 50 ppm
    Frequency Range: 10 - 160 MHz
    Startup Frequency (MHz): 56.3200000
    I2C Address: 55 hex (85 decimal)
    Operating Temperature Range (°C): -40 to +85
    Datasheet: si570_si571.pdf

  4. The I2C bus address 55 hex (85 decimal) found in the spec sheet will be needed to program the device.
  5. Detailed informations about the chip and its programming are found in the general data sheet of the SI570/SI571


March 30, 2008

David Brainerd, WB6DHW developed a circuit and Si570 board and made available a kit for the evaluation of the SI570. I got three of the kits and a first one was assembled for the CMOS version of the programmable crystal oscillator.

  1. Download of the schematic and layout of WB6DHW's Si570 board.
  2. Selecting and installing components on the Si570 board for the CMOS version of the SI570:
    C2, C5, C8 = 0.01 uF
    C4, C6 = 0.1 uF
    C1, C3 = 10 uF
    R9, R8, R7, R6 = 1 kOhm
    R2 = 200 kOhm
    C7: a short wire is installed instead of the capacitor
    U2 = SI570 (CMOS)
    U1 = LP2992
    U3 = GTL2002
    R1, R3, R4, R5, C7, H1, H3, H4, SMA connectors J1, J2: not installed
  3. +5V supply for U1 is connected to the pad of R1 next to C1 by a wire, GND for U1 is connected to pin 2 of H4 by a wire. The two wires supplying U1 are twisted and provide a direct and short (low resistance) connection to the 5V-supply used.
  4. A 4-pin SIL male connector appropriate to be inserted into a breadboard (experimentation board) is installed on the bottom of the Si570 board at the location of H2. It serves for connection to +5V (to the power supply of the processor used), GND and I2C BUS on the breadboard.
  5. OUTPUT: J2 (center is CLK+, GND is taken from one of the holes forseen for fixing the SMA connector J2). A short twisted wire is used for the connection from J2 to the load.
  6. Smoke test of the Si570 board with the output connected to a scope showed it is working o.k. at an output frequency of about 56 MHz. No connection to H2 is made during this test.
  7. The picture below shows the current status of the Si570 board wíth the output wire removed.

Si570 board of WB6DHW

April 1, 2008

Tom Hoflich, KM5H brought up the proposal using a SI570 oscillator and presented the code for a PICAXE processor (18X1) to control it in a simple manner at the "softrock40" forum around october 2007. After I had a look to the site of Revolution Education Ltd., the manufacturer of these preprogrammed processors (so that the user may program these PIC processors in BASIC), I deciced to give them a try. The PICAXE processors are forseen for pupils experimenting in this area for the first time so all the manuals are very easy to understand and a lot of documentation on simple experiments is available. I decided to use a 28X1 processor because it offers a lot of I/O pins which may become handy when it comes to future extensions.


  1. Installing the PicAxe Programming Editor:
    • Download the Programming Editor (full version)
    • Install the downloaded file (EXE).
    • After the installation the PICAXE Programming Editor and some manuals and data sheets (PDF) will be available. See "HELP" for the manuals and data sheets.
  2. Configure the Editor according to the download cable you are using (USB/RS-232). See "VIEW" -- "OPTIONS" ; you'll find additional help for the USB cable within this menu. I tried both, first the RS-232 and then the USB cable and both worked fine without problems.
  3. Within VIEW -- OPTIONS -- EDITOR uncheck the box SERIAL TERMINAL... "Open after download"


PICAXE Programming Editor

April 4, 2008

I would like to draw your attention to some parts of the introductory PICAXE Manual Section 1 -- Getting Started. The page numbers given in brackets may change, they refer to Version 6.2 01/2008 of the manual.

  • Software Installation (page 16)
  • PICAXE-28A/28X/28X1/28X2 Pinout and Circuit (pages 26, 27)
  • USB and Serial and Enhanced Serial Download Circuit (pages 30 to 32)
  • Tutorial 1 – Understanding and using the PICAXE System (page 52)
  • PICAXE-28A / 28X / 28X1 / 28X2 Commands (page 70)
  • Appendix E – Configuring PICAXE-28X / 28X1 Input-Output Pins (pages 78, 79)
  • FAQ (pages 86 to 95)


The Enhanced Serial Download Circuit is the one I use for the breadboard adapter CT1 in circuit SRC11. This Download Circuit (you will have to add a diode BAT85 -- or similar Schottky diode -- and a resistor of 180 Ohm to a standard breadboard adapter if you bought it as a kit AXE029) is presented in PICAXE Manual Section 1 (page 32) from Revolution Education Ltd.

April 5, 2008

Installation of the Software "Si57x Programmer" of Silicon Laboratories, measuring the output frequency of the SI570 and finding the correct setting for "Fxtal".
You will have to replace the measured and calculated values shown here by those corresponding to your SI570. I recommend to let the SI570 and frequency counter warm up for a while (the longer the better) before you begin with your measurements.


  1. Download of the Si57x EVB Software version 1.2
  2. Installation of Si57x EVB Software version 1.2
  3. The program to be used here is "Si57xProgrammer" and after installation it is found in the folder "...Silicon Laboratories\Si57x EVB Software"
  4. Measurement of the SI570 start-up frequency: Fstart = 56,3198 MHz
  5. Fstart is entered as "device's start-up frequency" and as "new output frequency" within the Si57xProgrammer
  6. Within OPTIONS -- ADVANCED OPTIONS Fxtal is set to Fxtal_0 = 114,285000 MHz (default value)
  7. The APPLY DEFINITION button in the main window is pressed.
  8. The CREATE EXAMPLE button is pressed.
  9. Within the tab SUMMARY the new register configuration is found at the end of the listing
    New Register Configuration
    Register 7 = 0xE1
    Register 8 = 0xC2
    Register 9 = 0xB5
    Register 10 = 0xDD
    Register 11 = 0x40
    Register 12 = 0xF8
  10. Registers 7 to 12 of the SI570 are set using the program src11_set_reg.bas


    'program src11_set_reg.bas
    'Thomas MARTIN, DF7TV
    'date 080405
    'main hardware used:
    'uP: Picaxe 28X1
    'DCO: SI570 chip 570CAC000141DG (CMOS)
    'Si570 board by WB6DHW
    'Values for Registers 7 to 12 of the SI570 are entered
    'directly in this program code at the lines
    '"let b21 = ..." (= register 7) to "let b26 = ..." (= register 12).
    'This program is used here to find out the appropriate "fxtal" setting
    'in the "Si57xProgrammer" (Silicon Laboratories) software which leads
    'to the correct calculation of register values 7 to 12
    'for new frequencies.
    'It may also be used to set the registers 7 to 12 for
    'other purposes.
    main: pause 500 'time for initialising

    'set the register values to be sent to the DCO:

    let b21 = $E1 'reg 7
    let b22 = $C2
    let b23 = $B5
    let b24 = $DD
    let b25 = $40
    let b26 = $F8 'reg 12

    st570: 'set SI570 frequency
    i2cslave %10101010,i2cfast,i2cbyte 'initialize I2C for SI570 I2C
    'address 85 decimal = 1010101 bin
    pause 10 '-> slave address 10101010 (bit 0
    'set to 0 as "don't care"-bit)
    writei2c 137,($10) 'freeze DCO so freq can be modified
    pause 10 'wait for write
    writei2c 7,(b21, b22, b23, b24, b25, b26) 'write SI570 registers 7-12
    pause 10 'wait for write
    writei2c 137,($00) 'unfreeze DCO
    pause 10
    writei2c 135,($40) 'newfreq

  11. Measurement of the SI570 output frequency: Fout_1 = 56,3134 MHz
  12. Calculating Fxtal_1 as a new value for Fxtal:

        Fxtal_1 = Fout_1/Fstart * Fxtal_0 = 114,272013 MHz
  13. Within OPTIONS -- ADVANCED OPTIONS the Fxtal is set to Fxtal_1 = 114,272013 MHz
  14. "device's start-up frequency" and "new output frequency" rest unchanged (56,3198 MHz).
  15. The APPLY DEFINITION button in the main window is pressed.
  16. The CREATE EXAMPLE button is pressed.
  17. Within the tab SUMMARY the new register configuration is found at the end of the listing.
  18. Registers 7 to 12 of the SI570 are set using the program src11_set_reg.bas
    in the same manner as shown above.
  19. Measurement of the SI570 output frequency: Fout_2 = 56,3198 MHz. With Fout_2 being equal to the intended new output frequency the current value of the crystal frequency Fxtal_1 = 114,272013 MHz and the current value of the start-up frequency Fstart = 56,3198 MHz should lead to a correct calculation of future new output frequencies. (These parameters will have to be entered again if the program "Si57xProgrammer" is terminated between calculations.)
  20. If you do not arrive at the desired precision of Fout_2 at the preceeding step it might be necessary to repeat step 12 to step 19 with the index of Fout_ as well as the index of Fxtal_ incremented by one.
  21. To test the settings for the start-up frequency and the crystal frequency a set of register values for the new output frequencies 10, 28 and 150MHz was calculated and programmed to the SI570 using src11_set_reg.bas. The measured output frequencies were as intended.
  22. The OPTIONS -- ADVANCED OPTIONS window of the Silicon Laboratories Si57xProgrammer showing the setting of Fxtal:

    OPTIONS -- ADVANCED OPTIONS window of the Silicon Laboratories Si57xProgrammer

  23. The main window of the Silicon Laboratories Si57xProgrammer, settings and result (found at the bottom of tab "Summary") for a new output frequency of the SI570 at 28,000 MHz:

    Main window of Silicon Laboratories Si57xProgrammer


  25. The picture below shows the output signal of the SI570 at 150 MHz. Do not take the nice-looking shape of the wave form too seriously; I think probe mismatch and limited scope bandwidth helped. The measured frequency 150.000 MHz is displayed at the lower right corner of the picture.
  26. Output signal of the SI570 at 150 MHz

April 6, 2008

At the end of this blog two programs for the PICAXE 28X1 are shown.


  1. src11_24lc256_write_40_30_20_17.bas serves to write register values (which were calculated by the "Si57x Programmer" in the same manner as shown above) to the Microchip I2C EEPROM 24LC256. It may be helpful as a template into which you may enter your own values. Please see the comments in the program for further details. At this time I limited the content to four segments (~ bands); depending on the configuration the EEPROM may easily store register values and frequency information text (characters) for more than 1000 different frequencies. If you want to write a large number of values to the EEPROM using the methode shown here it may be necessary to split the data into several files, each for some address range, because of the limitation of program size for the PICAXE 28X1.
  2. src11.bas is loaded to the PICAXE processor after src11_24lc256_write_40_30_20_17.bas was used to write the EEPROM. src11.bas is the main control program. I used only 4 segments but you may adapt the code according to your needs for 2, 4, 8 or 16 segments by simple commenting/or not commenting the according line (see "let w8 = w8/..." in the code). (Frequencies displayed on the diplay are 1/4 of the real output frequency of the SI570.) Again please look into the source code for some further explanations.


April 7, 2008

Added the EEPROM addresses for the frequency infos storable in the segments 05 to 16 as a comment to the file src11_24lc256_write_40_30_20_17.bas. This should simplify the modification of this file to hold frequency informations for more than the four segments shown. You should not try to write one file for all 16 segments, due to the limitation of program size of the PICAXE processor no more than 6 segments may be within a single file. (So to get all 16 segments written to the EEPROM you'll have to divide the task into a minimum of three files.)

April 14, 2008

Two pictures of the program Si57xProgrammer of Silicon Laboratories (see above) were added showing where the input values (Fxtal, Fstart, new output frequency) are entered within the Si57xProgrammer and where the result, i.e. the calculated new register values, are outputted.

This blog now shows the complete way from receiving the SI570 chip, building WB6DHW's Si570 board and combining it with a PICAXE 28X1 processor and an EEPROM by the SRC11 circuit to get an oscillator with selectable output frequencies.

The next project of DF7TV will be the RXTXv6.2 20m/30m.

DF7TV's notes on RXTXv6.2 - 20m/30m

73 and thank you for reading this blog!
Thomas, DF7TV


'program src11_24lc256_write_40_30_20_17.bas
'date 080407
'write frequency info and SI570 register values to
'I2C EEPROM 24LC256 (Microchip) 256 kilobit = 32 kilobyte
'Parmeters used at calculation of the register values using
'"Si57x Programmer" (depending upon the actual SI570 chip):
' Fxtal = 114,272013 MHz, Fstart = 56,3198 MHz
'Each frequency entry starts at a new EEPROM page of 64 bytes.
'The first address used is at center of the address room of the
'24LC256 at $4000 = 16384 (dec)
pause 500 'wait to initialise
i2cslave %10100000, i2cfast, i2cword 'set EEPROM parameters
pause 100
'write segment 01
writei2c $4000,("40m 7,000MHz", $E3, $C2, $B2, $00, $B2, $60)
pause 10
writei2c $4040,("40m 7,020MHz", $E3, $C2, $B3, $F9, $62, $6E)
pause 10
writei2c $4080,("40m 7,040MHz", $E3, $C2, $B5, $F2, $12, $7B)
pause 10
writei2c $40C0,("40m 7,060MHz", $E3, $C2, $B7, $EA, $C2, $89)
pause 10
writei2c $4100,("40m 7,080MHz", $E3, $C2, $B9, $E3, $72, $96)
pause 10
writei2c $4140,("40m 7,100MHz", $E3, $C2, $BB, $DC, $22, $A4)
pause 10
writei2c $4180,("40m 7,120MHz", $E3, $C2, $BD, $D4, $D2, $B1)
pause 10
writei2c $41C0,("40m 7,140MHz", $28, $42, $A7, $CF, $3B, $61)
pause 10
writei2c $4200,("40m 7,160MHz", $28, $42, $A9, $B6, $B6, $E2)
pause 10
writei2c $4240,("40m 7,180MHz", $28, $42, $AB, $9E, $32, $63)
pause 10
writei2c $4280,("40m 7,200MHz", $28, $42, $AD, $85, $AD, $E5)
pause 10
writei2c $42C0,("40m 7,220MHz", $65, $C2, $A7, $56, $CB, $8C)
pause 10
writei2c $4300,("40m 7,240MHz", $65, $C2, $A9, $38, $8A, $DF)
pause 10
writei2c $4340,("40m 7,260MHz", $65, $C2, $AB, $1A, $4A, $31)
pause 10
writei2c $4380,("40m 7,280MHz", $65, $C2, $AC, $FC, $09, $84)
pause 10
writei2c $43C0,("40m 7,300MHz", $65, $C2, $AE, $DD, $C8, $D7)
pause 10 'write segment 02
writei2c $4400,("30m 10,000MHz", $A3, $42, $C1, $AF, $42, $11)
pause 10
writei2c $4440,("30m 10,020MHz", $A3, $42, $C3, $18, $91, $8F)
pause 10
writei2c $4480,("30m 10,040MHz", $A3, $42, $C4, $81, $E1, $0D)
pause 10
writei2c $44C0,("30m 10,060MHz", $A3, $42, $C5, $EB, $30, $8B)
pause 10
writei2c $4500,("30m 10,080MHz", $A3, $42, $C7, $54, $80, $09)
pause 10
writei2c $4540,("30m 10,100MHz", $A3, $42, $C8, $BD, $CF, $87)
pause 10
writei2c $4580,("30m 10,120MHz", $44, $C2, $A8, $25, $42, $1D)
pause 10
writei2c $45C0,("30m 10,140MHz", $44, $C2, $A9, $7D, $5D, $0F)
pause 10
writei2c $4600,("30m 10,160MHz", $44, $C2, $AA, $D5, $78, $01)
pause 10
writei2c $4640,("30m 10,180MHz", $44, $C2, $AC, $2D, $92, $F3)
pause 10
writei2c $4680,("30m 10,200MHz", $44, $C2, $AD, $85, $AD, $E5)
pause 10
writei2c $46C0,("30m 10,220MHz", $44, $C2, $AE, $DD, $C8, $D7)
pause 10
writei2c $4700,("30m 10,240MHz", $44, $C2, $B0, $35, $E3, $C9)
pause 10
writei2c $4740,("30m 10,260MHz", $44, $C2, $B1, $8D, $FE, $BA)
pause 10
writei2c $4780,("30m 10,280MHz", $44, $C2, $B2, $E6, $19, $AC)
pause 10
writei2c $47C0,("30m 10,300MHz", $44, $C2, $B4, $3E, $34, $9E)
pause 10 'write segment 03
writei2c $4800,("20m 14,000MHz", $E1, $C2, $B2, $00, $B2, $60)
pause 10
writei2c $4840,("20m 14,020MHz", $E1, $C2, $B2, $FD, $0A, $67)
pause 10
writei2c $4880,("20m 14,040MHz", $E1, $C2, $B3, $F9, $62, $6E)
pause 10
writei2c $48C0,("20m 14,060MHz", $E1, $C2, $B4, $F5, $BA, $75)
pause 10
writei2c $4900,("20m 14,080MHz", $E1, $C2, $B5, $F2, $12, $7B)
pause 10
writei2c $4940,("20m 14,100MHz", $E1, $C2, $B6, $EE, $6A, $82)
pause 10
writei2c $4980,("20m 14,120MHz", $E1, $C2, $B7, $EA, $C2, $89)
pause 10
writei2c $49C0,("20m 14,140MHz", $E1, $C2, $B8, $E7, $1A, $8F)
pause 10
writei2c $4A00,("20m 14,160MHz", $E1, $C2, $B9, $E3, $72, $96)
pause 10
writei2c $4A40,("20m 14,180MHz", $E1, $C2, $BA, $DF, $CA, $9D)
pause 10
writei2c $4A80,("20m 14,200MHz", $E1, $C2, $BB, $DC, $22, $A4)
pause 10
writei2c $4AC0,("20m 14,220MHz", $E1, $C2, $BC, $D8, $7A, $AA)
pause 10
writei2c $4B00,("20m 14,240MHz", $E1, $C2, $BD, $D4, $D2, $B1)
pause 10
writei2c $4B40,("20m 14,260MHz", $E1, $C2, $BE, $D1, $2A, $B8)
pause 10
writei2c $4B80,("20m 14,280MHz", $E1, $C2, $BF, $CD, $82, $BE)
pause 10
writei2c $4BC0,("20m 14,300MHz", $E1, $C2, $C0, $C9, $DA, $C5)
pause 10 'write segment 04
writei2c $4C00,("17m 18,000MHz", $62, $42, $C1, $AF, $42, $11)
pause 10
writei2c $4C40,("17m 18,020MHz", $62, $42, $C2, $77, $FC, $74)
pause 10
writei2c $4C80,("17m 18,040MHz", $62, $42, $C3, $40, $B6, $D6)
pause 10
writei2c $4CC0,("17m 18,060MHz", $62, $42, $C4, $09, $71, $38)
pause 10
writei2c $4D00,("17m 18,080MHz", $62, $42, $C4, $D2, $2B, $9B)
pause 10
writei2c $4D40,("17m 18,100MHz", $62, $42, $C5, $9A, $E5, $FD)
pause 10
writei2c $4D80,("17m 18,120MHz", $62, $42, $C6, $63, $A0, $60)
pause 10
writei2c $4DC0,("17m 18,140MHz", $62, $42, $C7, $2C, $5A, $C2)
pause 10
writei2c $4E00,("17m 18,160MHz", $62, $42, $C7, $F5, $15, $25)
pause 10
writei2c $4E40,("17m 18,180MHz", $62, $42, $C8, $BD, $CF, $87)
pause 10
writei2c $4E80,("17m 18,200MHz", $62, $42, $C9, $86, $89, $E9)
pause 10
writei2c $4EC0,("17m 18,220MHz", $62, $42, $CA, $4F, $44, $4C)
pause 10
writei2c $4F00,("17m 18,240MHz", $62, $42, $CB, $17, $FE, $AE)
pause 10
writei2c $4F40,("17m 18,260MHz", $62, $42, $CB, $E0, $B9, $11)
pause 10
writei2c $4F80,("17m 18,280MHz", $62, $42, $CC, $A9, $73, $73)
pause 10
writei2c $4FC0,("17m 18,300MHz", $62, $42, $CD, $72, $2D, $D6)
'EEPROM addresses for frequency infos
'which may be stored in segements 05 to 16
'segment 05
'$5000, $5040, $5080, $50C0, $5100, $5140, $5180, $51C0,
'$5200, $5240, $5280, $52C0, $5300, $5340, $5380, $53C0,
'segment 06
'$5400, $5440, $5480, $54C0, $5500, $5540, $5580, $55C0,
'$5600, $5640, $5680, $56C0, $5700, $5740, $5780, $57C0,
'segment 07
'$5800, $5840, $5880, $58C0, $5900, $5940, $5980, $59C0,
'$5A00, $5A40, $5A80, $5AC0, $5B00, $5B40, $5B80, $5BC0,
'segment 08
'$5C00, $5C40, $5C80, $5CC0, $5D00, $5D40, $5D80, $5DC0,
'$5E00, $5E40, $5E80, $5EC0, $5F00, $5F40, $5F80, $5FC0,
'segment 09
'$6000, $6040, $6080, $60C0, $6100, $6140, $6180, $61C0,
'$6200, $6240, $6280, $62C0, $6300, $6340, $6380, $63C0,
'segment 10
'$6400, $6440, $6480, $64C0, $6500, $6540, $6580, $65C0,
'$6600, $6640, $6680, $66C0, $6700, $6740, $6780, $67C0,
'segment 11
'$6800, $6840, $6880, $68C0, $6900, $6940, $6980, $69C0,
'$6A00, $6A40, $6A80, $6AC0, $6B00, $6B40, $6B80, $6BC0,
'segment 12
'$6C00, $6C40, $6C80, $6CC0, $6D00, $6D40, $6D80, $6DC0,
'$6E00, $6E40, $6E80, $6EC0, $6F00, $6F40, $6F80, $6FC0,
'segment 13
'$7000, $7040, $7080, $70C0, $7100, $7140, $7180, $71C0,
'$7200, $7240, $7280, $72C0, $7300, $7340, $7380, $73C0,
'segment 14
'$7400, $7440, $7480, $74C0, $7500, $7540, $7580, $75C0,
'$7600, $7640, $7680, $76C0, $7700, $7740, $7780, $77C0,
'segment 15
'$7800, $7840, $7880, $78C0, $7900, $7940, $7980, $79C0,
'$7A00, $7A40, $7A80, $7AC0, $7B00, $7B40, $7B80, $7BC0,
'segment 16
'$7C00, $7C40, $7C80, $7CC0, $7D00, $7D40, $7D80, $7DC0,
'$7E00, $7E40, $7E80, $7EC0, $7F00, $7F40, $7F80, $7FC0,
pause 200


'program src11.bas
'SoftRock Control
'date 080415
'hardware used:
'uP: Picaxe 28X1
'One linear potentionmeter of 47k is connected to ADC 2 ("segment" select)
'One linear potentionmeter of 47k is connected to ADC 3 ("frequency" select)
'One push-button is connected to IN1 ("set" -- update DCO)
'One push-button and 4k7 resistor is connected to /RST ("up Reset")
'LCD: Picaxe AXE033 v2 (Real Time Clock DS1307 not installed)
'DCO: SI570 chip 570CAC000141DG (CMOS)
'Si570 board by WB6DHW
'EEPROM: Microchip 24LC256 I2C (frequency info [display text + register values for DCO] is
' stored from address $4000 on at increments of
' 64 bytes = 1 page. You may use up to 16 bandsegments
' having up to 16 different frequencies each)
'An intended change of frequency is directly displayed on the LCD but only transfered
'to the DCO after pressing the "SET" button until the "update" message appears.
main: pause 500 'time for initialising the LCD
serout 7,N2400,(254,1) 'clear display, followed by pause 30
pause 30
serout 7,N2400,(254,128,"SoftRock Control") 'output text
serout 7,N2400,(254,192," SRC11 by DF7TV ") 'output text
pause 2000
serout 7,N2400,(254,128,"Select frequency") 'output text
serout 7,N2400,(254,192,"and hold 'SET' ") 'output text
pause 3000
serout 7,N2400,(254,1) 'clear display, followed by pause 30
pause 30
let b20 = 1 'set startup-variable b20

cont: readadc10 2, w8 'read ADC into w8 (= b17:b16) = "SEGMENT"
readadc10 3, w9 'read ADC into w9 (= b19:b18) = "FREQUENCY (within SEGMENT)"
'scale range of w8 from {0,1,2,...,255} into...
'let w8 = w8/16 * 1024 '...{0,1,2,...,14,15}*1024 for a total of 16 segments
'let w8 = w8/32 * 1024 '...{0,1,2,...,,7}*1024 for a total of 8 segments
let w8 = w8/64 * 1024 '...{0,1,2,3}*1024 for a total of 4 segments
'let w8 = w8/128 * 1024 '...{0,1}*1024 for a total of 2 segments
'scale range of w9 from {0,1,2,...,255} into...
let w9 = w9/16 * 64 '...{0,1,2,...,14,15}*64 for a total of
'16 frequencies in each segment
'store the required EEPROM address to read frequency info into w9 (= b19:b18)
let w9 = w9 + w8 + $4000
i2cslave %10100000, i2cfast, i2cword 'set EEPROM slave parameters for 24LC256
pause 10 'read frequency info
readi2c w9,(b0,b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b21,b22,b23,b24,b25,b26)
pause 10 'output text of frequency info
serout 7,N2400,(254,128,b0,b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15)
pause 10
if pin1 = 1 OR b20=1 then st570 'if IN1 is HIGH (button "set" pressed) OR start-up
'variable is set "1" then set SI570 to frequency shown
goto cont 'on LCD --otherwise continue watching for intended frequency

st570: 'set SI570 frequency
i2cslave %10101010,i2cfast,i2cbyte 'initialize I2C for SI570
pause 10
writei2c 137,($10) 'freeze DCO so freq can be modified
pause 10 'wait for write
writei2c 7,(b21, b22, b23, b24, b25, b26) 'write SI570 registers 7-12
pause 10 'wait for write
writei2c 137,($00) 'unfreeze DCO
pause 10
writei2c 135,($40) 'newfreq
pause 10
readi2c 7,(b1,b2,b3,b4,b5,b6) 'read SI570 registers 7-12
pause 10
'check for correct SI570 register content by comparing content of SI570 registers
'and intended values:
if b1=b21 AND b2=b22 AND b3=b23 AND b4=b24 AND b5=b25 AND b6=b26 then
goto ok570 'message showing that SI570 was updated correctly
goto cont 'continue to watch for frequency selection

ok570:serout 7,N2400,(254,192,"* DCO UPDATED *") 'output text
pause 500
serout 7,N2400,(254,192," ") 'clear text
let b20 = 0 'clear start-up variable b20
goto cont