Quantcast
Channel: Cypress Semiconductor - PSoC 4 Architecture
Viewing all articles
Browse latest Browse all 796

Duty Cycle Measurement

$
0
0

i am using a demo board of CY8CKIT-043 with very low resources (32 macro-cell)
could you write a short code the do the folowing:
input= digital INPUT, random behaviouer of 0 or 1
output, digital= error1, error2
Period= every 50mS
clock=1MHz (or equvivalent)
( a 50mSec period has 50,000 pulses of 1MHz clk)
for each period
start with count=0
for each clk:
if INPUT=1, count=count+1
if INPUT=0, count=count (no change)
at period end:
if count is <30% , then error1="1" [30% of 50,000]
if count is >36% , then error2="1" [36% of 50,000]
else error1=error2="0"
repeat period endlessly

thank you!!!!
Itzhak Gavyus


Viewing all articles
Browse latest Browse all 796

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>