Propeller Assembly and frequency
gambrino
Posts: 28
Hello Forum , always i can't know the frequency when i am using waitcnt , can someone tell how it work ?
here Delay= 8000 is this means that generate 5KHz?
Thank you in advance
CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 PUB Main cognew(@Toggle, 0) 'Launch new cog DAT ORG 0 'Begin at Cog RAM addr 0 Toggle mov dira, Pin 'Set Pin to output mov Time, cnt 'Calculate delay time add Time, #$f 'Set minimum delay here :loop waitcnt Time, Delay 'Wait xor outa, Pin 'Toggle Pin jmp #:loop 'Loop endlessly Pin long |< 1 'Pin number Delay long 8_000 'Clock cycles to delay Time res 1 'System Counter Workspace
here Delay= 8000 is this means that generate 5KHz?
Thank you in advance
Comments
If you want a frequency of 6KHz, that's a toggle rate of 12KHz. 1 / 12KHz = 83+us. That's a Delay of 6667.