FPGA EDK C

4 views
Skip to first unread message

ttchjd

unread,
Apr 13, 2010, 8:48:09 PM4/13/10
to fpga-cl...@googlegroups.com
��λѧ������һ����edk��дC������û��ʲô�ο��ģ������Ǹ�һ���C��̫һ��ġ�����һ�����ӣ��������Щ�ؼ���֮��������вο��𣿻��и�����������������Щ�������Ӳ���������IP��IP��������أ�лл��
#include "xparameters.h"
#include "stdio.h"
#include "xgpio.h"
#include "xutil.h"
//====================================================
int main (void) {
 XGpio dip,push;
 int i,psb_check,dip_check;
 print("--start of the program--\r\n");
 XGpio_Initialize(&dip,XPAR_DIP1_DEVICE_ID);
 XGpio_SetDataDirection(&dip,1,0xffffffff);
 
 XGpio_Initialize(&push,XPAR_PUSH1_DEVICE_ID);
 XGpio_SetDataDirection(&push,1,0xffffffff);
 
 while(1)
 {
  psb_check = XGpio_DiscreteRead(&push,1);
  xil_printf("Push Buttons Status %x\r\n",psb_check);
  dip_check = XGpio_DiscreteRead(&dip,1);
  xil_printf("Dip Switch Status %x\r\n",dip_check);
  sleep(1);
 }
 
   return 0;
}


���������Ѷ�����°�MSN��ҳ�� ���̷��ʣ�

Zhiqiang Que

unread,
Apr 14, 2010, 12:23:16 AM4/14/10
to fpga-cl...@googlegroups.com
在microblaze_0/include目录下面
的xparameters.h下面。

你可以仔细看一下

#include "xparameters.h"
#include "xgpio.h"
#include "xutil.h"

ttchjd wrote:
各 位学长,问一下在edk下写C代码有没有什么参考的?好像是跟一般的C不太一样的。看到一个例子,里面的这些关键字之类的哪里有参考吗?还有个问题就是这 里面的哪些东西会和硬件设置里的IP,IP例化名相关呢?谢谢!

#include "xparameters.h"
#include "stdio.h"
#include "xgpio.h"
#include "xutil.h"
//====================================================
int main (void) {
 XGpio dip,push;
 int i,psb_check,dip_check;
 print("--start of the program--\r\n");
 XGpio_Initialize(&dip,XPAR_DIP1_DEVICE_ID);
 XGpio_SetDataDirection(&dip,1,0xffffffff);
 
 XGpio_Initialize(&push,XPAR_PUSH1_DEVICE_ID);
 XGpio_SetDataDirection(&push,1,0xffffffff);
 
 while(1)
 {
  psb_check = XGpio_DiscreteRead(&push,1);
  xil_printf("Push Buttons Status %x\r\n",psb_check);
  dip_check = XGpio_DiscreteRead(&dip,1);
  xil_printf("Dip Switch Status %x\r\n",dip_check);
  sleep(1);
 }
 
   return 0;
}


更多热辣资讯尽在新版MSN首页! 立刻访问! --
You received this message because you are subscribed to the Google
Groups "fpga-club-sjtu" group.
如果想要发贴,可以直接发邮件到fpga-cl...@googlegroups.com
或者到论坛首页发贴即可
http://groups.google.com/group/fpga-club-sjtu?hl=en?hl=en
Reply all
Reply to author
Forward
0 new messages