简体   繁体   English

是否有一种简单的方法可以与在FPGA上运行的C程序内的网页进行交互?

[英]Is there an easy way to interact with web pages within a C program running on an FPGA?

First of all: I'm an electronic engineer, so I'm not really comfortable with high-level coding, I barely "speak" C. For a class project I need to develop an embedded application on an Altera FPGA using a NiosII softcore processor. 首先:我是一名电子工程师,所以我对高级编码不太满意,我几乎不会说“ C”。对于一个班级项目,我需要使用NiosII软核在Altera FPGA上开发嵌入式应用程序处理器。 We wanted to try reading some data from the Internet and then do something with it (ie displaying it in some way), but we have no idea how to do that without having to learn a load of new things, and without running an OS. 我们想尝试从Internet读取一些数据,然后进行一些处理(即以某种方式显示数据),但是我们不知道该如何做,而不必学习大量新知识并且无需运行操作系统。 Is there an easy way to do this? 是否有捷径可寻? I read about cURL but my understanding is it needs an OS. 我读了有关cURL的文章,但我的理解是它需要一个操作系统。 What other options do we have? 我们还有什么其他选择? Literally any data easy enough to access is okay, we'll try to be creative with it. 从字面上看,任何易于访问的数据都是可以的,我们将尝试使其具有创造力。

What I know is that we have a Wifi module that should take care of the TCP/IP protocol, exchanging data to the FPGA through UART. 我知道的是,我们有一个Wifi模块,该模块应负责TCP / IP协议,并通过UART将数据交换到FPGA。

I'm sorry this may sound like a not very informed question, but I need to understand if this project is feasable before undertaking it. 抱歉,这听起来可能不是一个很明智的问题,但是在进行此项目之前,我需要了解该项目是否可行。 Thanks in advance! 提前致谢!

Part will depend on what you can do with that wifi module, but the essentials would be: 部分取决于您可以使用该wifi模块执行的操作,但要点如下:
- open a tcp/ip socket, -打开一个tcp / ip套接字,
- connect to an http server on port 80, using that socket -使用该套接字连接到端口80上的http服务器
- write GET / HTTP/1.0\\r\\n\\r\\n to the socket, the / is the path to the object like /sensor/temperature -将GET / HTTP/1.0\\r\\n\\r\\n写入套接字,/是指向/sensor/temperature类的对象的路径
- read the response from the socket -从套接字读取响应
A typical response would be something like: 典型的响应如下:

    HTTP/1.1 200 OK
    Date: Tue, 09 Apr 2019 14:31:05 GMT
    Server: Apache/2.2.16 (Debian)
    Last-Modified: Mon, 20 Jul 2009 04:29:15 GMT
    ETag: "1fdbfa-2d-46f1b949d9cc0"
    Accept-Ranges: bytes
    Content-Length: 45
    Connection: close
    Content-Type: text/html

    <html><body><h1>It works!</h1></body></html>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM