问答

汇集网友智慧,解决技术难题

21ic问答首页 - TAG - POS
  • fpga程序问题 赏100家园币

    always @(posedge sys_clk0 ) begin s1 <= clk_init; //CLK_pwm s2 <= s1; //0 end assign pose_sclk=!s2&s1; // always @(posedge sys_clk0 or negedge rst_n) if(~rst_n) begin rst_n<=1'b1; clk_100m<=1'b0; state_d<=WAIT; end else begin if(pose_sclk) // 上升沿 state_d<=A; else case(state_d) //0 A:begin clk_100m<=1'b1; state_d<=B; end B:begin clk_100m<=1'b0; state_d<=WAIT; end WAIT:begin clk_100m<=1'b0; end default: state_d <= WAIT; endcase end always @(posedge sys_clk0 ) begin s1 <= clk_init; //CLK_pwm s2 <= s1; //0 end assign pose_sclk=!s2&s1; // always @(posedge sys_clk0 or negedge rst_n) if(~rst_n) begin rst_n<=1'b1; clk_100m<=1'b0; state_d<=WAIT; end else begin if(pose_sclk) // 上升沿 state_d<=A; else case(state_d) //0 A:begin clk_100m<=1'b1; state_d<=B; end B:begin clk_100m<=1'b0; state_d<=WAIT; end WAIT:begin clk_100m<=1'b0; end default: state_d <= WAIT; endcase end [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px]always @(posedge sys_clk0 ) begin[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px] s1 <= clk_init; //CLK_pwm[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px] s2 <= s1; //0[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px] end[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px] assign pose_sclk=!s2&s1; //[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px] always @(posedge sys_clk0 or negedge rst_n)[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px] if(~rst_n) begin[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px] rst_n<=1'b1;[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px] clk_100m<=1'b0;[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px] state_d<=WAIT;[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px] end[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px] else begin if(pose_sclk) // 上升沿[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px] state_d<=A;[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px] else case(state_d) //0[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px] A:begin[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px] clk_100m<=1'b1;[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px] state_d<=B;[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px] end[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px] B:begin[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px] clk_100m<=1'b0;[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px] state_d<=WAIT;[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px] end[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px] WAIT:begin[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px] clk_100m<=1'b0;[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px] end[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px] default: state_d <= F;[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px] endcase[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px] end[/size][/font][/backcolor][/color] [color=#444444][backcolor=rgb(242, 249, 253)][font=Tahoma, "][size=16px]50Mhz晶振,sys_clk0 倍频100Mhz,clk_init作为输入脉冲信号1Khz-100Khz。在clk_init上升沿输出clk_100m高低变化一次。发现clk_100m有抖动。 [/size][/font][/backcolor][/color]

    FPGA edge ge os POS se

    2918浏览量 2回复量 关注量
  • MM32F103发生硬件中断。 sos

    描述:读48000004的地址内容入变量(寄存器R4),发生硬件中断 原句: if (GPIO_InitStruct->GPIO_Pin > 0x00FF) { !!!!!!!!!!!!这个语句有问题!!!!!!!!!! tmpreg =GPIOx->CRH; !!!!!!!!!!!!!!!!!!!!!!!!!!!! for (pinpos = 0x00; pinpos < 0x08; pinpos++) { pos = (((uint32_t)0x01) << (pinpos + 0x08)) 汇编下: 0x080006F8 6854 LDR r4,[r2,#0x04] 其中R4 :00000000 R2 :48000000 解析:40000000 为外设地址 ,偏移08000000 应该是GPIOA的地址,后面04则为这个地址的CRH位,但是就是读不出,工程文件均为官方例程。

    mm32f103 硬件中断 pi POS os

    3414浏览量 0回复量 关注量