完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
大家好,
首先,这是我第一次和PSoC creator或任何CyPress PSoC设备玩。我真的很惊讶:难以置信。 由于这些天我有一些空闲时间,我决定学习UC编程的方式。所以… 我在炫耀一些LED。我看到有可能把插针作为一个很好的端口。但是从数组中访问它们是可能的吗? 在我的代码下面。先谢谢你。 /* * *版权所有你的公司,年度 *保留所有权利 *未发布的、许可的软件。 * *机密和专有信息 这是你们公司的财产。 * *助学贷款 */ 包括“项目H” 包括“CyPIN。h” INTRAIL〔4〕={LeDy1Y0,LeDy111,LeDy1Y2,LeDy113}; 主(空) { CyGloalActuabess;/*启用全局中断。*/ *将初始化/启动代码放在此处(例如MyStimSistAd())*/ (;) { 对于(int i=1;i & lt;16;i++){ LeDy1x写(I); CyTeles(1000); } 对于(int i=1;i & lt;4;i++){ 金丝桃素?); CyTeles(1000); } *将您的应用程序代码放在这里。*/ } } /*[]文件结束*/ 以上来自于百度翻译 以下为原文 Hello everyone, First of all this my first time playing with PSoC creator or with any Cypress PSoC device. And i am really amazed: it's incredible. Since I have some free time these days I decided to learn about the way that this uC are programmed. So... I am blinking some leds. I saw that it's possible to access pins as a port which is quite nice. But is it possible to access them from an array? Below my code. Thank you in advance. /* ======================================== * * Copyright YOUR COMPANY, THE YEAR * All Rights Reserved * UNPUBLISHED, LICENSED SOFTWARE. * * CONFIDENTIAL AND PROPRIETARY INFORMATION * WHICH IS THE PROPERTY OF your company. * * ======================================== */ #include "project.h" #include "cypins.h" int array[4]={LED_1_0,LED_1_1,LED_1_2,LED_1_3}; int main(void) { CyGlobalIntEnable; /* Enable global interrupts. */ /* Place your initialization/startup code here (e.g. MyInst_Start()) */ for(;;) { for(int i=1;i<16;i++){ LED_1_Write(i); CyDelay(1000); } for(int i=1;i<4;i++){ CyPins_SetPin(??); CyDelay(1000); } /* Place your application code here. */ } } /* [] END OF FILE */ |
|
相关推荐
4个回答
|
|
|
不是直接的。您可以使用数组来将函数指针存储到相应的PixStand()函数。参见HTTPS://www. cDealgn.COM/Tutoal/PosioPosith.HTML
在PSoC5上,您可以使用ARM位带功能(它允许通过写入特定的内存位置来设置/重置单个位),但是这些引脚都应该属于同一个端口。 以上来自于百度翻译 以下为原文 Not directly. You can use an array to store function pointers to the respective Pin_Set() functions. See https://www.cprogramming.com/tutorial/function-pointers.html On a PSoC5 you could use the ARM BitBanding functionality (which allows to set/reset single bits by writing into a specific memory location), but then the pins should all belong to the same port. |
|
|
|
|
|
我一直在尝试使用PSoC 5的函数指针。到目前为止,我还没有让他们工作。你们能给我举个例子吗?这就是我所遵守的。但它仍然不起作用。我已经尝试了其他的东西,在这个文件中HTTP://wwwyCysCy.Mo/Fiel/59071/Access没有任何运气。
/ /定义 TyPulf无效const *(WrreEnPixon(空格)); WordNo.Pixon *PIN〔4〕={ &pin_1_on, &pin_2_on, &pin_3_on, &pin_4_on, }; //函数调用 (*(PIN〔0〕); 以上来自于百度翻译 以下为原文 I have been trying to work with function pointers with the PSoC 5. So far I haven't got them to work. Can you guys give me an example of how you did it? This is what I have that complies. But it still doesn't work. I have tried other things metioned in this document http://www.cypress.com/file/59071/download without any luck. //definition typedef void const *(Write_pin_on(void)); Write_pin_on *pins[4]= { &pin_1_on, &pin_2_on, &pin_3_on, &pin_4_on, }; //function call (*(pins[0])); |
|
|
|
|
jionging 发表于 2018-11-23 10:26 语法有点不同,请参见这里… 鲍勃 以上来自于百度翻译 以下为原文 Syntax is a bit different,see here... Bob |
|
|
|
|
|
是的,我刚刚明白了。我要重播,说我在括号里搞乱了该怎么做。但我明白了。谢谢你的回复 以上来自于百度翻译 以下为原文 yeah, I just figured it out. I was going to replay and say I messed up on the parentheses on how to do it. But I got it. Thanks for the reply |
|
|
|
|
只有小组成员才能发言,加入小组>>
786个成员聚集在这个小组
加入小组cyUSB3014一直显示2.1,不能到3.0情况,谁遇到过
7255 浏览 0 评论
2482 浏览 1 评论
2176 浏览 1 评论
4037 浏览 1 评论
请问可以直接使用来自FX2LP固件的端点向主机FIFO写入数据吗?
2082 浏览 6 评论
CY8C4025LQI在程序中调用函数,通过示波器观察SCL引脚波形,无法将pin0.4(SCL)下拉是什么原因导致?
7761浏览 2评论
CYUSB3065焊接到USB3.0 TYPE-B口的焊接触点就无法使用是什么原因导致的?
6320浏览 2评论
CX3连接Camera修改分辨率之后,播放器无法播出camera的画面怎么解决?
753浏览 2评论
726浏览 2评论
使用stm32+cyw43438 wifi驱动whd,WHD驱动固件加载失败的原因?
8154浏览 2评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-10 04:34 , Processed in 0.805848 second(s), Total 78, Slave 61 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
2492