Friday, June 29, 2012

Analog-Digital-Converter (ADC) using PIC16F88

Hello Everyone....

We have made a new progress in the RnD Labs today with a new experiment, to learn and to use in our daily electronics conquests.

We successfully completed an Analog - Digital converter using the PIC family micro-controller PIC16F88. The datasheet provided, has a very good explanation of the setup process and I promise you that it will take a good amount of time and patience to read, study, rig-up a circuit, test the circuit, write the program and then debug it and finally you will end up having a working ADC. Well all this because your doing it for the first time and hence I have provided you in this post the code that we have made/coded to get the ADC working. All the details to setup the ADC using 16F88 is below. Keep following.


The datasheet for the PIC16F88 can be found in this link: Click Here

Firstly, let us setup the circuit and test it: Here is the circuit and the JPEG download of the circuit: Click Here.


Some debugging tips for the circuit. Mainly, check the orientation of the 78L05 regulator as here you will be varying the voltage and a wrong orientation will lead to the device to fail. Also, check the potential voltage divider ratio which is why we have used a 100K and a 5K resistance in our experiment.

Now let us come to setting up the ADC and program. Below are the mentioned steps to setup the ADC in the software.

The PIC16F88 as an ADC and an Internal Oscillator which we shall be mainly using the experiment. 16F88's ADC has the following registers to be setup:

 • Analog Select Register (ANSEL) - Bank 1
• A/D Control Register 0 (ADCON0) - Bank 0
• A/D Control Register 1 (ADCON1) - Bank 1

The result of the ADC/digital output is stored in two registers based on the Right or Left justified bit. They are:

• A/D Result High Register (ADRESH) - Bank 0
• A/D Result Low Register (ADRESL) - Bank 1

 These steps should be followed for doing an A/D conversion:
1. Configure the A/D module:
            • Configure analog/digital I/O (ANSEL)
            • Configure voltage reference (ADCON1)
            • Select A/D input channel (ADCON0)
            • Select A/D conversion clock (ADCON0)
            • Turn on A/D module (ADCON0)
2. Wait the required acquisition time.
3. Start conversion:
          • Set GO/DONE bit (ADCON0)
          • Wait the required acquisition time.
4. Wait for A/D conversion to complete, by either:
          • Polling for the GO/DONE bit to be cleared
5. Read A/D Result register pair (ADRESH:ADRESL)
6. For next conversion, go to step 1 or step 2 as required.

The A/D conversion time per bit is defined as TAD. A minimum wait of 2 TAD is required before the next acquisition starts.

Although, if you still feel the above steps are little hard to follow, try to download the source code (ASM) given below which has the comments.

ADC source code : Click Here (ASM)
ADC flash file       : Click Here (HEX)
ADC full Project  :  Click Here (ZIP)





Friday, June 15, 2012

DDS New Feature: PRESET Function

Hello Everyone.

More development on the DDS and we would like to bring you a new feature in the DDS.

Ever had a passing thought that while changing frequencies during some experiments or while scanning the Rx. for stations, you would have always wondered - 'It would be great if there was a shortcut to jump to this frequency'. While that feature is termed or coined to be as Preset.

Voila, we now have a DDS with Preset feature. We have added three Preset frequency, which are set to 4.97MHz, 4.95Mhz and 4.93Mhz. Well, of course, the frequencies can be changed in the program.

Below is the modified circuit of the DDS to accommodate the Preset frequency switches:
Click Here to download the PDF.


 Downloads below:

DDSv4 ASM file: Click Here (ASM)
DDSv4 HEX file: Click Here (HEX)
DDSv4 Complete project file: Click Here (ZIP)
The DDS with Preset function was just a prototype and the PCB does not exist yet. Depending on the demand, the PCB's will be made.Also as usual, suggestions and comments are most welcomed and noted.



Stay tuned for another exciting feature to be added to DDS pretty soon!!!!



Friday, June 8, 2012

DDS Updated:EEPROM Memory- 8th June 2012

Greeting Everyone.....

We have just updated the DDS yet again to keep it alive and not forgotten.

What is change log?

Previously, we had fine tuned the DDS to change with 54Hz frequency and changed the time delay to 0.5 seconds. Now the new DDS update has a new feature where the previously set frequency can be loaded back.

To explain in simple terms, you have set a particular frequency and would like to retain the same frequency when you switch off and back on, well now its possible. Earlier when you switch off the DDS, an initially programmed frequency would be loaded in the AD9833. But now you can have previously set frequency once you switch on the DDS. 

So how did we do it. We used the EEPROM available in the PIC16F628A to write the present frequency and again read the EEPROM to load the frequency. Hence even when the DDS is cut-off from the supply, the frequency will remain in the EEPROM Memory and will be loaded once the power is wupplied back to the DDS.

The program as the subroutines for the EEPROM read and write separately andmore details are provided in the datasheet of the PIC16F628A. The DDS program is available for download in the below links as well as the DOWNLOAD tab.

The DDS program is provide below for use:

Version 3.0 Click Here (ASM) and Click Here (HEX) .

Complete project file Click Here 

Friday, June 1, 2012

DDS Update: New Program with 50Hz tuning

Hello everyone.

We are working on the DDS and have updated the new program for the fine tuning (Slow bit tuning). The program is written for the PIC16F628A with the following features:

  • The slow/fine tuning is adjusted to 54 Hz frequency up and down.
  • The range of the slow/fine tuning is no more limited and can be adjusted to any range of frequency.
  • The delay between the frequency switching is reduced to 0.5sec. Hence faster band scan. 

We have incorporated the DDS board to out JOTA TRx. 40 and have tested it on the air. Smooth transitions between the frequency and on-spot frequency setting.

Dr. Manoj, VU3KER will the first one to take our TRx. equipped with DDS for testing and feedback.

You can find the ASM, HEX and the complete project below for download:

DDS program Version 2.0 : Click Here (ASM) and Click Here (HEX)

Complete project file: Click here