Topics

An SNA based on AD9851 AD8307 and any 8051 based u Controller in Assembly

Asadullah Mir
 

Hi All,

I joined the group recently. Last year, I built myself an "SA" based on the AD8307 and AD9851 for use in my shack. Wish I had known that PHSNA exists.




I am not too familiar with C nor with the "duino" and such  boards.  I wrote my own software because I could not ride up the learning curve enough to use any pre-written C based, software.




The device works very well. And since I wrote it myself I have been playing around with it and changing it at whim. Many versions exist.

 

I want to know if there might be some interest in this project. 

 

The software ( all assembly language ) works with any 8051 processor. I have used it with AT89C51-AC3/ED2/RE2, with ADUC842 as well as the very fast SiLabs F120 and F020 controllers. Minor changes to port definitions and clock config ( and WDT in F120/020 ) is all that is needed. 

 

A 320 by 240 color LCD ( serial data stream ) works as the SA display and I can show the frequency response for almost any arbitrary sweep width from 200 Hz up to 80 MHz at any sweep rate.



An auxiliary 20 x 4 Char LCD is used in the user interface to display max min and center frequency etc.

I have versions which work with 8 bit , 4 bit  or with and I2C I/F.( Using the  PCF8574 )



Frequency, span, rate etc. are controlled by two rotary encoders and one solitary PB to select between fixed frequency and sweep modes.



The design is stand alone and can be put in a box and used in the field, which is what I have used it for.

 

I will be happy to upload all the info up here if there is sufficient interest. I am ready also to explain the working   and help with any aspect of the project as far as I can and can make detailed drawings available if asked for. The code itself is well annotated.



This plan is suitable for some one who is familiar with electronics HW and SW  and can modify the design/layout or SW if he needs to or at least be able to understand technical communications. I would not call it a prepackaged project. It is certainly not for a novice. 

 

I have attached three pics of a working version which I mounted in a shoe box.

1.  A view of the character LCD in the sweep mode which shows the max mid and min frequencies of the sweep mod, the width of the sweep and the rate.

2.  A view of the SNA driving a very simple jury rigged LC BP filter at about 1300 kHz and,

3. A view of the display.  The blue line is the amplitude of the signal going out from the device and the red line is the response of the  filter. Graticule  marks are at 10 dB. Uncalibrated.


N5IB
 

You are most welcome to post information about your project here.

Just create a folder in the Files area and upload documents and photos there. You can also create an Album in the Photos area if you'd prefer to separate pictures from documents.

73,
Jim, N5IB



Gary Winblad
 

HI Mirasad(?),
Welcome to the group, I for one have learned a lot here!

I would be interested in hearing more about your project.  I'ts too bad you didn't hear about
PHSNA before you did it, you could have saved a lot of work.  I was able to take Nick's
Arduino code and add a 20x4 LCD and an encoder to make my PHSNA just like I wanted
it.  It was really easy and an enjoyable project.

I would encourage you to buy an Arduino.  It is an ideal solution for projects like this.
Imagine, a complete controller for (about) $2 (ebay, China).   No programmer needed,
just a USB connection to any modern computer, and your project like PHSNA talks
to your computer over that USB too.

Though I have used C for 20+
years, I couldn't sit down and write a complex program in it.  You just take existing code
and hack and modify it.  Try it!  With Arduino, there are cheap "peripherals" (like LCDs,
encoders, AD9851s) cheap on ebay and the C code to run them is all over the internet.
I just started with Arduino less than a year ago, wish I would have started sooner.

What I would like to see is you adding your graphic display to the PHSNA, wow that
would be cool..  I would build that.  If your project was PIC assembly code I would be
interested, but 8051 is not something I have time to work on now.  That's the way with
assembly code...

Thanks for sharing, hope to hear more,
73
Gary
WB6OGD

Asadullah Mir
 

Thanks Jim,

I will do  that as soon as I can edit all the stuff.

Azzythehillbilly

Asadullah Mir
 

Thanks Gary,

It's Ok. It is not a lot of work for me. I pulled most of the  the routines from  my personal library, written over the last ten years. the custom routines took no more than 10 15 hours of writing & debugging. I make a living writing SW for Embedded systems. The last of my jobs flies at over 6K meters above MSL.

Have tried but just can not get along with C. I have tried learning to use the beagleBone and the Cubie but just cannot get along ( can't understand zip ). Besides I can zip out Assy code faster than it takes to say "zip" I know it is ridiculed by most "writers" of C but that is the way I am.

Which controller on the Arduino board? I have started writing ( forced to, actually ) Assemby for the Thumb. Is Arduino based on the Thumb core?

I did not understand what you meant by wanting to see me add the graphic display to the PHSNA?


William Kimber
 


I'll join the incomprehensibility of C & C++ it seems to me that they and more particularly C++ to break many of the rules I was taught in the early days. I won't say how long ago that was.  

I liked assembly on RCA 1802.

Cheers,
Will


On 13/11/15 06:37, mirasad314@... [PHSNA] wrote:
 

Thanks Gary,


It's Ok. It is not a lot of work for me. I pulled most of the  the routines from  my personal library, written over the last ten years. the custom routines took no more than 10 15 hours of writing & debugging. I make a living writing SW for Embedded systems. The last of my jobs flies at over 6K meters above MSL.

Have tried but just can not get along with C. I have tried learning to use the beagleBone and the Cubie but just cannot get along ( can't understand zip ). Besides I can zip out Assy code faster than it takes to say "zip" I know it is ridiculed by most "writers" of C but that is the way I am.

Which controller on the Arduino board? I have started writing ( forced to, actually ) Assemby for the Thumb. Is Arduino based on the Thumb core?

I did not understand what you meant by wanting to see me add the graphic display to the PHSNA?



George N2APB
 

Hi,

 

Nice work.  Would love to see the details of your SA.  Have coded many years on the 8051 processor, exclusively in assembly language, and still enjoy it very much.

 

Sounds like you might now have heard of the project extension that took the PHSNA to the next level.  Check out the SNA Kit at http://midnightdesignsolutions.com/sna/ and on the NAT-SNA group on Yahoo.

 

73, George N2APB

 

 

From: PHSNA@... [mailto:PHSNA@...]
Sent: Thursday, November 12, 2015 12:37 PM
To: PHSNA@...
Subject: [PHSNA] Re: An SNA based on AD9851 AD8307 and any 8051 based u Controller in Assembly

 

 

Thanks Gary,

 

It's Ok. It is not a lot of work for me. I pulled most of the  the routines from  my personal library, written over the last ten years. the custom routines took no more than 10 15 hours of writing & debugging. I make a living writing SW for Embedded systems. The last of my jobs flies at over 6K meters above MSL.

 

Have tried but just can not get along with C. I have tried learning to use the beagleBone and the Cubie but just cannot get along ( can't understand zip ). Besides I can zip out Assy code faster than it takes to say "zip" I know it is ridiculed by most "writers" of C but that is the way I am.

 

Which controller on the Arduino board? I have started writing ( forced to, actually ) Assemby for the Thumb. Is Arduino based on the Thumb core?

 

I did not understand what you meant by wanting to see me add the graphic display to the PHSNA?

 

 

Asadullah Mir
 

Hi George !

The SNA kit is a real wow. Very nice work indeed.

Why did you not use rotary encoders to set frequency, span rate, etc? KB'ds are so slow.
What drove the choice to dsPic33F?

It is funny but long ago I came across the PIC controller when it was a baby. The hardware stack turned me off completely ( I was already familiar with the TI TMS9900  and had written some software for a company in Aurora, Ohio)  and I never returned to it. I suppose the new parts have the usual normal stacks.
 
On my NA when the display is turned of the device puts out  a ramp and/or a trigger pulse. The max rate of the sweep can then go up to near about 20 - 47 sweeps per second ( not sure ). Fair enough to use with XY or trig'd display.

ad7jt@...
 

Hi,

Your SNA looks very good, you did a great job.  I found our SNA project to be a great learning exercise and I bet you did too.  I did the NAT/SNA firmware (which is still evolving).  I was firs attracted to the Microchip PIC and dsPIC micro controllers by the breadth of the product line, the amount and quality of documentation, and the MPLAB IDE which is Eclipse-based and I have had a fair amount of experience with Eclipse.

Let me answer a couple of your questions.

The keyboard is optional, the touch screen can do about anything the keyboard can do except input alpha characters.  There is a numeric keypad that can be displayed to enter numeric data and do some editing.  It can also be used to append numeric suffixes to "create" new file names from names previously entered from a keyboard.  I could not see any real advantage to adding the cost and complexity of a rotary encoder.  If the need arose, we could provide a "virtual" rotary encoder using the display and touch screen.

Things like frequency span and frequency step/number of steps are generally controlled by macros which are defined by simple forms you fill in and then save in EEPROM (up to 14 macros).  To do a frequency scan and log and/or plot the results, you just call up a macro.  This approach is especially convenient for sweeps that are repeated often like checking the health of your antenna and sorting crystals.

I'm not sure what you mean by the "hardware stack" that turned you off.  Are you referring to the stack mechanism built into the dsPIC controller hardware?  The dsPIC in the NAT and SNA is programmed primarily in C with a couple "inner loops" programmed in assembly language.  The only direct access to the hardware stack is to match the compiler subroutine linkage conventions for assembly language routines and for fault reporting (which I hope I am the only one that ever sees that usage).

Our SNA typically can do about 4 sweeps per second limited by the number of steps and the response time of the DDS and the RF Power meter.  The sweep is completed and the data recorded before doing the plot.  The data buffer can hold up to 920 data points but data from much longer sweeps can be captured and saved to files on the SD card.


73,
Dave Collins - AD7JT



Asadullah Mir
 

Hi Dave,
I just checked out the details of the ‘Midnight SNA” . Excellent product. The menu and storage functions are fantastic.  I write native code and can say honestly that this is the most tedious part of writing code
.
It really would be worthwhile investment. Since I am a retired I need to husband my resources but I will plunk down some cash if and when I can and get the whole kit and caboodle
.
The reason I built this Sweep Gen of mine was  1. I have a 494P but no tracking gen. Needing to try a RL test on my antenna I decided to build a quick  solution and ended up with this. It resides in a shoe box.  2. I had two pieces of theAD 9851 boards and was curious what use I could put them to.
 
I think I am obsessed with  rotary encoders and have over 35 in my junk boxes.  Another reason, I have a receiver which I use for listening to the hams which has digital tuning and no rotary knob like old times and I sorely miss that.
 
The hardware stack.  Long ago around 1985 I was asked by a customer ( Johnson & Phillips)  to modify the software in a VCB tester for some new test routines. It used a controller  a picxxx ( don’t remember the full number) I got hold of some manuals and looked at the instruction set and the architecture. Apparently the stack was a separate part of memory in HW that could not be relocated and had a depth of only seven call nesting. Besides that lacking Boolean operations on bits and the clumsy branch instructions were frustrating. I replaced the entire controller with a Z80 based, (home brew), board and wrote the new code.

My Sweep Gen/SNA has a rather limited sweep in that only 256 step sweeps are allowed. I did not provide for more or fewer sweep steps as 256 steps was extremely easy to implement. The total span of the sweep is variable in about 47 choices  from 200 Hz to 90 MHz. ( 90M  would mean center frequency of  say 54M and + - 45M the software allows frequencies from zero to 99,999,999 Hz but disallows wrong settings.
.
Today I changed the software  so that receive and send level are also displayed in the static frequency mode.  Also deleted some routines which were never called. 
 
I am not sure what notes, pics, etc. SW I should upload to the PHSNA page. Please give me some advice. What can/should I upload?
 
The circuit of the crystal test jig. Will it work sans the two transformers?
If not,  why?

ad7jt@...
 

Hi again,

(You need to sign your postings so we can know your name. ;-)

Your PIC experience was probably with a PIC16F688 which has been very popular since it was first introduced and is probably still is a good seller.  It cost about $1 in quantity.  I've done some 8-bit PIC programming and found it very interesting (like a Chinese puzzle!).  It is really a RISC architecture with a strange RAM organization and, like you noticed, a limited hardware stack mechanism.  The reason the stack is not directly addressable or relocatable is because it uses a Harvard architecture with different sized data and instructions.  The number after "PIC" in the device number is the number of bits in the instruction word.

You would have been much happier with a 16-bit device which would seem to be more familiar to you.  It is still a Harvard Architecture and the HW stack is not relocatable or directly addressable.  I do most of my coding in C so I don't really care about the HW stack, I can get at the SW stack and let the compiler worry about the HW stack.

As to your question about what to upload to show your project, Jim N5IB is in charge of the group so he's the one to ask.  I think most people would like to see pictures of the finished project and screen shots something like you posted as an attachment and an overall schematic.  Maybe add some close-ups of some of the modules, I am always interested in construction techniques.

Here's a reference for the K8IQY crystal test fixture ours is modeled after (scroll down to near the end of this article).  I have also attached a copy of Nick Kennedy's (WA5BDU) excellent slide show on the subject.  Slide 9 explains why the transformers are there and slide 11 shows and describes a test fixture without them.  I've used both of them.


73,
Dave Collins - AD7JT




Asadullah Mir
 

Hi,
Thank you Dave for the PDF. Cleared up some misconceptions. Why do I never find them on my own on Google.

Considering that I want to upload my project, I have been looking at it a bit more carefully. Some laconic software was rewritten/re-commented. I have added a display of the transmitted and received signal levels on the static frequency mode display and a fast screen clear. Also altered the graphic display to range from +20dBm to -60dBm No need for -80dBm as the stray signals on my board make anything below -60dBm rather useless. With an 18.432 xtal sys clk and 6 clks per instruction cycle on AT89C51RE2,  I get one plot every 5 second. Other processors can do a whole lot faster.

I don't ever make schematics of my projects. The reason,  I make PCBs for every thing I build (laser ptr and teflon ppr ) and the circuit can be seen in the PCB layout. For this one I will make an exception and make the schematics.  I presume that everyone has access to "Express PCB" so will make it in the same.

It appears to me, seeingthe display graphs  (PHSNA) that every measurement point is plotted as a single point. This makes the graphs a bit ragged when the amplitude response is changing rapidly.And that is what I have too, on mine.

I was wondering if the graphs should be changed so that a continuous line is plotted between every two consecutive plot points. Do you think this is worth the trouble? The lines would be vertical half on one and the other half on the next column.  In my case all columns are plotted. so consecutive points are always on adjacent columns. 

73

mirasad

(was AP2AM once now waiting for new CS)

AKA Azzythehillbilly

Nick Kennedy
 



On Mon, Nov 23, 2015 at 11:05 AM, mirasad314@... [PHSNA] <PHSNA@...> wrote:
 



I don't ever make schematics of my projects. The reason,  I make PCBs for every thing I build (laser ptr and teflon ppr ) and the circuit can be seen in the PCB layout. For this one I will make an exception and make the schematics.  I presume that everyone has access to "Express PCB" so will make it in the same.

Lately I've been making schematics of things I'm doing boards for if it's for a new design I'm working on.  It seems to enforce another "design review" phase -- while I'm doing the schematic, problems and/or errors sometimes jump out at me.  Sometimes I've done the schematic twice: once in LTspice and again in ExpressSCH.  But not so much on already proven designs.

 

It appears to me, seeingthe display graphs  (PHSNA) that every measurement point is plotted as a single point. This makes the graphs a bit ragged when the amplitude response is changing rapidly.And that is what I have too, on mine.

I looked at some of my PHSNA plots and don't see any jaggies.  Maybe you're doing something different??

73

mirasad

(was AP2AM once now waiting for new CS)

AKA Azzythehillbilly


73-

Nick, WA5BDU