完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
你好,
附加代码演示了如何在UART ISR内部接收接收到的数据。需要在PD 5.3上执行以下步骤。 1。创建一个自定义的UART用户模块。对于该选择工具-gt;用户模块定制向导。选择用户模块并按下复制。一旦创建了自定义用户模块,从存储模块的文件夹中打开UARtiTEN.ASM文件的模板。 2。在UARTITEN.ASM模板文件末尾的ReTI指令之前粘贴下面的标记区域。 @ pSoCuSuuleCoDeBoyYy3@(不要改变这条线)。 -------------------------------------------- 在这个横幅下面插入自定义汇编代码 -------------------------------------------- 注意:中断服务例程必须保存 A和X CPU的值寄存器。 -------------------------------------------- 在这个横幅上方插入自定义汇编代码 -------------------------------------------- -------------------------------------------- 在这个横幅下面插入一个C函数 不评论这些横幅之间的界线 -------------------------------------------- 保存上下文 Lael-YyMycCl函数 恢复上下文 -------------------------------------------- 将LCALL插入横跨该横幅的C函数 不评论这些横幅之间的界线 -------------------------------------------- @ pSoCuxUsCoEdEdEd@(不要改变这条线)。 三。放置自定义用户模块,生成项目并打开UARTITEN.ASM文件。 4。取消评论 保存上下文 Lael-Y-MycCl函数 恢复上下文 5。在My.C中定义函数Myycx函数,并读取函数内部的接收数据。 为方便起见,请附上项目。谢谢您。 当做, 凯瑟西 以上来自于百度翻译 以下为原文 Hi, Attached code demonstrates how to take the recived data inside UART ISR. Following steps needs to be performed on PD 5.3 for the same. 1. Create a custom UART user module. For that select Tools->User Module Customization Wizard. Select the User module and press Copy. Once the custom user module is created open the template of UARTINT.asm file from the folder where the module is stored. 2. Paste the following marker area just before the reti instruction that is present in the end of UARTINT.asm template file. ;@PSoC_UserCode_BODY_3@ (Do not change this line.) ;--------------------------------------------------- ; Insert your custom assembly code below this banner ;--------------------------------------------------- ; NOTE: interrupt service routines must preserve ; the values of the A and X CPU registers. ;--------------------------------------------------- ; Insert your custom assembly code above this banner ;--------------------------------------------------- ;--------------------------------------------------- ; Insert a lcall to a C function below this banner ; and un-comment the lines between these banners ;--------------------------------------------------- ;PRESERVE_CPU_CONTEXT ;lcall _My_C_Function ;RESTORE_CPU_CONTEXT ;--------------------------------------------------- ; Insert a lcall to a C function above this banner ; and un-comment the lines between these banners ;--------------------------------------------------- ;@PSoC_UserCode_END@ (Do not change this line.) 3. Place the custom user module,Build the project and open UARTINT.asm file. 4. Uncomment the lines PRESERVE_CPU_CONTEXT lcall _My_C_Function RESTORE_CPU_CONTEXT 5. Define the function My_C_Function in the main.c and read the received data inside the function. Please find attached project for your convenience. Thank you. Regards, Keerthy |
|
相关推荐
6个回答
|
|
|
没有附加项目,在安装文件时使用MS Internet Explorer。另外,仅在.ASM文件中考虑常规名称的主要下划线。鲍伯(又有一扇小窗户)
以上来自于百度翻译 以下为原文 No project attached, use ms internet explorer when attaching a file. Additionally: Regard the leading underscore of the routine-name only in the .asm-file. Bob (with a small window again) |
|
|
|
|
|
鲍伯,附件是这个项目。问候,Keerthy
UARTHYRXTIN V1.ZIP 268.1 K 以上来自于百度翻译 以下为原文 Bob, Attached is the project. Regards, Keerthy
|
|
|
|
|
|
一种可以节省一些宝贵的堆栈和CPU使用的方法是:
用Y-AptruMMA指令声明中断处理程序 不要取消保存和恢复宏的注释 不要“调用”你的处理程序,而是插入一个“LjMP-MyycCI函数”。 在处理程序MyAcCyMulk()中避免调用任何其他函数。 这样,您的处理程序本身就是一个中断例程,编译器只将需要的数据推送到堆栈上,这样可以提高性能。 鲍勃 以上来自于百度翻译 以下为原文 A method that can save some of the precious stack and CPU-usage is: Declare your interrupt handler with the #pragma directive Do not uncomment the PRESERVE and RESTORE-macros Do not "LCALL" your handler, but insert a "LJMP _My_C_Function" Within the handler My_C_Function() avoid calling any other functions. This way your handler is an interrupt routine itself and the compiler will push only the needed data onto the stack which can increase performance. Bob |
|
|
|
|
|
当然,使用LyPrApMARMA指令的“LJMP”具有ISR执行时间栈保存和减少的优点。
但有一种情况,我们可能不得不使用“LCALL”可能是这样的: PSOC设计器中的一些用户模块中断ASM文件即使在用户代码标记区域之后也有一些代码。 在这样的文件中,当调用C.中定义的例程时,可能需要使用“LCALL”(以及CPU寄存器的保存/恢复)。 这是因为“LJMP”会导致在C例程之后中断中断(由于放置了γ-语用中断处理程序的“ReTI”指令),这意味着用户模块ASM文件中的“LJMP”的代码不会被执行,导致意外的操作。用户模块的离子。 即使在用户代码标记区域之后有代码的文件的例子:ADCIMVR的中断ASM文件,当“RX命令缓冲区”启用时,UART的中断ASM文件。 谢谢和问候, 普雷姆赛 以上来自于百度翻译 以下为原文 Certainly using "ljmp" with #pragma directive has the advantages of stack-save and reduction in ISR execution time. But one situation where we may have to use "lcall" is possibly this: A few user module interrupt asm files of PSoC Designer have some code even after the user code marker area. In such files, we may have to use "lcall"(along with preserve/restore of CPU registers) when calling routines defined in C. This is because "ljmp" would result in jumping straight out of the interrupt after the C routine(due to the "reti" instruction placed the #pragma interrupt handler), and this would mean that the code following the "ljmp" in the user module asm file would not be executed, leading to unexpected operation of the user module. Examples of files where there is code even after the user code marker area: ADCINCVR's interrupt asm file, UART's interrupt asm file when "Rx command buffer" is enabled etc. Thanks & Regards, Prem Sai |
|
|
|
|
|
这是一种改变ISR行为的方法。这是通过调用另一个函数在用户模块ISR做。调用的函数在一个ISR不需要中断处理程序。
以上来自于百度翻译 以下为原文 This is a method of altering the behaviour of an ISR. This is done by calling another function from within the User Module ISR. The function that is called from within an ISR need not be an interrupt handler. |
|
|
|
|
|
上一篇文章晚了一点,但是…
当你从中断处理程序中调用另一个例程时,图像& GT;Fielt编译器无法评估从该例程中使用哪些寄存器。因此,在进入处理程序时,所有寄存器将被推到占用MIPS和RAM的(小)堆栈上。 鲍勃 以上来自于百度翻译 以下为原文 A bit late that last post, but... When you call another routine from within your interrupt handler, the Image>Craft-Compiler is not able to evaluate which registers are used from within that routine. So at entry into the handler all registers will be pushed onto the (small) stack consuming MIPS and RAM. Bob |
|
|
|
|
只有小组成员才能发言,加入小组>>
787个成员聚集在这个小组
加入小组cyUSB3014一直显示2.1,不能到3.0情况,谁遇到过
7297 浏览 0 评论
2484 浏览 1 评论
2178 浏览 1 评论
4041 浏览 1 评论
请问可以直接使用来自FX2LP固件的端点向主机FIFO写入数据吗?
2086 浏览 6 评论
CY8C4025LQI在程序中调用函数,通过示波器观察SCL引脚波形,无法将pin0.4(SCL)下拉是什么原因导致?
7790浏览 2评论
CYUSB3065焊接到USB3.0 TYPE-B口的焊接触点就无法使用是什么原因导致的?
6349浏览 2评论
CX3连接Camera修改分辨率之后,播放器无法播出camera的画面怎么解决?
755浏览 2评论
729浏览 2评论
使用stm32+cyw43438 wifi驱动whd,WHD驱动固件加载失败的原因?
8195浏览 2评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-11 15:10 , Processed in 0.822862 second(s), Total 84, Slave 67 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
417