完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
嗨,我是SDK新手,我正在尝试通过电路板上的4个开关实现一个C程序来控制Spartan 3E入门套件上的LED。
我已经完成了XPS硬件部分,但我不知道如何做软件部分。 我阅读了文档,但找不到如何分配引脚,LED变量等。 任何帮助将非常感谢! 以上来自于谷歌翻译 以下为原文 Hi, I am new to SDK and I am trying to implement a C program to control the LEDs on Spartan 3E starter kit via the 4 switches on the board. I already did the XPS hardware part but I have no idea how to do the software part. I read the documents but cannot find how to assign pins, LED variables, etc. Any help will be highly appreciated! |
|
相关推荐
6个回答
|
|
|
这是一个例子。
请确保您的系统中有按钮和LED指示灯。 #include“xgpio.h”#include“xparameters.h”int main(void){XGpio gpLED; XGpio gpPB; //初始化外围设备XGpio_Initialize(& gpLED,XPAR_LEDS_4BIT_DEVICE_ID); XGpio_Initialize(& gpPB,XPAR_PUSHBUTTONS_5BIT_DEVICE_ID); //将LED外设设置为输出XGpio_SetDataDirection(& gpLED,1,0,0000000000000); //将按钮外设设置为输入XGpio_SetDataDirection(& gpPB,1,000000000001F); Xuint32数据= 0; while(1){//读取按钮数据的状态= XGpio_DiscreteRead(& gpPB,1); //设置LED状态XGpio_DiscreteWrite(& gpLED,1,data); }} 日Thnx -------------------------------------------------- --------------------------------------------请注意 - 请注明 如果提供的信息有用,请回答“接受为解决方案”。给予您认为有用并回复导向的帖子。感谢K-- -------------------------------------------------- --------------------- 在原帖中查看解决方案 以上来自于谷歌翻译 以下为原文 Here is the example. Please make sure that you have Pushbuttons and LED's in your system. #include "xgpio.h" #include "xparameters.h" int main(void) { XGpio gpLED; XGpio gpPB; // Initialise the peripherals XGpio_Initialize(&gpLED, XPAR_LEDS_4BIT_DEVICE_ID); XGpio_Initialize(&gpPB, XPAR_PUSHBUTTONS_5BIT_DEVICE_ID); // Set the LED peripheral to outputs XGpio_SetDataDirection(&gpLED, 1, 0x00000000); // Set the Push Button peripheral to inputs XGpio_SetDataDirection(&gpPB, 1, 0x0000001F); Xuint32 data = 0; while(1) { // Read the state of the push buttons data = XGpio_DiscreteRead(&gpPB, 1); // Set the LED state XGpio_DiscreteWrite(&gpLED, 1, data); } } Thnx ---------------------------------------------------------------------------------------------- Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful. Give Kudos to a post which you think is helpful and reply oriented. ----------------------------------------------------------------------------------------------View solution in original post |
|
|
|
|
|
这是一个例子。
请确保您的系统中有按钮和LED指示灯。 #include“xgpio.h”#include“xparameters.h”int main(void){XGpio gpLED; XGpio gpPB; //初始化外围设备XGpio_Initialize(& gpLED,XPAR_LEDS_4BIT_DEVICE_ID); XGpio_Initialize(& gpPB,XPAR_PUSHBUTTONS_5BIT_DEVICE_ID); //将LED外设设置为输出XGpio_SetDataDirection(& gpLED,1,0,0000000000000); //将按钮外设设置为输入XGpio_SetDataDirection(& gpPB,1,000000000001F); Xuint32数据= 0; while(1){//读取按钮数据的状态= XGpio_DiscreteRead(& gpPB,1); //设置LED状态XGpio_DiscreteWrite(& gpLED,1,data); }} 日Thnx -------------------------------------------------- --------------------------------------------请注意 - 请注明 如果提供的信息有用,请回答“接受为解决方案”。给予您认为有用并回复导向的帖子。感谢K-- -------------------------------------------------- --------------------- 以上来自于谷歌翻译 以下为原文 Here is the example. Please make sure that you have Pushbuttons and LED's in your system. #include "xgpio.h" #include "xparameters.h" int main(void) { XGpio gpLED; XGpio gpPB; // Initialise the peripherals XGpio_Initialize(&gpLED, XPAR_LEDS_4BIT_DEVICE_ID); XGpio_Initialize(&gpPB, XPAR_PUSHBUTTONS_5BIT_DEVICE_ID); // Set the LED peripheral to outputs XGpio_SetDataDirection(&gpLED, 1, 0x00000000); // Set the Push Button peripheral to inputs XGpio_SetDataDirection(&gpPB, 1, 0x0000001F); Xuint32 data = 0; while(1) { // Read the state of the push buttons data = XGpio_DiscreteRead(&gpPB, 1); // Set the LED state XGpio_DiscreteWrite(&gpLED, 1, data); } } Thnx ---------------------------------------------------------------------------------------------- Kindly note- Please mark the Answer as "Accept as solution" if information provided is helpful. Give Kudos to a post which you think is helpful and reply oriented. ---------------------------------------------------------------------------------------------- |
|
|
|
|
|
我是学生,我需要vhdl代码来控制斯巴达3E入门套件上的开关和LED。
任何代码都会做,简单或温和更好,因为我只是这个领域的新人..提前谢谢你.. 以上来自于谷歌翻译 以下为原文 im a student and i need vhdl code for controlling switches and LEDs on spartan 3E starter kit. any code will do, easy or moderate is better because im just new in this field.. thank you in advance.. |
|
|
|
|
|
@gemcalvin,
我是学生,我需要vhdl代码来控制斯巴达3E入门套件上的开关和LED。 如果您不尝试完成自己的作业,成为学生有什么意义? 你的课程教VHDL吗? 如果您在学习课程材料时遇到问题,请咨询您的教师。 你同意吗? - 鲍勃埃尔金德 签名:新手的自述文件在这里:http://forums.xilinx.com/t5/New-Users-Forum/README-first-Help-for-new-users/td-p/219369总结:1。 阅读手册或用户指南。 你读过手册了吗? 你能找到手册吗?2。 搜索论坛(并搜索网页)以寻找类似的主题。 不要在多个论坛上发布相同的问题。 不要在别人的主题上发布新主题或问题,开始新的主题!5。 学生:复制代码与学习设计不同.6“它不起作用”不是一个可以回答的问题。 提供有用的详细信息(请与网页,数据表链接).7。 您的代码中的评论不需要支付额外费用。 我没有支付论坛帖子的费用。 如果我写一篇好文章,那么我一无所获。 以上来自于谷歌翻译 以下为原文 @gemcalvin, im a student and i need vhdl code for controlling switches and LEDs on spartan 3E starter kit. What is the point of being a student if you do not attempt to complete your own assignments? Do your courses teach VHDL? If you are having problems with following the course material, you should consult your instructor. Do you agree? -- Bob Elkind SIGNATURE: README for newbies is here: http://forums.xilinx.com/t5/New-Users-Forum/README-first-Help-for-new-users/td-p/219369 Summary: 1. Read the manual or user guide. Have you read the manual? Can you find the manual? 2. Search the forums (and search the web) for similar topics. 3. Do not post the same question on multiple forums. 4. Do not post a new topic or question on someone else's thread, start a new thread! 5. Students: Copying code is not the same as learning to design. 6 "It does not work" is not a question which can be answered. Provide useful details (with webpage, datasheet links, please). 7. You are not charged extra fees for comments in your code. 8. I am not paid for forum posts. If I write a good post, then I have been good for nothing. |
|
|
|
|
|
|
|
|
|
|
|
prasaduna4847写道:
我可以获得硬件规格吗? 什么硬件规格? 1 / 4-20螺丝的硬件规格如下: 1/4“直径。 每英寸20个线程。 ----------------------------是的,我这样做是为了谋生。 以上来自于谷歌翻译 以下为原文 prasaduna4847 wrote:Hardware specs for what? A 1/4-20 screw's hardware specs are: 1/4" diameter. 20 threads per inch. ----------------------------Yes, I do this for a living. |
|
|
|
|
只有小组成员才能发言,加入小组>>
3118 浏览 7 评论
3407 浏览 4 评论
Spartan 3-AN时钟和VHDL让ISE合成时出现错误该怎么办?
2873 浏览 9 评论
3966 浏览 0 评论
如何在RTL或xilinx spartan fpga的约束文件中插入1.56ns延迟缓冲区?
3057 浏览 15 评论
请问vc707的电源线是如何连接的,我这边可能出现了缺失元件的情况导致无法供电
1325浏览 1评论
求一块XILINX开发板KC705,VC707,KC105和KCU1500
1167浏览 1评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-1 22:02 , Processed in 1.017042 second(s), Total 82, Slave 65 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
1468
