目前共有19篇帖子。 内容转换:不转换▼
 
点击 回复
833 18
【实验】使用定时器的外部时钟模式对多谐振荡器的性能进行评估
一派护法 十九级
1楼 发表于:2017-4-2 11:59
【实验时用到的程序】
#include <stm32f10x.h>

const uint8_t seg8[] = {0xc0, 0xf9, 0xa4, 0xb0, 0x99, 0x92, 0x82, 0xf8, 0x80, 0x90};

void delay(void)
{
    uint16_t i;
    for (i = 0; i < 20000; i++);
}

void ser_in(uint8_t data)
{
    uint8_t i;
    for (i = 0; i < 8; i++)
    {
        GPIO_ResetBits(GPIOB, GPIO_Pin_9); // SCLK=>PB9
        if (data & 0x80)
            GPIO_SetBits(GPIOB, GPIO_Pin_7); // DIO=>PB7
        else
            GPIO_ResetBits(GPIOB, GPIO_Pin_7);
        data <<= 1;
        GPIO_SetBits(GPIOB, GPIO_Pin_9);
    }
}

void par_out(void)
{
    GPIO_ResetBits(GPIOB, GPIO_Pin_8); // RCLK=>PB8
    GPIO_SetBits(GPIOB, GPIO_Pin_8);
}

void seg_scan(void)
{
    uint8_t numbuf = TIM_GetCounter(TIM2);
    uint8_t i;
    for (i = 0; i < 2; i++) // 只显示两位数字
    {
        ser_in(seg8[numbuf % 10]);
        ser_in(1 << i);
        par_out();
        delay();
        numbuf /= 10;
    }
}

int main(void)
{
    GPIO_InitTypeDef gpio;
    TIM_ICInitTypeDef timic;
    TIM_TimeBaseInitTypeDef tim;
   
    RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);
    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB, ENABLE);
   
    // 时钟输入引脚配置
    gpio.GPIO_Mode = GPIO_Mode_IN_FLOATING;
    gpio.GPIO_Pin = GPIO_Pin_0;
    GPIO_Init(GPIOA, &gpio);
   
    // 数码管扫描管脚配置
    gpio.GPIO_Mode = GPIO_Mode_Out_PP;
    gpio.GPIO_Pin = GPIO_Pin_7 | GPIO_Pin_8 | GPIO_Pin_9;
    gpio.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_Init(GPIOB, &gpio);
   
    // 配置定时器的计数范围
    TIM_TimeBaseStructInit(&tim);
    tim.TIM_CounterMode = TIM_CounterMode_Down; // 向下计数
    tim.TIM_Period = 99; // 最大计数值
    tim.TIM_Prescaler = 0; // 不分频
    TIM_TimeBaseInit(TIM2, &tim);
   
    // 配置定时器2的通道1
    timic.TIM_Channel = TIM_Channel_1;
    timic.TIM_ICFilter = 0; // 不消抖
    timic.TIM_ICPolarity = TIM_ICPolarity_Rising; // 上升沿触发 (注意: 不能设为TIM_ICPolarity_BothEdge, 根本就没有双边沿检测功能)
    //timic.TIM_ICPrescaler = TIM_ICPSC_DIV1; // 这个选项在外部时钟模式中无效(输入捕获模式才会用到)
    timic.TIM_ICSelection = TIM_ICSelection_DirectTI; // TI1->IC1=PA0
    TIM_ICInit(TIM2, &timic);
   
    // 外部时钟模式1
    TIM_SelectInputTrigger(TIM2, TIM_TS_TI1FP1); // TRGI=TI1
    TIM_SelectSlaveMode(TIM2, TIM_SlaveMode_External1); // 把时钟信号设为TRGI
    TIM_Cmd(TIM2, ENABLE);
   
    while (1)
        seg_scan();
}
一派护法 十九级
2楼 发表于:2017-4-2 12:55
【多谐振荡器的电路配置】
充电端接200Ω电阻和一个LED灯(电阻的大小决定输出端上升沿的跳变时间)。
放电端接100kΩ电阻(电阻大小决定输出端脉冲的宽度)。
这里要注意的是,放电电阻不可以接的太大(如200kΩ),否则三极管会处于放大状态,不仅使输出的低电平电压升高(如升高到2V甚至更高,单片机端将无法正确地检测出输出电平),而且很可能使整个多谐振荡器不能正常工作,甚至无法起振。
电容器为10μF。电容器靠近LED的那一端为正极,接三极管基极的那一端为负极。

当右输出端接地时,两个LED灯都亮,用万用表测得左输出端(三极管的集电极)的电压为0.97V(输出的低电平电压)。这表明三极管导通时处于放大状态,不过这并没有什么影响。
现在悬空右输出端,将左输出端接到单片机的PA0口上(定时器2的输入通道1)。

当左LED灯熄灭时,左电容器通过充电小电阻快速充电,输出端迅速从低电平(0.97V)升高到高电平(用万用表测出来大约是3.4V,理论上是4.3V),并保持在高电平,直到右电容器放电完毕。
充电时间 = - 充电电阻大小 x 电容大小 x ln[(E - 末电压) / (E - 初电压)]
其中E为最大充电电压,由于充电时电容器和充电电阻并联在放电电阻两端,而放电电阻又和右三极管的发射结是串联的,发射结的导通电压是0.7V,因此实际上电容器最大只能充到E=5V-0.7V=4.3V
因此上升沿时间 = - 200 * 10 * 10^-6 * ln[(4.3-4.29) / (4.3-(-0.7))] (初电压是-0.7V,因为放电完毕时电容器被反向充电到了0.7V,现在充电前必须先释放掉这部分电压)
≈ 12.43ms

当左LED灯亮起时,由于左三极管导通,左电容器的正极外接电压<负极外接电压,而正极内部电压>负极内部电压(因为之前已经充好电了),所以此时电源对该电容器进行反向充电(也就是放电),先从4.3V放到0V,再充到0.7V使右三极管导通,可以看作是从-4.3V充电到0.7V。这段时间左输出端的电压一直为0.97V,输出低电平。右三极管的基极电压从负压(-4.3V)变到正压(0.7V)。
持续的时间 = - 放电电阻大小 x 电容大小 x ln[(E - 末电压) / (E - 初电压)]
= - 100 * 10^3 * 10 * 10^-6 * ln[(E - (+0.7))/(E - (-4.3))] (E=5V)
≈ 0.77s
(计算时假定的是三极管是饱和导通。因为现在三极管是处于放大状态,所以实际时间比这个时间要短。)

因此,左输出端的上升沿出现在左LED灯熄灭的瞬间(电容器充电的速度非常快),程序中的定时器2就是对上升沿进行计数。
一派护法 十九级
3楼 发表于:2017-4-2 13:01
编译并下载单片机程序,实验发现,虽然在程序中没有开通道1的消抖功能,并且GPIO配置的是浮空输入,但数码管的数字显示很稳定,仅当左LED灯熄灭时才减1(向下计数)。
把左LED灯短路,计时速度明显加快,并且数码管有时减2有时减1,振荡变得不稳定。
如果把两个LED灯都短路,则数码管每次减去的数毫无规律,抖动非常厉害。
一派护法 十九级
4楼 发表于:2017-4-2 13:05

以下是多谐振荡器的电路图。

本实验把充电电阻R1和R4的阻值大小改成了200Ω,同时串联了LED灯。

一派护法 十九级
6楼 发表于:2017-4-2 13:07
在本次实验中,Q1、Q2采用的三极管型号是9013NPN型。
一派护法 十九级
7楼 发表于:2017-4-2 13:13
库函数中有一个TIxExternalClockConfig函数可以更简单地设置外部时钟模式1:
TIM_TIxExternalClockConfig(TIM2, TIM_TIxExternalCLK1Source_TI1, TIM_ICPolarity_Rising, 0);
【示例程序】
int main(void)
{
    GPIO_InitTypeDef gpio;
    TIM_TimeBaseInitTypeDef tim;
   
    RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);
    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB, ENABLE);
   
    // 时钟输入引脚配置
    gpio.GPIO_Mode = GPIO_Mode_IN_FLOATING;
    gpio.GPIO_Pin = GPIO_Pin_0;
    GPIO_Init(GPIOA, &gpio);
   
    // 数码管扫描管脚配置
    gpio.GPIO_Mode = GPIO_Mode_Out_PP;
    gpio.GPIO_Pin = GPIO_Pin_7 | GPIO_Pin_8 | GPIO_Pin_9;
    gpio.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_Init(GPIOB, &gpio);
   
    // 配置定时器的计数范围
    TIM_TimeBaseStructInit(&tim);
    tim.TIM_CounterMode = TIM_CounterMode_Down; // 向下计数
    tim.TIM_Period = 99; // 最大计数值
    tim.TIM_Prescaler = 0; // 不分频
    TIM_TimeBaseInit(TIM2, &tim);
   
    // 外部时钟模式1
    TIM_TIxExternalClockConfig(TIM2, TIM_TIxExternalCLK1Source_TI1, TIM_ICPolarity_Rising, 0);
    TIM_Cmd(TIM2, ENABLE);
   
    while (1)
        seg_scan();
}
一派护法 十九级
8楼 发表于:2017-4-2 13:24
TIM_ETRClockMode1Config(TIM2, TIM_ExtTRGPSC_OFF, TIM_ExtTRGPolarity_NonInverted, 0);
这个函数也是配置的是模式1,但是使用的引脚却是ETR引脚,即TRGI=ETR。
而之前的TIM_TIxExternalClockConfig函数使用的是TI1引脚,即TRGI=TI1FP1。
定时器2的ETR引脚和TI1引脚都是PA0,但对于定时器1来说两个引脚是分开的。
一派护法 十九级
9楼 发表于:2017-4-2 13:26
// 外部时钟模式2
// 使用ETR (External Trigger)引脚作为外部时钟信号
TIM_ETRClockMode2Config(TIM2, TIM_ExtTRGPSC_OFF, TIM_ExtTRGPolarity_NonInverted, 0);
TIM_Cmd(TIM2, ENABLE);
一派护法 十九级
10楼 发表于:2017-4-2 14:16
现在多谐振荡器又出现了不稳定情况:有时候数码管减的数字是2
一派护法 十九级
11楼 发表于:2017-4-2 14:39
【实验2:使用STM32的PWM输入模式测量多谐振荡器的脉冲宽度】
#include <stm32f10x.h>

const uint8_t seg8[] = {0xc0, 0xf9, 0xa4, 0xb0, 0x99, 0x92, 0x82, 0xf8, 0x80, 0x90};

void delay(void)
{
    uint16_t i;
    for (i = 0; i < 20000; i++);
}

void ser_in(uint8_t data)
{
    uint8_t i;
    for (i = 0; i < 8; i++)
    {
        GPIO_ResetBits(GPIOB, GPIO_Pin_9); // SCLK=>PB9
        if (data & 0x80)
            GPIO_SetBits(GPIOB, GPIO_Pin_7); // DIO=>PB7
        else
            GPIO_ResetBits(GPIOB, GPIO_Pin_7);
        data <<= 1;
        GPIO_SetBits(GPIOB, GPIO_Pin_9);
    }
}

void par_out(void)
{
    GPIO_ResetBits(GPIOB, GPIO_Pin_8); // RCLK=>PB8
    GPIO_SetBits(GPIOB, GPIO_Pin_8);
}

void seg_scan(void)
{
    uint16_t numbuf;
    uint8_t i;
    if (GPIO_ReadInputDataBit(GPIOC, GPIO_Pin_1) == SET)
        numbuf = TIM_GetCapture1(TIM2); // 按键松开时显示上次脉冲的总长度(单位: 秒)
    else
        numbuf = TIM_GetCapture2(TIM2); // 按键按下时显示高电平的长度(单位: 秒)
    for (i = 0; i < 5; i++)
    {
        if (i == 4)
            ser_in(seg8[numbuf % 10] & 0x7f); // 显示小数点
        else
            ser_in(seg8[numbuf % 10]);
        ser_in(1 << i);
        par_out();
        delay();
        numbuf /= 10;
    }
}

int main(void)
{
    GPIO_InitTypeDef gpio;
    TIM_ICInitTypeDef timic;
    TIM_TimeBaseInitTypeDef tim;
   
    RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);
    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOC, ENABLE);
   
    // 时钟输入引脚配置
    gpio.GPIO_Mode = GPIO_Mode_IN_FLOATING;
    gpio.GPIO_Pin = GPIO_Pin_0;
    GPIO_Init(GPIOA, &gpio);
   
    // 数码管扫描管脚配置
    gpio.GPIO_Mode = GPIO_Mode_Out_PP;
    gpio.GPIO_Pin = GPIO_Pin_7 | GPIO_Pin_8 | GPIO_Pin_9;
    gpio.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_Init(GPIOB, &gpio);
   
    // 按键管脚PC1配置
    gpio.GPIO_Mode = GPIO_Mode_IPU;
    gpio.GPIO_Pin = GPIO_Pin_1;
    GPIO_Init(GPIOC, &gpio);
   
    // 配置定时器的计数范围
    TIM_TimeBaseStructInit(&tim);
    tim.TIM_CounterMode = TIM_CounterMode_Up;
    tim.TIM_Period = 0xffff; // 最大计数值
    tim.TIM_Prescaler = 7199; // 7200分频, 得到基准时钟0.1ms
    TIM_TimeBaseInit(TIM2, &tim);
   
    // 配置定时器2的通道1
    timic.TIM_Channel = TIM_Channel_1;
    timic.TIM_ICFilter = 0; // 不消抖
    timic.TIM_ICPolarity = TIM_ICPolarity_Rising; // 通道1捕获上升沿
    timic.TIM_ICPrescaler = TIM_ICPSC_DIV1;
    timic.TIM_ICSelection = TIM_ICSelection_DirectTI; // TI1->IC1=PA0
    TIM_ICInit(TIM2, &timic);
   
    // 配置定时器2的通道2
    timic.TIM_Channel = TIM_Channel_2;
    timic.TIM_ICFilter = 0;
    timic.TIM_ICPolarity = TIM_ICPolarity_Falling; // 通道2捕获下降沿
    timic.TIM_ICPrescaler = TIM_ICPSC_DIV1;
    timic.TIM_ICSelection = TIM_ICSelection_IndirectTI; // TI2->IC1=PA0
    TIM_ICInit(TIM2, &timic);
   
    TIM_SelectInputTrigger(TIM2, TIM_TS_TI1FP1); // TRGI=TI1
    TIM_SelectSlaveMode(TIM2, TIM_SlaveMode_Reset); // 上升沿使定时器归0
    TIM_Cmd(TIM2, ENABLE);
   
    while (1)
        seg_scan();
}
一派护法 十九级
12楼 发表于:2017-4-2 14:42
几次脉冲总长度(=高电平时间+低电平时间)数据:
0.7611s
0.7593s
0.7583s
0.7596s
0.7590s
0.7595s
0.7586s
几次高电平长度数据:
0.3602s
0.3575s
0.3593s
0.3594s
0.3582s
一派护法 十九级
13楼 发表于:2017-4-2 15:37
【将测量结果通过串口发送到电脑上,方便复制】
#include <stm32f10x.h>
#include <string.h>

const uint8_t seg8[] = {0xc0, 0xf9, 0xa4, 0xb0, 0x99, 0x92, 0x82, 0xf8, 0x80, 0x90};
char str[] = "Total: x.xxxxs  High Level: x.xxxxs\r\n";

void delay(void)
{
    uint16_t i;
    for (i = 0; i < 20000; i++);
}

void ser_in(uint8_t data)
{
    uint8_t i;
    for (i = 0; i < 8; i++)
    {
        GPIO_ResetBits(GPIOB, GPIO_Pin_9); // SCLK=>PB9
        if (data & 0x80)
            GPIO_SetBits(GPIOB, GPIO_Pin_7); // DIO=>PB7
        else
            GPIO_ResetBits(GPIOB, GPIO_Pin_7);
        data <<= 1;
        GPIO_SetBits(GPIOB, GPIO_Pin_9);
    }
}

void par_out(void)
{
    GPIO_ResetBits(GPIOB, GPIO_Pin_8); // RCLK=>PB8
    GPIO_SetBits(GPIOB, GPIO_Pin_8);
}

void seg_scan(void)
{
    uint16_t numbuf;
    uint8_t i;
    if (GPIO_ReadInputDataBit(GPIOC, GPIO_Pin_1) == SET)
        numbuf = TIM_GetCapture1(TIM2); // 按键松开时显示上次脉冲的总长度(单位: 秒)
    else
        numbuf = TIM_GetCapture2(TIM2); // 按键按下时显示高电平的长度(单位: 秒)
    for (i = 0; i < 5; i++)
    {
        __disable_irq();
        if (i == 4)
            ser_in(seg8[numbuf % 10] & 0x7f); // 显示小数点
        else
            ser_in(seg8[numbuf % 10]);
        ser_in(1 << i);
        par_out();
        __enable_irq();
        delay();
        numbuf /= 10;
    }
}

int main(void)
{
    DMA_InitTypeDef dma;
    GPIO_InitTypeDef gpio;
    NVIC_InitTypeDef nvic;
    TIM_ICInitTypeDef timic;
    TIM_TimeBaseInitTypeDef tim;
    USART_InitTypeDef usart;
   
    RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1, ENABLE);
    RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);
    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOC | RCC_APB2Periph_USART1, ENABLE);
   
    // 时钟输入引脚和串口接收引脚配置
    gpio.GPIO_Mode = GPIO_Mode_IN_FLOATING;
    gpio.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_10;
    GPIO_Init(GPIOA, &gpio);
   
    // 串口发送引脚配置
    gpio.GPIO_Mode = GPIO_Mode_AF_PP;
    gpio.GPIO_Pin = GPIO_Pin_9;
    gpio.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_Init(GPIOA, &gpio);
   
    // 数码管扫描管脚配置
    gpio.GPIO_Mode = GPIO_Mode_Out_PP;
    gpio.GPIO_Pin = GPIO_Pin_7 | GPIO_Pin_8 | GPIO_Pin_9;
    gpio.GPIO_Speed = GPIO_Speed_50MHz;
    GPIO_Init(GPIOB, &gpio);
   
    // 按键管脚PC1配置
    gpio.GPIO_Mode = GPIO_Mode_IPU;
    gpio.GPIO_Pin = GPIO_Pin_1;
    GPIO_Init(GPIOC, &gpio);
   
    // 配置定时器的计数范围
    TIM_TimeBaseStructInit(&tim);
    tim.TIM_CounterMode = TIM_CounterMode_Up;
    tim.TIM_Period = 0xffff; // 最大计数值
    tim.TIM_Prescaler = 7199; // 7200分频, 得到基准时钟0.1ms
    TIM_TimeBaseInit(TIM2, &tim);
   
    // 配置定时器2的通道1
    timic.TIM_Channel = TIM_Channel_1;
    timic.TIM_ICFilter = 0; // 不消抖
    timic.TIM_ICPolarity = TIM_ICPolarity_Rising; // 通道1捕获上升沿
    timic.TIM_ICPrescaler = TIM_ICPSC_DIV1;
    timic.TIM_ICSelection = TIM_ICSelection_DirectTI; // TI1->IC1=PA0
    TIM_ICInit(TIM2, &timic);
   
    // 配置定时器2的通道2
    timic.TIM_Channel = TIM_Channel_2;
    timic.TIM_ICFilter = 0;
    timic.TIM_ICPolarity = TIM_ICPolarity_Falling; // 通道2捕获下降沿
    timic.TIM_ICPrescaler = TIM_ICPSC_DIV1;
    timic.TIM_ICSelection = TIM_ICSelection_IndirectTI; // TI2->IC1=PA0
    TIM_ICInit(TIM2, &timic);
   
    TIM_SelectInputTrigger(TIM2, TIM_TS_TI1FP1); // TRGI=TI1
    TIM_SelectSlaveMode(TIM2, TIM_SlaveMode_Reset); // 上升沿使定时器归0
    TIM_Cmd(TIM2, ENABLE);
   
    // 配置串口
    USART_StructInit(&usart);
    usart.USART_BaudRate = 115200;
    usart.USART_Mode = USART_Mode_Tx;
    USART_Init(USART1, &usart);
    USART_Cmd(USART1, ENABLE);
   
    // 配置串口DMA
    USART_DMACmd(USART1, USART_DMAReq_Tx, ENABLE);
    dma.DMA_BufferSize = 0;
    dma.DMA_DIR = DMA_DIR_PeripheralDST;
    dma.DMA_M2M = DMA_M2M_Disable;
    dma.DMA_MemoryBaseAddr = (uint32_t)str;
    dma.DMA_MemoryDataSize = DMA_MemoryDataSize_Byte;
    dma.DMA_MemoryInc = DMA_MemoryInc_Enable;
    dma.DMA_Mode = DMA_Mode_Normal;
    dma.DMA_PeripheralBaseAddr = (uint32_t)&USART1->DR;
    dma.DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte;
    dma.DMA_PeripheralInc = DMA_PeripheralInc_Disable;
    dma.DMA_Priority = DMA_Priority_Low;
    DMA_Init(DMA1_Channel4, &dma);
   
    // 配置定时器中断
    TIM_ITConfig(TIM2, TIM_IT_Trigger, ENABLE);
    nvic.NVIC_IRQChannel = TIM2_IRQn;
    nvic.NVIC_IRQChannelCmd = ENABLE;
    nvic.NVIC_IRQChannelPreemptionPriority = 0;
    nvic.NVIC_IRQChannelSubPriority = 0;
    NVIC_Init(&nvic);
   
    while (1)
        seg_scan();
}

void TIM2_IRQHandler(void)
{
    uint8_t i, j;
    uint16_t numbuf;
    TIM_ClearITPendingBit(TIM2, TIM_IT_Trigger);
    for (i = 7; i < 30; i += 21)
    {
        if (i == 7)
            numbuf = TIM_GetCapture1(TIM2);
        else
            numbuf = TIM_GetCapture2(TIM2);
        for (j = 5; j <= 5; j--)
        {
            if (j == 1)
                continue;
            str[i + j] = '0' + numbuf % 10;
            numbuf /= 10;
        }
    }
    DMA_Cmd(DMA1_Channel4, DISABLE);
    DMA_SetCurrDataCounter(DMA1_Channel4, strlen(str));
    DMA_Cmd(DMA1_Channel4, ENABLE);
}
一派护法 十九级
14楼 发表于:2017-4-2 15:38
【测得的数据】
Total: 0.0519s  High Level: 0.0000s
Total: 0.7598s  High Level: 0.3597s
Total: 0.7676s  High Level: 0.3614s
Total: 0.7684s  High Level: 0.3618s
Total: 0.7688s  High Level: 0.3635s
Total: 0.7653s  High Level: 0.3630s
Total: 0.7654s  High Level: 0.3606s
Total: 0.7639s  High Level: 0.3617s
Total: 0.7643s  High Level: 0.3592s
Total: 0.7602s  High Level: 0.3556s
Total: 0.7624s  High Level: 0.3595s
Total: 0.7605s  High Level: 0.3587s
Total: 0.7571s  High Level: 0.3535s
Total: 0.7599s  High Level: 0.3567s
Total: 0.7605s  High Level: 0.3572s
Total: 0.7566s  High Level: 0.3520s
Total: 0.7593s  High Level: 0.3547s
Total: 0.7553s  High Level: 0.3543s
Total: 0.7537s  High Level: 0.3493s
Total: 0.7555s  High Level: 0.3542s
Total: 0.7562s  High Level: 0.3532s
Total: 0.7601s  High Level: 0.3570s
Total: 0.7526s  High Level: 0.3523s
Total: 0.7596s  High Level: 0.3577s
Total: 0.7576s  High Level: 0.3553s
Total: 0.7571s  High Level: 0.3537s
Total: 0.7537s  High Level: 0.3542s
Total: 0.7585s  High Level: 0.3560s
Total: 0.7562s  High Level: 0.3522s
Total: 0.7548s  High Level: 0.3541s
Total: 0.7539s  High Level: 0.3499s
Total: 0.7534s  High Level: 0.3514s
Total: 0.7565s  High Level: 0.3526s
Total: 0.7538s  High Level: 0.3522s
Total: 0.7582s  High Level: 0.3560s
Total: 0.7521s  High Level: 0.3509s
Total: 0.7551s  High Level: 0.3516s
Total: 0.7515s  High Level: 0.3493s
Total: 0.7538s  High Level: 0.3527s
Total: 0.7498s  High Level: 0.3497s
Total: 0.7565s  High Level: 0.3545s
Total: 0.7529s  High Level: 0.3523s
Total: 0.7493s  High Level: 0.3488s
Total: 0.7500s  High Level: 0.3498s
Total: 0.7569s  High Level: 0.3547s
Total: 0.7521s  High Level: 0.3511s
Total: 0.7496s  High Level: 0.3492s
Total: 0.7502s  High Level: 0.3498s
Total: 0.7572s  High Level: 0.3550s
Total: 0.7522s  High Level: 0.3519s
Total: 0.7551s  High Level: 0.3512s
Total: 0.7495s  High Level: 0.3463s
Total: 0.7535s  High Level: 0.3522s
Total: 0.7517s  High Level: 0.3514s
Total: 0.7499s  High Level: 0.3500s
Total: 0.7503s  High Level: 0.3504s
Total: 0.7543s  High Level: 0.3504s
Total: 0.7543s  High Level: 0.3535s
一派护法 十九级
15楼 发表于:2017-4-2 15:45
【TIM2_IRQHandler函数容错处理】
// 仅当上次发送完毕后再发送新内容, 否则丢弃本次测量结果
if (DMA_GetCurrDataCounter(DMA1_Channel4) == 0)
{
    DMA_Cmd(DMA1_Channel4, DISABLE);
    DMA_SetCurrDataCounter(DMA1_Channel4, strlen(str));
    DMA_Cmd(DMA1_Channel4, ENABLE);
}
一派护法 十九级
16楼 发表于:2017-4-2 15:46
【将左LED灯短路后测得的数据】
Total: 0.2129s  High Level: 0.0011s
Total: 0.0042s  High Level: 0.0022s
Total: 0.0066s  High Level: 0.0009s
Total: 0.4424s  High Level: 0.4061s
Total: 0.4432s  High Level: 0.4025s
Total: 0.0032s  High Level: 0.0006s
Total: 0.4497s  High Level: 0.4123s
Total: 0.4442s  High Level: 0.0000s
Total: 0.0029s  High Level: 0.0008s
Total: 0.4509s  High Level: 0.4147s
Total: 0.4501s  High Level: 0.4133s
Total: 0.0049s  High Level: 0.0049s
Total: 0.4339s  High Level: 0.3970s
Total: 0.4497s  High Level: 0.4138s
Total: 0.4507s  High Level: 0.4138s
Total: 0.4589s  High Level: 0.4210s
Total: 0.4336s  High Level: 0.0020s
Total: 0.0033s  High Level: 0.0010s
Total: 0.4332s  High Level: 0.4002s
Total: 0.0051s  High Level: 0.0033s
Total: 0.4352s  High Level: 0.4035s
Total: 0.0057s  High Level: 0.0032s
Total: 0.4301s  High Level: 0.3939s
Total: 0.4495s  High Level: 0.4122s
Total: 0.4494s  High Level: 0.4133s
Total: 0.4509s  High Level: 0.4145s
Total: 0.4489s  High Level: 0.4128s
Total: 0.4388s  High Level: 0.4025s
Total: 0.4503s  High Level: 0.4142s
Total: 0.4394s  High Level: 0.4033s
Total: 0.4498s  High Level: 0.4123s
Total: 0.4489s  High Level: 0.4118s
Total: 0.4495s  High Level: 0.4122s
Total: 0.4402s  High Level: 0.4039s
Total: 0.4500s  High Level: 0.4129s
Total: 0.4530s  High Level: 0.4191s
Total: 0.4564s  High Level: 0.4200s
Total: 0.4389s  High Level: 0.4026s
Total: 0.4397s  High Level: 0.4027s
Total: 0.4492s  High Level: 0.4118s
Total: 0.4500s  High Level: 0.4131s
Total: 0.4495s  High Level: 0.4123s
Total: 0.4601s  High Level: 0.4227s
Total: 0.4395s  High Level: 0.4038s
Total: 0.4488s  High Level: 0.4108s
Total: 0.4403s  High Level: 0.4046s
Total: 0.4402s  High Level: 0.4042s
Total: 0.4386s  High Level: 0.4024s
Total: 0.4443s  High Level: 0.0001s
Total: 0.0002s  High Level: 0.0001s
Total: 0.4554s  High Level: 0.4222s
Total: 0.0058s  High Level: 0.0033s
Total: 0.4503s  High Level: 0.4143s
Total: 0.4506s  High Level: 0.4141s
Total: 0.4486s  High Level: 0.4118s
Total: 0.4400s  High Level: 0.4039s
Total: 0.4523s  High Level: 0.4189s
Total: 0.0064s  High Level: 0.0033s
Total: 0.4441s  High Level: 0.0001s
Total: 0.0002s  High Level: 0.0002s
Total: 0.4523s  High Level: 0.4150s
Total: 0.4499s  High Level: 0.4133s
Total: 0.4434s  High Level: 0.4111s
Total: 0.0002s  High Level: 0.0002s
Total: 0.4531s  High Level: 0.4165s
Total: 0.4503s  High Level: 0.4121s
Total: 0.4425s  High Level: 0.0000s
Total: 0.0032s  High Level: 0.0008s
Total: 0.4437s  High Level: 0.0001s
Total: 0.0030s  High Level: 0.0009s
Total: 0.4507s  High Level: 0.4140s
Total: 0.4434s  High Level: 0.0001s
Total: 0.0001s  High Level: 0.0000s
Total: 0.4417s  High Level: 0.4058s
Total: 0.4501s  High Level: 0.4129s
Total: 0.4495s  High Level: 0.4138s
Total: 0.4498s  High Level: 0.4130s
Total: 0.4501s  High Level: 0.4136s
Total: 0.4396s  High Level: 0.4034s
Total: 0.4496s  High Level: 0.4128s
Total: 0.4497s  High Level: 0.4136s
Total: 0.4420s  High Level: 0.4084s
Total: 0.0061s  High Level: 0.0034s
Total: 0.4348s  High Level: 0.0001s
Total: 0.0030s  High Level: 0.0006s
一派护法 十九级
17楼 发表于:2017-4-2 15:48
【将右LED灯短路后测得的数据】
Total: 0.0087s  High Level: 0.0000s
Total: 0.0001s  High Level: 0.0000s
Total: 0.0008s  High Level: 0.0008s
Total: 0.0001s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0681s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0681s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.6003s  High Level: 0.2991s
Total: 0.0000s  High Level: 0.0000s
Total: 0.1081s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0026s  High Level: 0.0026s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0031s  High Level: 0.0031s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0058s  High Level: 0.0058s
一派护法 十九级
18楼 发表于:2017-4-2 15:49
【将两个LED灯都短路后测得的数据】
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0024s
Total: 0.0002s  High Level: 0.0004s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0001s  High Level: 0.0003s
Total: 0.0065s  High Level: 0.0065s
Total: 0.0000s  High Level: 0.0011s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0001s  High Level: 0.0001s
Total: 0.0025s  High Level: 0.0025s
Total: 0.0037s  High Level: 0.0037s
Total: 0.0002s  High Level: 0.0002s
Total: 0.0000s  High Level: 0.0004s
Total: 0.0001s  High Level: 0.0000s
Total: 0.0067s  High Level: 0.0067s
Total: 0.0002s  High Level: 0.0004s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0002s  High Level: 0.0002s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0007s
Total: 0.0066s  High Level: 0.0066s
Total: 0.0002s  High Level: 0.0002s
Total: 0.0000s  High Level: 0.0002s
Total: 0.0001s  High Level: 0.0001s
Total: 0.0004s  High Level: 0.0004s
Total: 0.0000s  High Level: 0.0011s
Total: 0.0000s  High Level: 0.0001s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0068s  High Level: 0.0068s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0007s
Total: 0.0064s  High Level: 0.0064s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0001s  High Level: 0.0001s
Total: 0.0032s  High Level: 0.0032s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0002s  High Level: 0.0004s
Total: 0.0067s  High Level: 0.0067s
Total: 0.0002s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0002s  High Level: 0.0002s
Total: 0.0056s  High Level: 0.0056s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0056s  High Level: 0.0017s
Total: 0.0089s  High Level: 0.0089s
Total: 0.0000s  High Level: 0.0008s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0064s  High Level: 0.0064s
Total: 0.0002s  High Level: 0.0002s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0001s  High Level: 0.0001s
Total: 0.0001s  High Level: 0.0000s
Total: 0.0002s  High Level: 0.0002s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0002s  High Level: 0.0002s
Total: 0.0065s  High Level: 0.0065s
Total: 0.0001s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0001s  High Level: 0.0001s
Total: 0.0001s  High Level: 0.0003s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0002s  High Level: 0.0002s
Total: 0.0066s  High Level: 0.0066s
Total: 0.0002s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0060s  High Level: 0.0060s
Total: 0.0002s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0066s  High Level: 0.0066s
Total: 0.0002s  High Level: 0.0002s
Total: 0.0048s  High Level: 0.0016s
Total: 0.0017s  High Level: 0.0017s
Total: 0.0080s  High Level: 0.0080s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0002s  High Level: 0.0002s
Total: 0.0069s  High Level: 0.0069s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0072s  High Level: 0.0072s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0002s
Total: 0.0002s  High Level: 0.0002s
Total: 0.0055s  High Level: 0.0055s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0060s  High Level: 0.0060s
Total: 0.0001s  High Level: 0.0001s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0004s  High Level: 0.0004s
Total: 0.0082s  High Level: 0.0082s
Total: 0.0001s  High Level: 0.0003s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0002s  High Level: 0.0004s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0002s  High Level: 0.0002s
Total: 0.0077s  High Level: 0.0077s
Total: 0.0002s  High Level: 0.0002s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0000s  High Level: 0.0000s
Total: 0.0067s  High Level: 0.0067s
Total: 0.0000s  High Level: 0.0000s
一派护法 十九级
19楼 发表于:2017-4-2 16:47
把多谐振荡器输出的信号接到74LS193计数器的时钟信号引脚上可以看到,计数值跳变得很不规则。有时候是加1,有时却加的是2,甚至3。因此,多谐振荡器不能用来作为数字电路的时钟源。
一派护法 十九级
20楼 发表于:2017-4-2 18:11
STM32单片机内部有斯密特触发器来过滤外部的输入,所以多谐振荡器的噪声体现不明显。然而在普通的数字74系列芯片中可没有这样的过滤器,所以都无法正常工作。

回复帖子

内容:
用户名: 您目前是匿名发表
验证码:
(快捷键:Ctrl+Enter)
 

本帖信息

点击数:833 回复数:18
评论数: ?
作者:巨大八爪鱼
最后回复:巨大八爪鱼
最后回复时间:2017-4-2 18:11
 
©2010-2024 Arslanbar Ver2.0
除非另有声明,本站采用知识共享署名-相同方式共享 3.0 Unported许可协议进行许可。