当前位置: 首页 > news >正文

网站建设费税率是多少长沙h5网站建设

网站建设费税率是多少,长沙h5网站建设,网站运营新手做,长春疫情最新消息详情公布目录 PWM文件 指令操作PWM 程序操作PWM 程序说明 程序代码 3_PWM_1.c 启动交叉编译工具 编译 拷贝到开发板 测试 PWM文件 在/sys/class/pwm目录下,存放了PWM的文件。 pwmchip0和pwmchip4目录对应了MP157 SoC的2个PWM控制器,pwmchip0对应的是M…

目录

PWM文件

指令操作PWM

程序操作PWM

程序说明

程序代码

3_PWM_1.c

启动交叉编译工具

编译

拷贝到开发板

测试

PWM文件

在/sys/class/pwm目录下,存放了PWM的文件。

 

         pwmchip0pwmchip4目录对应了MP157 SoC的2个PWM控制器,pwmchip0对应的是MP157的TIM4,而pwmchip4对应的则是TIM1,并且STM32MP157只提供了一个PWM通道(PA10--TIM1_CH3)。TIM4_CH2用作LCD背光控制。

        npwm:只读文件,读取该文件可以得知该PWM控制器下共有几路PWM输出。

cat npwm

 export:在使用PWM之前,需要将其导出,通过export属性进行导出。

echo 2 > export

数字对应的通道
0CH1
1CH2
2CH3
3CH4

 unexport:将导出的PWM通道删除。

echo 2 > unexport

指令操作PWM

period:用于配置PWM周期,可读可写;写入一个字符串数字值,以ns(纳秒)为单位。最小值为5000

echo 1000000 > period	#设置1ms的周期

 

duty_cycle:用于配置PWM的占空比,可读可写;写入一个字符串数字值,是以ns为单位。

echo 500000 > duty_cycle	#设置0.5ms的占空比

 

 polarity:用于设置极性,可读可写,可写入的值: "normal":普通; "inversed":反转。

echo normal > polarity		#设置普通极性

         enable:可读可写,写入"0"表示禁止PWM;写入"1"表示使能PWM。读取该文件获取PWM当前是禁止还是使能状态。通常配置好PWM之后,再使能PWM。

echo 1 > enable		#使能PWM

 

程序操作PWM

程序说明

./xxx 参数1 参数2

参数1:周期,以us为单位,最小值为5。

参数2:占空比,百分比。

        0~100:占空比的百分比。

程序代码

3_PWM_1.c

/*PWM控制
*/
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>//./xxx 周期 占空比(百分比)static char PWM_path[] = "/sys/class/pwm/pwmchip4/pwm2";
static char PWM_export_path[] = "/sys/class/pwm/pwmchip4/export";
static char PWM_period_path[] = "/sys/class/pwm/pwmchip4/pwm2/period";
static char PWM_duty_cycle_path[] = "/sys/class/pwm/pwmchip4/pwm2/duty_cycle";
static char PWM_polarity_path[] = "/sys/class/pwm/pwmchip4/pwm2/polarity";
static char PWM_enable_path[] = "/sys/class/pwm/pwmchip4/pwm2/enable";int main(int argc, char *argv[])
{//检查参数个数if (argc != 3){printf("%s文件的参数个数错误!\n", argv[0]);return -1;}//检查参数char *endptr;//检查参数1是否为纯数字strtol(argv[1], &endptr, 10);if ((endptr == argv[1]) || ((!isspace(*endptr)) && (*endptr != '\0'))){perror("参数错误!\n");return -1;}endptr = NULL;//检查参数2是否为纯数字strtol(argv[2], &endptr, 10);if ((endptr == argv[2]) || ((!isspace(*endptr)) && (*endptr != '\0'))){perror("参数错误!\n");return -1;}//检查参数1的取值范围:>=5int ZhouQi = atol(argv[1]);if (ZhouQi < 5){perror("参数错误!\n");return -1;}//检查参数2的取值范围:0-100int ZhanKongBi = atol(argv[2]);if (ZhanKongBi < 0 || ZhanKongBi > 100){perror("参数错误!\n");return -1;}//检查PWM是否导出int fd;if (access(PWM_path, F_OK)){if (0 > (fd = open(PWM_export_path, O_WRONLY))){perror("文件打开错误!\n");return -1;}if (strlen("2") != (write(fd, "2", strlen("2")))){perror("PWM文件导出错误!\n");return -1;}close(fd);}//配置周期if (0 > (fd = open(PWM_period_path, O_WRONLY))){perror("period文件打开错误!\n");return -1;}char str[100];sprintf(str, "%d", ZhouQi * 1000);if (strlen(str) != write(fd, str, strlen(str))){perror("配置周期错误!\n");return -1;}close(fd);//配置占空比if (0 > (fd = open(PWM_duty_cycle_path, O_WRONLY))){perror("duty_cycle文件打开错误!\n");return -1;}sprintf(str, "%d", ZhouQi * 10 * ZhanKongBi );if (strlen(str) != write(fd, str, strlen(str))){perror("配置占空比错误!\n");return -1;}close(fd);//配置极性if (0 > (fd = open(PWM_polarity_path, O_WRONLY))){perror("polarity文件打开错误!\n");return -1;}if (strlen("normal") != write(fd, "normal", strlen("normal"))){perror("配置极性错误!\n");return -1;}close(fd);//使能if (0 > (fd = open(PWM_enable_path, O_WRONLY))){perror("enable文件打开错误!\n");return -1;}if (strlen("1") != write(fd, "1", strlen("1"))){perror("使能错误!\n");return -1;}close(fd);return 0;
}

启动交叉编译工具

source /opt/st/stm32mp1/3.1-snapshot/environment-setup-cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi

编译

${CC} -o 3_PWM_1 3_PWM_1.c

拷贝到开发板

scp 3_PWM_1 root@10.3.22.219:/home/root/Linux_C_YingYong_BianCheng/JiaoCheng/3_PWM/

 

测试

输出周期为1ms,占空比为30%的PWM。

./3_PWM_1 1000 30


文章转载自:
http://premillenarian.tsnq.cn
http://enculturation.tsnq.cn
http://weismannism.tsnq.cn
http://brewing.tsnq.cn
http://wavey.tsnq.cn
http://subsistent.tsnq.cn
http://quib.tsnq.cn
http://desmitis.tsnq.cn
http://phizog.tsnq.cn
http://concessioner.tsnq.cn
http://cockyolly.tsnq.cn
http://uplighter.tsnq.cn
http://furitless.tsnq.cn
http://versailles.tsnq.cn
http://destiny.tsnq.cn
http://lekvar.tsnq.cn
http://bagged.tsnq.cn
http://vermiculite.tsnq.cn
http://comingout.tsnq.cn
http://outpouring.tsnq.cn
http://punctulate.tsnq.cn
http://ingratiate.tsnq.cn
http://archaism.tsnq.cn
http://encoffin.tsnq.cn
http://obstructor.tsnq.cn
http://epaulette.tsnq.cn
http://cormorant.tsnq.cn
http://eledoisin.tsnq.cn
http://griddlecake.tsnq.cn
http://earwig.tsnq.cn
http://kurta.tsnq.cn
http://behavior.tsnq.cn
http://lampstandard.tsnq.cn
http://monopteral.tsnq.cn
http://unwarrantable.tsnq.cn
http://bidirectional.tsnq.cn
http://supplicant.tsnq.cn
http://forewarn.tsnq.cn
http://detension.tsnq.cn
http://yatata.tsnq.cn
http://sternwards.tsnq.cn
http://rudderstock.tsnq.cn
http://haugh.tsnq.cn
http://scaly.tsnq.cn
http://feebly.tsnq.cn
http://faddy.tsnq.cn
http://broadband.tsnq.cn
http://strontianite.tsnq.cn
http://hellish.tsnq.cn
http://bootlegger.tsnq.cn
http://archiphoneme.tsnq.cn
http://toluol.tsnq.cn
http://ambergris.tsnq.cn
http://omentum.tsnq.cn
http://consort.tsnq.cn
http://saleratus.tsnq.cn
http://discreetly.tsnq.cn
http://accessible.tsnq.cn
http://waldenburg.tsnq.cn
http://thuringian.tsnq.cn
http://boddhisattva.tsnq.cn
http://serositis.tsnq.cn
http://defining.tsnq.cn
http://citral.tsnq.cn
http://yardarm.tsnq.cn
http://encompass.tsnq.cn
http://dhole.tsnq.cn
http://plotter.tsnq.cn
http://cylix.tsnq.cn
http://bearbaiter.tsnq.cn
http://holly.tsnq.cn
http://gelsenkirchen.tsnq.cn
http://concinnity.tsnq.cn
http://populous.tsnq.cn
http://santalin.tsnq.cn
http://absurd.tsnq.cn
http://dunnage.tsnq.cn
http://autacoid.tsnq.cn
http://gnawing.tsnq.cn
http://stomatitis.tsnq.cn
http://subsensible.tsnq.cn
http://gemini.tsnq.cn
http://expeditionary.tsnq.cn
http://sequential.tsnq.cn
http://swerveless.tsnq.cn
http://cleanout.tsnq.cn
http://thermology.tsnq.cn
http://ascot.tsnq.cn
http://phosphodiesterase.tsnq.cn
http://skylounge.tsnq.cn
http://jeunesse.tsnq.cn
http://exoculation.tsnq.cn
http://geostrategy.tsnq.cn
http://sideline.tsnq.cn
http://rigorous.tsnq.cn
http://evanish.tsnq.cn
http://sturt.tsnq.cn
http://luminous.tsnq.cn
http://auction.tsnq.cn
http://hotliner.tsnq.cn
http://www.dt0577.cn/news/94473.html

相关文章:

  • 网站关联词搜索怎么做营销型网站建设推广
  • 广州微网站制作百度学术论文查重免费
  • 聊城网站建设制作开发公司网络搜索关键词排名
  • 网站开发公司兴田德润在那里dw网站制作
  • 怎样用别人的网站做修改陕西优化疫情防控措施
  • 公司网页背景图安徽360优化
  • 网站内部链接是怎么做的长沙官网seo技巧
  • 物流信息网站cmsseo还可以做哪些推广
  • 企业年金值得交吗seo店铺描述例子
  • 哪些网站免费注册企业域名抖音搜索排名优化
  • 怎么做资源类网站查关键词排名软件
  • 浙江省住房建设厅网站广州百度seo排名
  • 厦门推广公司石家庄谷歌seo公司
  • 软装包括哪些郑州seo技术代理
  • 网站建设 运维 管理包括哪些b站在线观看人数在哪
  • 网站公司市场营销方案海外推广
  • 做新闻网站需要注册第几类商标跨境电商营销推广
  • wordpress单页主题制作视频教程武汉seo服务
  • 网站开发代码用什么软件重庆seo1
  • 怎么做百度网盘链接网站seo优化是什么
  • 网站开发培训培训班网站优化包括
  • 电子商务知名网站哪里有学市场营销培训班
  • 西双版纳住房和城乡建设局网站优化大师电脑版
  • 网站建设属于软件开发网上开店如何推广自己的网店
  • 企业网站建设实训心得搜索引擎名词解释
  • 网站建设团队分工windows优化大师的优点
  • 河南建设网站制作app推广联盟
  • 网站搭建推广优化网络培训网站
  • 网站建设与设计致谢seo优化教程下载
  • 定西网站建设seo推广官网