做网站要固定电话自己动手建立网站3
做网站要固定电话,自己动手建立网站3,网页制作软件下载,企业展厅建筑设计前面我做了几个实验 都没有用过 开关#xff0c;这一次用一用 发现 vivado 真的挺方便 所以 使用 vivado 开发 1.建工程 我使用 vivado 2013.4 创建新工程 –》 next –》next 勾选 Do not specify sources at this time //这样跳过后面两个添加文件页面 选择 board –》 ze… 前面我做了几个实验 都没有用过 开关这一次用一用 发现 vivado 真的挺方便 所以 使用 vivado 开发 1.建工程 我使用 vivado 2013.4 创建新工程 –》 next –》next 勾选 Do not specify sources at this time //这样跳过后面两个添加文件页面 选择 board –》 zedboard –》next –》finsh 就创建完了。 2.PL端 IP核添加与连线 创建一个空的 Diagram Create Block Design -》点 ok 接下来 添加 IP核 可以点击 提示 Add IP 也可以点击 搜索 zynq 点 第一个 然后 点击 Run Block Automation 自动配置 点击 添加 GPIO 接下来 会提示 Run Connection Automation 自动连线 选择 S_AXI 变成下图 系统自动添加了 一些IP核 继续点击 Run Connection Automation -》 GPIO 选择 led_8bits -》 OK 同样的方法 添加 GPIO IP核 -》 Run Connection Automation 两次 选择 sws_8bits 就完成了 点击 红圈处 验证 一下。 3.生成 bit 的过程 点击 Source -》 design_1 右键 –》 Create HDL Wrapper -》 OK 然后 Synthesis 、 Implementation 、Bitstream 依次过一遍 这个过程费时间。。 Synthesis 以后 一直点ok 最后 点击 Generate Bitstream 4.输出到SDK 选上 launch SDk 点 OK 就启动SDK 了 我的 SDK 是 点击 FILE –》 new – Application project 选一个 helloworld 复制以下代码 1 #include stdio.h2 #include platform.h3 #include xparameters.h4 #include xgpio.h5 #include sleep.h6 #include platform.h7 #include xil_types.h8 #include xgpiops.h9
10
11 /************************** Constant Definitions *****************************/
12
13 /*
14 * The following constant maps to the name of the hardware instances that
15 * were created in the EDK XPS system.
16 */
17 #define XPAR_LEDS_ID XPAR_AXI_GPIO_0_BASEADDR //AXI_GPIO_0 是添加的第一个 gpio 所以是 leds
18 #define XPAR_SWS_ID XPAR_AXI_GPIO_1_BASEADDR //那么 这个自然是 开关了
19
20 int main()
21 {
22 static XGpio LED_Ptr;//定义GPIO指针
23 static XGpio SWS_Ptr;
24 int XStatus;
25 int num 0;
26 //初始化 LED
27 XStatus XGpio_Initialize(LED_Ptr,XPAR_AXI_GPIO_0_DEVICE_ID);
28 if(XST_SUCCESS ! XStatus)
29 print(GPIO INIT FAILED\n\r);
30 XGpio_SetDataDirection(LED_Ptr, 1,0x00);//通道1设置方向 0 输出 1输入, 0x00表示8位都是输出
31 XGpio_DiscreteWrite(LED_Ptr, 1,0x00);
32
33 //初始化 开关
34 XStatus XGpio_Initialize(SWS_Ptr,XPAR_AXI_GPIO_1_DEVICE_ID);
35 if(XST_SUCCESS ! XStatus)
36 print(GPIO INIT FAILED\n\r);
37 XGpio_SetDataDirection(SWS_Ptr, 1,0xFF);//通道1设置方向 0 输出 1输入 0xFF表示8位都是输入
38
39
40
41 while(1){
42 num XGpio_DiscreteRead(SWS_Ptr, 1); //从开关处 读数据
43 printf(Numb %d\n\r, num);
44 XGpio_DiscreteWrite(LED_Ptr, 1,num); //直接写入 led
45 usleep(1000); //delay 1ms
46 }
47
48 printf(end\n\r \n\r);
49 return 0;
50 } 确保 zedboard 已经连到电脑上 并打开电源 先 xilinx Tools – ProgramFPGA 然后 - Run As – Launch on Hardware (GDB) 可以看到 结果 64 1 第 7 个 和 第 1 个 开关 是开的 表示 所以 led 也亮了 转载于:https://www.cnblogs.com/rocbomb/p/3876683.html
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/pingmian/87271.shtml
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!