Senin, 05 Maret 2012

There are lots of  FPGA (Field Programmable Gate Arrays) uses in industries where lots of logical blocks are replaced by one FPGA. Secondly they are very expensive compared to our 89c4051 microcontrollers.

Well there is only one simple solution. Make use of microcontroller to make logic blocks as done in FPGA.
Like 3 to 9 decoder, 8bit shift register, etc.

First you need to plan every logic block and write its truth table. Make a formula out of it using karnaugh's map. Simplify the logic formula if possible.

Implement the formula in your software and program the controller.

Here's one example:

//2 to 4 decoder using 89c4051

#include "REGX51.H"
#include "stdio.h"


//create your entity here(pins)


sbit in0 = P3^0; // input 0
sbit in1 = P3^1; // input 1




sbit out0 = P1^0; //output 0
sbit out1 = P1^1; //output 1
sbit out2 = P1^2; //output 2
sbit out3 = P1^3; //output 3

void main( )
{

int input=0;
while(1)
{
  P3=0xff; //set port 3 to high to read inputs.
  input = input | in1;  //or input bit with input variable
  input=input<1;  //shift the input bit to consider 2nd order bit for a number (second last LSB)
  input = input |in0; //or next input bit to consider 1st order bit for a number. (LSB)
  switch(input)
 {
   case 0: out0=1;
           out1=0;
           out2=0;
           out3=0;
            break;
   case 1: out0=0;
           out1=1;
           out2=0;
           out3=0;
            break;
   case 2: out0=0;
           out1=0;
           out2=1;
           out3=0;
            break;
   case 3: out0=0;
           out1=0;
           out2=0;
           out3=1;
            break;
   default:break;
  } //end switch
}  //end while
} //end main


 Try it. You can try various logical blocks and then combine into one block eliminating the use of fpga. Multiple microcontrollers can be used for bigger logic blocks. Some functions are very complex, and has high logical circuits. Those functions seriously needs FPGA's. They do it well at high speed.





0 komentar:

Posting Komentar