The other main change was in what I was going to use as a user interface device to control the operation. On the SNA Jr and other projects I used a rotary encoder with a built in push-button. This worked quite well, but the software got to be fairly complicated as more functionality was added to the software. I thought about push-buttons, but they would take up a lot of panel space. And from using several other devices with push-buttons I really didn't think that was what I wanted. I had a couple of the small joy stick controller boards that I picked up for something else, and thought I would give them a try. I wired one up on a breadboard, and tried several different methods until I came up with one I liked. A ReadJoystick function reads the Horizontal and Vertical axis position, and if it is more than 20% from center updates a global variable for that axis to either + or - 1 depending on direction. This joystick also has a push-button, so I detect either a short or long push, and update another variable with that value. To make processing these variables a little easier, I only allow one to be changed at a time. If any of these occurs a global flag is set. This global flag allows the flag to be reset in the program to speed up processing by bypassing further testing in that pass through the loop.
I did a quick board layout and etched a board to test the functionality. Since all the pins used by the display except reset are through the end connector on the Mega board, I have all the other pins available. This makes the board a lot easier, because I can just use a tall stacking connector and not have to do anything on the interface board for the display except bring out a couple of pins for the reset line. I also included several places on the board for push buttons that I might use for more advanced features later on. And also brought out a couple sets of I/O pins for control of the RF boards.
I took some of the code from the SNA Jr. and modified it for use with the new board, display and Joystick.
It was quite a bit simpler, and worked very well. I think the Joystick will work nicely in the Spectrum Analyzer. I really like the larger, higher resolution display. With it having a parallel interface instead of SPI the response is nearly as fast as the small display in the SNA Jr. It has already got me thinking about a SNA Jr version III.With the power detector and clock generator on the same board, I can modify more of the code from the SNA Jr. and have a stand alone version of the Sweeperino for testing some of the RF filters in the Spectrum Analyzer. Then after I finish the RF circuitry, I can just connect it to the interface board and change the software to make it a Spectrum Analyzer.

No comments:
Post a Comment