microblaze 定时器的PWM模式 调的头晕!就是出不来!
以前定时器用过昨天帮便宜调试定时器的PWM模式谁知道调了一天也没弄出来工程添加应该没问题
寄存器也就几个按照datasheet上给的写但是波形一直出不来 axi_timer_0_PWM0_pin 和 clock_generator_0_CLKIN_pin两个引脚都没有波形
#include <stdio.h>
#include "xparameters.h"
#include "xil_cache.h"
#include "xintc.h"
#include "intc_header.h"
#include "uartlite_header.h"
#include "xtmrctr.h"// 系统时钟100M
#include "tmrctr_header.h"
#include "tmrctr_intr_header.h"
#define REG(x) (*((volatile unsigned long *)(x)))
int main()
{
Xil_ICacheEnable();
Xil_DCacheEnable();
print("---Entering main---\n\r");
REG(XPAR_AXI_TIMER_0_BASEADDR + 0x04) = 0xffffffff - 20000 + 0x2;// TLR0// 周期 200US
REG(XPAR_AXI_TIMER_0_BASEADDR + 0x14) = 0xffffffff - 10000 + 0x2;// TLR1// 高电平 100US
REG(XPAR_AXI_TIMER_0_BASEADDR) = 0x00000224;// TCSR0
REG(XPAR_AXI_TIMER_0_BASEADDR + 0x10) = 0x00000224;// TCSR1
xil_printf("--0x%x\n\r", REG(XPAR_AXI_TIMER_0_BASEADDR + 0x00));
xil_printf("--0x%x\n\r", REG(XPAR_AXI_TIMER_0_BASEADDR + 0x10));
REG(XPAR_AXI_TIMER_0_BASEADDR) = 0x000002b4;
REG(XPAR_AXI_TIMER_0_BASEADDR + 0x10) = 0x000002b4;
xil_printf("---------stop--------------------\n\r");
while(1);
}
datasheet :
页:
[1]