Response of a microcontroller

Discussion in 'Embedded Systems and Microcontrollers' started by Rastapunk, Aug 12, 2013.

  1. Rastapunk

    Thread Starter New Member

    Aug 12, 2013
    3
    0
    Hello friends,

    I got a task to create automatic system in which I will program a microcontroller which will have an encoder on the one side and a digital output on the other. The microcontroller will count the impulses received from the encoder and on a specific number of impulses it will produce a digital "1".

    Since that's pretty easy I typed one porgram in C and one in VHDL, because I don't know what microcontroller I am supposed to use.

    The problem that I actually have is that this program and generally the entire system should be as fast as possible. I figured that I can do that with finding the fastest microcontroller and with optimizing the code.

    I am pretty sure that the speed of a microcontroller is regulated by the MIPS and the frequency of the crystal (tell me if I am wrong) and I know how to determine the processing speed of a code in C.

    Finally, my question is how can I determine the speed of a VHDL code (like the "ping - pong" order in C) and how can I test the response time of the microcontroller with the program already downloaded on it?

    P.S. Is a microcontroller that works with a VHDL code faster than one with a C code? Since VHDL is much lower language and it directly designs the electronic circuit.

    Thanks in advance,
    Rastapunk :)
     
  2. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    Micro controllers don't use VHDL, gate arrays and such do. A gate array is a completely different architecture from a computing processor, and when properly designed should have a definite speed advantage.
     
  3. Rastapunk

    Thread Starter New Member

    Aug 12, 2013
    3
    0
    I guess I mixed things up :D

    Well, I was given a Spartan - 3AN Starter Kit to test my VHDL program on. Thought that it is same as a microcontroller.

    But anyway, is there a way to make the tests I need to do? No matter if it's on a microcontroller, or on a FPGA? (BTW, you are saying that FPGAs are faster than Microcontrollers?)

    P.S. Thanks for the response :)
     
  4. MrChips

    Moderator

    Oct 2, 2009
    12,440
    3,360
    Depends on your definition of "as fast as possible".
    State how fast are your input pulses appearing.
    I am sure the vast majority of Microcontrollers can handle the fastest encoder.
     
  5. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    A microcontroller executes instructions sequentially, where a FPGA, or other PLD, can execute instructions in parallel. This difference alone is enough to state that two designs, one on a microcontroller and the other implemented on a FPGA, with all other specs the same, a FPGA will be much, much faster.

    You can test your setup by changing the input and measuring how long it takes the output to reflect the operation with respect to the input signal.
     
  6. Rastapunk

    Thread Starter New Member

    Aug 12, 2013
    3
    0
    Thanks for the answers guys :)

    As I managed, I will be using a FPGA (Spartan-3AN Starter Kit) and I need to get to speeds in us, so I need to do a response a lot faster than ms and something round us.

    tshuck, I know how to (theoretically) measure the response, but I don't know how to do that in practice. That was actually my question.

    Thanks agaain :)
     
  7. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    ...and how is the way you measure response time different in practice?

    You pass a square wave into the device, and see how long it takes the device to respond at the output at both rising and falling edges. I'd probably do it as a single input, then again with multiple inputs tied to the input..
     
Loading...