金牌会员
- 积分
- 1154
- 金钱
- 1154
- 注册时间
- 2012-3-4
- 在线时间
- 80 小时
|
现在用的51在发射,STM32写接收程序,怎么都收不到,只是把51上的程序移过来,怎么会出问题呢?我注意了IO方向的,都弄好了。不知道是什么问题呢?延时函数都对了一遍,子函数都弄了。好烦,一下午一晚上了。请教大家。<br />
<br />
<div>int main(void)</div>
<div>{<span class="Apple-tab-span" style="white-space:pre;"> </span></div>
<div><span class="Apple-tab-span" style="white-space:pre;"> </span>u8 t=0,temp;</div>
<div><span class="Apple-tab-span" style="white-space:pre;"> </span> </div>
<div> <span class="Apple-tab-span" style="white-space:pre;"> </span>Stm32_Clock_Init(9);//系统时钟设置</div>
<div><span class="Apple-tab-span" style="white-space:pre;"> </span>delay_init(72);<span class="Apple-tab-span" style="white-space:pre;"> </span>//延时初始化 </div>
<div><span class="Apple-tab-span" style="white-space:pre;"> </span>LED_Init();</div>
<div> </div>
<div><span class="Apple-tab-span" style="white-space:pre;"> </span>configIO();//配置IO默认是DAT输出</div>
<div><span class="Apple-tab-span" style="white-space:pre;"> </span>/*无线模块设置*/</div>
<div><span class="Apple-tab-span" style="white-space:pre;"> </span>ower_up();//wireless上电</div>
<div><br />
</div>
<div><span class="Apple-tab-span" style="white-space:pre;"> </span>LED1=0;</div>
<div><span class="Apple-tab-span" style="white-space:pre;"> </span>delay_ms(500);</div>
<div><span class="Apple-tab-span" style="white-space:pre;"> </span>LED1=1;</div>
<div><span class="Apple-tab-span" style="white-space:pre;"> </span>Nrf2401Init();</div>
<div><span class="Apple-tab-span" style="white-space:pre;"> </span>delay_ms(500);</div>
<div><br />
</div>
<div><span class="Apple-tab-span" style="white-space:pre;"> </span>DATin();//DAT上拉输入读数据</div>
<div> <span class="Apple-tab-span" style="white-space:pre;"> </span>while(1) </div>
<div><span class="Apple-tab-span" style="white-space:pre;"> </span>{ </div>
<div><span class="Apple-tab-span" style="white-space:pre;"> </span>temp = ReceiveData();</div>
<div><span class="Apple-tab-span" style="white-space:pre;"> </span> <span class="Apple-tab-span" style="white-space:pre;"> </span>if(temp==1)</div>
<div><span class="Apple-tab-span" style="white-space:pre;"> </span>{</div>
<div><span class="Apple-tab-span" style="white-space:pre;"> </span>LED1=0;</div>
<div><span class="Apple-tab-span" style="white-space:pre;"> </span>delay_ms(500);</div>
<div><span class="Apple-tab-span" style="white-space:pre;"> </span>LED1=1;</div>
<div><span class="Apple-tab-span" style="white-space:pre;"> </span>delay_ms(500);</div>
<div><span class="Apple-tab-span" style="white-space:pre;"> </span>} </div>
<div> <span class="Apple-tab-span" style="white-space:pre;"> </span> <span class="Apple-tab-span" style="white-space:pre;"> </span> </div>
<div><span class="Apple-tab-span" style="white-space:pre;"> </span> <span class="Apple-tab-span" style="white-space:pre;"> </span></div>
<div><span class="Apple-tab-span" style="white-space:pre;"> </span>}<span class="Apple-tab-span" style="white-space:pre;"> </span> </div>
<div>}</div>
<br /> |
|