- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
i am trying to create a delay function using for loop in psoc 5, but for that i need to know about how many instructions should be executed.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Probably you can find the information in the ARM Cortex-M3 Processor Technical Reference Manual from the URL below.
ARM Cortex‑M3 Processor Technical Reference Manual Revision r2p1 – Arm Developer
But I'm afraid that the delay using loop can be preempted by other interrupt(s) and may not be very accurate.
Depending on the requirement of granularity, I would recommend you to go with
either Hardware Timer (for fine timing) or SysTick for ms order or above.
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Probably you can find the information in the ARM Cortex-M3 Processor Technical Reference Manual from the URL below.
ARM Cortex‑M3 Processor Technical Reference Manual Revision r2p1 – Arm Developer
But I'm afraid that the delay using loop can be preempted by other interrupt(s) and may not be very accurate.
Depending on the requirement of granularity, I would recommend you to go with
either Hardware Timer (for fine timing) or SysTick for ms order or above.
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
arvi,
I believe "__asm("nop");" is the instruction to use. RISC architectures in the the past besides being "Reduced Instruction Set Computing" claimed that each instruction completed on one CPU clock cycle. I believe the ARM CPU of the PSoC5 does just that.
Additionally the CPU clock is the BUS_CLOCK which is derived from the MASTER_CLOCK. Check your DWR/Clocks configuration which divisor is used on the MASTER_CLOCK to provide BUS_CLOCK.
Cypress provides a function called CyDelayUs(uint16 microseconds). I understand that they compute the needed "NULL" instructions to loop on based off the BUS_CLOCK.
Len
"Engineering is an Art. The Art of Compromise."