nuc980开发板使用Agile Modbus软件包-基于 rs485 通讯

2023-12-26 19:44

本文主要是介绍nuc980开发板使用Agile Modbus软件包-基于 rs485 通讯,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

一、nuc980开发板电路

打开 nuc980-eth2p 开发板原理图,如下:
在这里插入图片描述
将JP1跳线帽连接到rs485。使用rs485转usb连接到电脑即可。
除了收发引脚,多了一个控制引脚。

linux内核使能串口4
在这里插入图片描述

二、Agile Modbus软件包

1、软件包的获取

下载网址
选择最新版即可。
在这里插入图片描述

2、软件包的demo

打开下载的文件,文件工程的结构如下,包含doc、examples、inc、src等文件。
在这里插入图片描述
因为我们是 rtu-master,所以打开官方自带的 rtu_master 文件夹。查看串口初始化部分。
在这里插入图片描述

int serial_init(const char *device,int baud, char parity, int data_bit,int stop_bit, struct termios *old_tios)
{struct termios tios;speed_t speed;int flags;/* The O_NOCTTY flag tells UNIX that this program doesn't wantto be the "controlling terminal" for that port. If youdon't specify this then any input (such as keyboard abortsignals and so forth) will affect your processTimeouts are ignored in canonical input mode or when theNDELAY option is set on the file via open or fcntl */flags = O_RDWR | O_NOCTTY | O_NDELAY | O_EXCL;
#ifdef O_CLOEXECflags |= O_CLOEXEC;
#endifint s = open(device, flags);if (s == -1) {LOG_E("ERROR Can't open the device %s (%s)", device, strerror(errno));return -1;}flags = fcntl(s, F_GETFL, 0);flags |= O_NONBLOCK;fcntl(s, F_SETFL, flags);flags = fcntl(s, F_GETFD);flags |= FD_CLOEXEC;fcntl(s, F_SETFD, flags);/* Save */tcgetattr(s, old_tios);memset(&tios, 0, sizeof(struct termios));/* C_ISPEED     Input baud (new interface)C_OSPEED     Output baud (new interface)*/switch (baud) {case 110:speed = B110;break;case 300:speed = B300;break;case 600:speed = B600;break;case 1200:speed = B1200;break;case 2400:speed = B2400;break;case 4800:speed = B4800;break;case 9600:speed = B9600;break;case 19200:speed = B19200;break;case 38400:speed = B38400;break;
#ifdef B57600case 57600:speed = B57600;break;
#endif
#ifdef B115200case 115200:speed = B115200;break;
#endif
#ifdef B230400case 230400:speed = B230400;break;
#endif
#ifdef B460800case 460800:speed = B460800;break;
#endif
#ifdef B500000case 500000:speed = B500000;break;
#endif
#ifdef B576000case 576000:speed = B576000;break;
#endif
#ifdef B921600case 921600:speed = B921600;break;
#endif
#ifdef B1000000case 1000000:speed = B1000000;break;
#endif
#ifdef B1152000case 1152000:speed = B1152000;break;
#endif
#ifdef B1500000case 1500000:speed = B1500000;break;
#endif
#ifdef B2500000case 2500000:speed = B2500000;break;
#endif
#ifdef B3000000case 3000000:speed = B3000000;break;
#endif
#ifdef B3500000case 3500000:speed = B3500000;break;
#endif
#ifdef B4000000case 4000000:speed = B4000000;break;
#endifdefault:speed = B9600;LOG_W("WARNING Unknown baud rate %d for %s (B9600 used)", baud, device);}/* Set the baud rate */if ((cfsetispeed(&tios, speed) < 0) ||(cfsetospeed(&tios, speed) < 0)) {close(s);s = -1;return -1;}/* C_CFLAG      Control optionsCLOCAL       Local line - do not change "owner" of portCREAD        Enable receiver*/tios.c_cflag |= (CREAD | CLOCAL);/* CSIZE, HUPCL, CRTSCTS (hardware flow control) *//* Set data bits (5, 6, 7, 8 bits)CSIZE        Bit mask for data bits*/tios.c_cflag &= ~CSIZE;switch (data_bit) {case 5:tios.c_cflag |= CS5;break;case 6:tios.c_cflag |= CS6;break;case 7:tios.c_cflag |= CS7;break;case 8:default:tios.c_cflag |= CS8;break;}/* Stop bit (1 or 2) */if (stop_bit == 1)tios.c_cflag &= ~CSTOPB;else /* 2 */tios.c_cflag |= CSTOPB;/* PARENB       Enable parity bitPARODD       Use odd parity instead of even */if (parity == 'N') {/* None */tios.c_cflag &= ~PARENB;} else if (parity == 'E') {/* Even */tios.c_cflag |= PARENB;tios.c_cflag &= ~PARODD;} else {/* Odd */tios.c_cflag |= PARENB;tios.c_cflag |= PARODD;}/* Read the man page of termios if you need more information. *//* This field isn't used on POSIX systemstios.c_line = 0;*//* C_LFLAG      Line optionsISIG Enable SIGINTR, SIGSUSP, SIGDSUSP, and SIGQUIT signalsICANON       Enable canonical input (else raw)XCASE        Map uppercase \lowercase (obsolete)ECHO Enable echoing of input charactersECHOE        Echo erase character as BS-SP-BSECHOK        Echo NL after kill characterECHONL       Echo NLNOFLSH       Disable flushing of input buffers afterinterrupt or quit charactersIEXTEN       Enable extended functionsECHOCTL      Echo control characters as ^char and delete as ~?ECHOPRT      Echo erased character as character erasedECHOKE       BS-SP-BS entire line on line killFLUSHO       Output being flushedPENDIN       Retype pending input at next read or input charTOSTOP       Send SIGTTOU for background outputCanonical input is line-oriented. Input characters are putinto a buffer which can be edited interactively by the useruntil a CR (carriage return) or LF (line feed) character isreceived.Raw input is unprocessed. Input characters are passedthrough exactly as they are received, when they arereceived. Generally you'll deselect the ICANON, ECHO,ECHOE, and ISIG options when using raw input*//* Raw input */tios.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);/* C_IFLAG      Input optionsConstant     DescriptionINPCK        Enable parity checkIGNPAR       Ignore parity errorsPARMRK       Mark parity errorsISTRIP       Strip parity bitsIXON Enable software flow control (outgoing)IXOFF        Enable software flow control (incoming)IXANY        Allow any character to start flow againIGNBRK       Ignore break conditionBRKINT       Send a SIGINT when a break condition is detectedINLCR        Map NL to CRIGNCR        Ignore CRICRNL        Map CR to NLIUCLC        Map uppercase to lowercaseIMAXBEL      Echo BEL on input line too long*/if (parity == 'N') {/* None */tios.c_iflag &= ~INPCK;} else {tios.c_iflag |= INPCK;}/* Software flow control is disabled */tios.c_iflag &= ~(IXON | IXOFF | IXANY);/* C_OFLAG      Output optionsOPOST        Postprocess output (not set = raw output)ONLCR        Map NL to CR-NLONCLR ant others needs OPOST to be enabled*//* Raw ouput */tios.c_oflag &= ~OPOST;/* C_CC         Control charactersVMIN         Minimum number of characters to readVTIME        Time to wait for data (tenths of seconds)UNIX serial interface drivers provide the ability tospecify character and packet timeouts. Two elements of thec_cc array are used for timeouts: VMIN and VTIME. Timeoutsare ignored in canonical input mode or when the NDELAYoption is set on the file via open or fcntl.VMIN specifies the minimum number of characters to read. Ifit is set to 0, then the VTIME value specifies the time towait for every character read. Note that this does not meanthat a read call for N bytes will wait for N characters tocome in. Rather, the timeout will apply to the firstcharacter and the read call will return the number ofcharacters immediately available (up to the number yourequest).If VMIN is non-zero, VTIME specifies the time to wait forthe first character read. If a character is read within thetime given, any read will block (wait) until all VMINcharacters are read. That is, once the first character isread, the serial interface driver expects to receive anentire packet of characters (VMIN bytes total). If nocharacter is read within the time allowed, then the call toread returns 0. This method allows you to tell the serialdriver you need exactly N bytes and any read call willreturn 0 or N bytes. However, the timeout only applies tothe first character read, so if for some reason the drivermisses one character inside the N byte packet then the readcall could block forever waiting for additional inputcharacters.VTIME specifies the amount of time to wait for incomingcharacters in tenths of seconds. If VTIME is set to 0 (thedefault), reads will block (wait) indefinitely unless theNDELAY option is set on the port with open or fcntl.*//* Unused because we use open with the NDELAY option */tios.c_cc[VMIN] = 0;tios.c_cc[VTIME] = 0;if (tcsetattr(s, TCSANOW, &tios) < 0) {close(s);s = -1;return -1;}return s;
}

修改Makefile文件
在这里插入图片描述
将 gcc 改为 arm-linux-gcc

CC = arm-linux-gcc -std=gnu99

此时编译并下载到开发板,肯定不能正常通信,还需要对 serial.c 文件进行适当的修改。

三、修改思路

思路:通过对控制引脚的控制,来控制数据的接收和发送。
方法1
不修改串口的初始化,通过配置控制引脚的输出高低电平来操作数据的收发。
方法2
修改串口的初始化,配置为rs485模式,配置 RTS的引脚即可。
文章主要介绍方法2。
rs485收发测试可参考linux 串口测试指令和测试程序

四、串口配置修改

添加头文件

#include <sys/types.h>
#include <sys/stat.h> 
#include <pthread.h>
#include <linux/serial.h>

初始化添加代码

int portfd;#if (__GNUC__ == 4 && __GNUC_MINOR__ == 3)struct my_serial_rs485 rs485conf;struct my_serial_rs485 rs485conf_bak;
#elsestruct serial_rs485 rs485conf;
#endif	portfd=s;if (ioctl (portfd, TIOCGRS485, &rs485conf) < 0) {/* Error handling.*/ printf("ioctl TIOCGRS485 error.\n");}/* Enable RS485 mode: */rs485conf.flags |= SER_RS485_ENABLED;/* Set logical level for RTS pin equal to 1 when sending: */rs485conf.flags |= SER_RS485_RTS_ON_SEND;/* set logical level for RTS pin equal to 0 after sending: */ rs485conf.flags &= ~(SER_RS485_RTS_AFTER_SEND);/* Set rts delay after send, if needed: */rs485conf.delay_rts_after_send = 0x80;if (ioctl (portfd, TIOCSRS485, &rs485conf) < 0){/* Error handling.*/ printf("ioctl TIOCSRS485 error.\n");}else{printf("rs485conf.flags 0x%x.\n", rs485conf.flags);printf("rs485conf.delay_rts_before_send 0x%x.\n", rs485conf.delay_rts_before_send);printf("rs485conf.delay_rts_after_send 0x%x.\n", rs485conf.delay_rts_after_send);}

serial.c 整体代码

#include "serial.h"
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <termios.h>
#include <unistd.h>#include <sys/types.h>
#include <sys/stat.h> 
#include <pthread.h>
#include <linux/serial.h>#define DBG_ENABLE
#define DBG_COLOR
#define DBG_SECTION_NAME "serial"
#define DBG_LEVEL        DBG_LOG
#include "dbg_log.h"int serial_init(const char *device,int baud, char parity, int data_bit,int stop_bit, struct termios *old_tios)
{struct termios tios;speed_t speed;int flags;/* The O_NOCTTY flag tells UNIX that this program doesn't wantto be the "controlling terminal" for that port. If youdon't specify this then any input (such as keyboard abortsignals and so forth) will affect your processTimeouts are ignored in canonical input mode or when theNDELAY option is set on the file via open or fcntl */flags = O_RDWR | O_NOCTTY | O_NDELAY | O_EXCL;
#ifdef O_CLOEXECflags |= O_CLOEXEC;
#endifint s = open(device, flags);if (s == -1) {LOG_E("ERROR Can't open the device %s (%s)", device, strerror(errno));return -1;}flags = fcntl(s, F_GETFL, 0);flags |= O_NONBLOCK;fcntl(s, F_SETFL, flags);flags = fcntl(s, F_GETFD);flags |= FD_CLOEXEC;fcntl(s, F_SETFD, flags);/* Save */tcgetattr(s, old_tios);memset(&tios, 0, sizeof(struct termios));/* C_ISPEED     Input baud (new interface)C_OSPEED     Output baud (new interface)*/switch (baud) {case 110:speed = B110;break;case 300:speed = B300;break;case 600:speed = B600;break;case 1200:speed = B1200;break;case 2400:speed = B2400;break;case 4800:speed = B4800;break;case 9600:speed = B9600;break;case 19200:speed = B19200;break;case 38400:speed = B38400;break;
#ifdef B57600case 57600:speed = B57600;break;
#endif
#ifdef B115200case 115200:speed = B115200;break;
#endif
#ifdef B230400case 230400:speed = B230400;break;
#endif
#ifdef B460800case 460800:speed = B460800;break;
#endif
#ifdef B500000case 500000:speed = B500000;break;
#endif
#ifdef B576000case 576000:speed = B576000;break;
#endif
#ifdef B921600case 921600:speed = B921600;break;
#endif
#ifdef B1000000case 1000000:speed = B1000000;break;
#endif
#ifdef B1152000case 1152000:speed = B1152000;break;
#endif
#ifdef B1500000case 1500000:speed = B1500000;break;
#endif
#ifdef B2500000case 2500000:speed = B2500000;break;
#endif
#ifdef B3000000case 3000000:speed = B3000000;break;
#endif
#ifdef B3500000case 3500000:speed = B3500000;break;
#endif
#ifdef B4000000case 4000000:speed = B4000000;break;
#endifdefault:speed = B9600;LOG_W("WARNING Unknown baud rate %d for %s (B9600 used)", baud, device);}/* Set the baud rate */if ((cfsetispeed(&tios, speed) < 0) ||(cfsetospeed(&tios, speed) < 0)) {close(s);s = -1;return -1;}/* C_CFLAG      Control optionsCLOCAL       Local line - do not change "owner" of portCREAD        Enable receiver*/tios.c_cflag |= (CREAD | CLOCAL);/* CSIZE, HUPCL, CRTSCTS (hardware flow control) *//* Set data bits (5, 6, 7, 8 bits)CSIZE        Bit mask for data bits*/tios.c_cflag &= ~CSIZE;switch (data_bit) {case 5:tios.c_cflag |= CS5;break;case 6:tios.c_cflag |= CS6;break;case 7:tios.c_cflag |= CS7;break;case 8:default:tios.c_cflag |= CS8;break;}/* Stop bit (1 or 2) */if (stop_bit == 1)tios.c_cflag &= ~CSTOPB;else /* 2 */tios.c_cflag |= CSTOPB;/* PARENB       Enable parity bitPARODD       Use odd parity instead of even */if (parity == 'N') {/* None */tios.c_cflag &= ~PARENB;} else if (parity == 'E') {/* Even */tios.c_cflag |= PARENB;tios.c_cflag &= ~PARODD;} else {/* Odd */tios.c_cflag |= PARENB;tios.c_cflag |= PARODD;}/* Read the man page of termios if you need more information. *//* This field isn't used on POSIX systemstios.c_line = 0;*//* C_LFLAG      Line optionsISIG Enable SIGINTR, SIGSUSP, SIGDSUSP, and SIGQUIT signalsICANON       Enable canonical input (else raw)XCASE        Map uppercase \lowercase (obsolete)ECHO Enable echoing of input charactersECHOE        Echo erase character as BS-SP-BSECHOK        Echo NL after kill characterECHONL       Echo NLNOFLSH       Disable flushing of input buffers afterinterrupt or quit charactersIEXTEN       Enable extended functionsECHOCTL      Echo control characters as ^char and delete as ~?ECHOPRT      Echo erased character as character erasedECHOKE       BS-SP-BS entire line on line killFLUSHO       Output being flushedPENDIN       Retype pending input at next read or input charTOSTOP       Send SIGTTOU for background outputCanonical input is line-oriented. Input characters are putinto a buffer which can be edited interactively by the useruntil a CR (carriage return) or LF (line feed) character isreceived.Raw input is unprocessed. Input characters are passedthrough exactly as they are received, when they arereceived. Generally you'll deselect the ICANON, ECHO,ECHOE, and ISIG options when using raw input*//* Raw input */tios.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);/* C_IFLAG      Input optionsConstant     DescriptionINPCK        Enable parity checkIGNPAR       Ignore parity errorsPARMRK       Mark parity errorsISTRIP       Strip parity bitsIXON Enable software flow control (outgoing)IXOFF        Enable software flow control (incoming)IXANY        Allow any character to start flow againIGNBRK       Ignore break conditionBRKINT       Send a SIGINT when a break condition is detectedINLCR        Map NL to CRIGNCR        Ignore CRICRNL        Map CR to NLIUCLC        Map uppercase to lowercaseIMAXBEL      Echo BEL on input line too long*/if (parity == 'N') {/* None */tios.c_iflag &= ~INPCK;} else {tios.c_iflag |= INPCK;}/* Software flow control is disabled */tios.c_iflag &= ~(IXON | IXOFF | IXANY);/* C_OFLAG      Output optionsOPOST        Postprocess output (not set = raw output)ONLCR        Map NL to CR-NLONCLR ant others needs OPOST to be enabled*//* Raw ouput */tios.c_oflag &= ~OPOST;/* C_CC         Control charactersVMIN         Minimum number of characters to readVTIME        Time to wait for data (tenths of seconds)UNIX serial interface drivers provide the ability tospecify character and packet timeouts. Two elements of thec_cc array are used for timeouts: VMIN and VTIME. Timeoutsare ignored in canonical input mode or when the NDELAYoption is set on the file via open or fcntl.VMIN specifies the minimum number of characters to read. Ifit is set to 0, then the VTIME value specifies the time towait for every character read. Note that this does not meanthat a read call for N bytes will wait for N characters tocome in. Rather, the timeout will apply to the firstcharacter and the read call will return the number ofcharacters immediately available (up to the number yourequest).If VMIN is non-zero, VTIME specifies the time to wait forthe first character read. If a character is read within thetime given, any read will block (wait) until all VMINcharacters are read. That is, once the first character isread, the serial interface driver expects to receive anentire packet of characters (VMIN bytes total). If nocharacter is read within the time allowed, then the call toread returns 0. This method allows you to tell the serialdriver you need exactly N bytes and any read call willreturn 0 or N bytes. However, the timeout only applies tothe first character read, so if for some reason the drivermisses one character inside the N byte packet then the readcall could block forever waiting for additional inputcharacters.VTIME specifies the amount of time to wait for incomingcharacters in tenths of seconds. If VTIME is set to 0 (thedefault), reads will block (wait) indefinitely unless theNDELAY option is set on the port with open or fcntl.*//* Unused because we use open with the NDELAY option */tios.c_cc[VMIN] = 0;tios.c_cc[VTIME] = 0;if (tcsetattr(s, TCSANOW, &tios) < 0) {close(s);s = -1;return -1;}/***************************/int portfd;#if (__GNUC__ == 4 && __GNUC_MINOR__ == 3)struct my_serial_rs485 rs485conf;struct my_serial_rs485 rs485conf_bak;
#elsestruct serial_rs485 rs485conf;//struct serial_rs485 rs485conf_bak;
#endif	//struct termios newtios,oldtios; /*termianal settings */portfd=s;
/*get serial port parnms,save away */// tcgetattr(portfd,&newtios);// memcpy(&oldtios,&newtios,sizeof newtios);// /* configure new values */// cfmakeraw(&newtios); /*see man page */// newtios.c_iflag |=IGNPAR; /*ignore parity on input */// newtios.c_oflag &= ~(OPOST | ONLCR | OLCUC | OCRNL | ONOCR | ONLRET | OFILL); // newtios.c_cflag = CS8 | CLOCAL | CREAD;// newtios.c_cc[VMIN]=1; /* block until 1 char received */// newtios.c_cc[VTIME]=0; /*no inter-character timer *//* 115200 bps */// cfsetospeed(&newtios,B9600);// cfsetispeed(&newtios,B9600);// /* register cleanup stuff */// atexit(reset_tty_atexit);// memset(&sa,0,sizeof sa);// sa.sa_handler = reset_tty_handler;// sigaction(SIGHUP,&sa,NULL);// sigaction(SIGINT,&sa,NULL);// sigaction(SIGPIPE,&sa,NULL);// sigaction(SIGTERM,&sa,NULL);// /*apply modified termios */// saved_portfd=portfd;// tcflush(portfd,TCIFLUSH);// tcsetattr(portfd,TCSADRAIN,&newtios);if (ioctl (portfd, TIOCGRS485, &rs485conf) < 0) {/* Error handling.*/ printf("ioctl TIOCGRS485 error.\n");}/* Enable RS485 mode: */rs485conf.flags |= SER_RS485_ENABLED;/* Set logical level for RTS pin equal to 1 when sending: */rs485conf.flags |= SER_RS485_RTS_ON_SEND;//rs485conf.flags |= SER_RS485_RTS_AFTER_SEND;/* set logical level for RTS pin equal to 0 after sending: */ rs485conf.flags &= ~(SER_RS485_RTS_AFTER_SEND);//rs485conf.flags &= ~(SER_RS485_RTS_ON_SEND);/* Set rts delay after send, if needed: */rs485conf.delay_rts_after_send = 0x80;if (ioctl (portfd, TIOCSRS485, &rs485conf) < 0){/* Error handling.*/ printf("ioctl TIOCSRS485 error.\n");}else{printf("rs485conf.flags 0x%x.\n", rs485conf.flags);printf("rs485conf.delay_rts_before_send 0x%x.\n", rs485conf.delay_rts_before_send);printf("rs485conf.delay_rts_after_send 0x%x.\n", rs485conf.delay_rts_after_send);}/****************************/return s;
}void serial_close(int s, struct termios *old_tios)
{if (s != -1) {tcsetattr(s, TCSANOW, old_tios);close(s);}
}int serial_send(int s, const uint8_t *buf, int length)
{return write(s, buf, length);
}int serial_receive(int s, uint8_t *buf, int bufsz, int timeout)
{int len = 0;int rc = 0;fd_set rset;struct timeval tv;while (bufsz > 0) {FD_ZERO(&rset);FD_SET(s, &rset);tv.tv_sec = timeout / 1000;tv.tv_usec = (timeout % 1000) * 1000;rc = select(s + 1, &rset, NULL, NULL, &tv);if (rc == -1) {if (errno == EINTR)continue;}if (rc <= 0) {break;}rc = read(s, buf + len, bufsz);if (rc <= 0) {break;}len += rc;bufsz -= rc;timeout = 20;}if (rc >= 0) {rc = len;}return rc;
}int serial_flush(int s)
{if (s != -1) {tcflush(s, TCIOFLUSH);}return 0;
}

五、编译验证

将修改后的代码进行交叉编译,并下载到开发板。
打开测试软件,启动程序。
软件通信日志部分:
在这里插入图片描述
开发板串口打印信息:
在这里插入图片描述
程序能能够通过rs485正常获取到modbus数据。

这篇关于nuc980开发板使用Agile Modbus软件包-基于 rs485 通讯的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/540604

相关文章

中文分词jieba库的使用与实景应用(一)

知识星球:https://articles.zsxq.com/id_fxvgc803qmr2.html 目录 一.定义: 精确模式(默认模式): 全模式: 搜索引擎模式: paddle 模式(基于深度学习的分词模式): 二 自定义词典 三.文本解析   调整词出现的频率 四. 关键词提取 A. 基于TF-IDF算法的关键词提取 B. 基于TextRank算法的关键词提取

使用SecondaryNameNode恢复NameNode的数据

1)需求: NameNode进程挂了并且存储的数据也丢失了,如何恢复NameNode 此种方式恢复的数据可能存在小部分数据的丢失。 2)故障模拟 (1)kill -9 NameNode进程 [lytfly@hadoop102 current]$ kill -9 19886 (2)删除NameNode存储的数据(/opt/module/hadoop-3.1.4/data/tmp/dfs/na

Hadoop数据压缩使用介绍

一、压缩原则 (1)运算密集型的Job,少用压缩 (2)IO密集型的Job,多用压缩 二、压缩算法比较 三、压缩位置选择 四、压缩参数配置 1)为了支持多种压缩/解压缩算法,Hadoop引入了编码/解码器 2)要在Hadoop中启用压缩,可以配置如下参数

Makefile简明使用教程

文章目录 规则makefile文件的基本语法:加在命令前的特殊符号:.PHONY伪目标: Makefilev1 直观写法v2 加上中间过程v3 伪目标v4 变量 make 选项-f-n-C Make 是一种流行的构建工具,常用于将源代码转换成可执行文件或者其他形式的输出文件(如库文件、文档等)。Make 可以自动化地执行编译、链接等一系列操作。 规则 makefile文件

使用opencv优化图片(画面变清晰)

文章目录 需求影响照片清晰度的因素 实现降噪测试代码 锐化空间锐化Unsharp Masking频率域锐化对比测试 对比度增强常用算法对比测试 需求 对图像进行优化,使其看起来更清晰,同时保持尺寸不变,通常涉及到图像处理技术如锐化、降噪、对比度增强等 影响照片清晰度的因素 影响照片清晰度的因素有很多,主要可以从以下几个方面来分析 1. 拍摄设备 相机传感器:相机传

pdfmake生成pdf的使用

实际项目中有时会有根据填写的表单数据或者其他格式的数据,将数据自动填充到pdf文件中根据固定模板生成pdf文件的需求 文章目录 利用pdfmake生成pdf文件1.下载安装pdfmake第三方包2.封装生成pdf文件的共用配置3.生成pdf文件的文件模板内容4.调用方法生成pdf 利用pdfmake生成pdf文件 1.下载安装pdfmake第三方包 npm i pdfma

零基础学习Redis(10) -- zset类型命令使用

zset是有序集合,内部除了存储元素外,还会存储一个score,存储在zset中的元素会按照score的大小升序排列,不同元素的score可以重复,score相同的元素会按照元素的字典序排列。 1. zset常用命令 1.1 zadd  zadd key [NX | XX] [GT | LT]   [CH] [INCR] score member [score member ...]

git使用的说明总结

Git使用说明 下载安装(下载地址) macOS: Git - Downloading macOS Windows: Git - Downloading Windows Linux/Unix: Git (git-scm.com) 创建新仓库 本地创建新仓库:创建新文件夹,进入文件夹目录,执行指令 git init ,用以创建新的git 克隆仓库 执行指令用以创建一个本地仓库的

【北交大信息所AI-Max2】使用方法

BJTU信息所集群AI_MAX2使用方法 使用的前提是预约到相应的算力卡,拥有登录权限的账号密码,一般为导师组共用一个。 有浏览器、ssh工具就可以。 1.新建集群Terminal 浏览器登陆10.126.62.75 (如果是1集群把75改成66) 交互式开发 执行器选Terminal 密码随便设一个(需记住) 工作空间:私有数据、全部文件 加速器选GeForce_RTX_2080_Ti

【Linux 从基础到进阶】Ansible自动化运维工具使用

Ansible自动化运维工具使用 Ansible 是一款开源的自动化运维工具,采用无代理架构(agentless),基于 SSH 连接进行管理,具有简单易用、灵活强大、可扩展性高等特点。它广泛用于服务器管理、应用部署、配置管理等任务。本文将介绍 Ansible 的安装、基本使用方法及一些实际运维场景中的应用,旨在帮助运维人员快速上手并熟练运用 Ansible。 1. Ansible的核心概念