help with input capture (68HC11)

Discussion in 'Embedded Systems and Microcontrollers' started by factorial555, Apr 18, 2009.

  1. factorial555

    Thread Starter New Member

    Apr 18, 2009
    4
    0
    I'm trying to show an input capture on the terminal screen when I use a frequency generator. It's not showing and I don't know why. Here's the code:

    #include <hc11.h>
    #include <stdio.h>
    main()
    {
    unsigned int edge1, frequency;

    while(1)
    {
    TFLG1 = 0x04;
    TCTL2 = 0x10;
    while(!(TFLG1 & 0x04));
    edge1 = TIC1;
    TFLG1 = 0x04;
    while(!(TFLG1 & 0x04));
    frequency = (1 /(TIC1 - edge1));
    printf("\nThe frequency of the signal is %u E clock cycles. \n",frequency);
    }
    return 0;
    }
     
  2. factorial555

    Thread Starter New Member

    Apr 18, 2009
    4
    0
    I forgot to mention that the goal is to use an encoder to detect the speed I'm turning it.
     
  3. factorial555

    Thread Starter New Member

    Apr 18, 2009
    4
    0
    Never mind. I found out what was wrong with it.
     
Loading...