Conversation

zeroflow

Works well up to a 200 kHz input signal - deviation below 1% of frequency and duty cycle.

The example has a build-in testmode. Lower frequencies are dead on, higher ones have a slight error.

100 Hz / 0.5 duty OK
	100.00 Hz / 0.50 duty cycle measured
	Diff: 0.00 Hz
	Diff: 0.00% of freq
	Diff: 0.00% duty cycle

1000 Hz / 0.5 duty OK
	1000.02 Hz / 0.50 duty cycle measured
	Diff: 0.02 Hz
	Diff: 0.00% of freq
	Diff: 0.00% duty cycle

10000 Hz / 0.5 duty OK
	10002.00 Hz / 0.50 duty cycle measured
	Diff: 2.00 Hz
	Diff: 0.02% of freq
	Diff: 0.01% duty cycle

200000 Hz / 0.5 duty OK
	200803.21 Hz / 0.50 duty cycle measured
	Diff: 803.20 Hz
	Diff: 0.40% of freq
	Diff: 0.20% duty cycle

500000 Hz / 0.5 duty OUTSIDE LIMITS ---------
	505050.47 Hz / 0.49 duty cycle measured
	Diff: 5050.50 Hz
	Diff: 1.01% of freq
	Diff: 0.50% duty cycle

Comment on lines 14 to 15
set(x, 0) # Set x = 0
mov(x, x | (0b01 << 3)) # invert x = Max-Value for 32 bits. (0b01 << 3) sets the invert bit.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you could just do MOV x with a NULL source and the invert bit?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that works.
Great Idea - thanks!

@aallanaallan added the enhancementNew feature or requestlabel May 28, 2021
Sign up for free to join this conversation on . Already have an account? Sign in to comment
enhancementNew feature or request
None yet

Successfully merging this pull request may close these issues.