Do Ways to use WAITCNT into machine code?
Hello, I am trying to use Waitcnt in several ways, but keep getting results disturbing.
Surely I do poorly
························
inicio
··············mov·····dira,···Pin················'Selecciona pin
··············
:bucle···· ···mov····· p,par·········· ···········'toma el valor del puntero
············· rdlong·· delay,p········ ···········'carga en delay·············
············· mov·····Timpo,···cnt················'toma·cnt·y lo pasa a·Tiempo
··············add·····Timpo,···#16·················'Add·incrementa tiempo en 16
··············waitcnt·Tiempo,···Delay··············'espera
··············xor·····outa,···Pin················'on
··············waitcnt·Tiempo,···Delay··············'espera
··············xor·····outa,···Pin················'on
··············jmp·····#:bucle················· ····· ‘ bucle
Pin·····long····· ········|<·1
Tiempo················res·1
Delay·············· res 1
P····· ············ res 1
·
I want to vary the frequency in real time, so delay is read from the hub.
But the increase in frequency are not linear (one to one) are 8 by 8, 12, 12,
But delay is 1 in 1…
I tried waitcnt cnt, delay, but the first time we have to wait 1 minute… ...
Then it works and whether the increases are 1 in 1
How does waitcnt in assembly?
·· Another way, but giving the same evil result of increased 8 at 8
·inicio
··············mov·····dira,···Pin················'Selecciona pin
··············
:bucle···· ···mov····· p,par·········· ···········'toma el valor del puntero
············· rdlong·· delay,p········ ···········'carga en delay·············
·············
··············add·····Timpo,···cnt················'Add·incrementa tiempo con cnt
··············xor·····outa,···Pin················'on
·············
··············waitcnt·Tiempo,#0········· ·······'espera
··············xor·····outa,···Pin················'on
··············jmp·····#:bucle················· ····· ‘ bucle
Pin·····long····· ········|<·1
Tiempo················res·1
Delay·············· res 1
P····· ············ res 1
················
· Will there always be added before waitcnt cnt?
If someone can give an explanation of waitcnt in assembly?
Greetings from Spain des!
Surely I do poorly
························
inicio
··············mov·····dira,···Pin················'Selecciona pin
··············
:bucle···· ···mov····· p,par·········· ···········'toma el valor del puntero
············· rdlong·· delay,p········ ···········'carga en delay·············
············· mov·····Timpo,···cnt················'toma·cnt·y lo pasa a·Tiempo
··············add·····Timpo,···#16·················'Add·incrementa tiempo en 16
··············waitcnt·Tiempo,···Delay··············'espera
··············xor·····outa,···Pin················'on
··············waitcnt·Tiempo,···Delay··············'espera
··············xor·····outa,···Pin················'on
··············jmp·····#:bucle················· ····· ‘ bucle
Pin·····long····· ········|<·1
Tiempo················res·1
Delay·············· res 1
P····· ············ res 1
·
I want to vary the frequency in real time, so delay is read from the hub.
But the increase in frequency are not linear (one to one) are 8 by 8, 12, 12,
But delay is 1 in 1…
I tried waitcnt cnt, delay, but the first time we have to wait 1 minute… ...
Then it works and whether the increases are 1 in 1
How does waitcnt in assembly?
·· Another way, but giving the same evil result of increased 8 at 8
·inicio
··············mov·····dira,···Pin················'Selecciona pin
··············
:bucle···· ···mov····· p,par·········· ···········'toma el valor del puntero
············· rdlong·· delay,p········ ···········'carga en delay·············
·············
··············add·····Timpo,···cnt················'Add·incrementa tiempo con cnt
··············xor·····outa,···Pin················'on
·············
··············waitcnt·Tiempo,#0········· ·······'espera
··············xor·····outa,···Pin················'on
··············jmp·····#:bucle················· ····· ‘ bucle
Pin·····long····· ········|<·1
Tiempo················res·1
Delay·············· res 1
P····· ············ res 1
················
· Will there always be added before waitcnt cnt?
If someone can give an explanation of waitcnt in assembly?
Greetings from Spain des!
Comments
1.cnt increases by 4 for each instruction
2. Waitcnt waits until cnt == first parameter
So in your 1st example, if delay is 1 then by the time the 2nd wait is executed cnt is > Timpo so it will wait until cnt wraps and reaches that value ~54seconds later
Waitcnt se usa asi:
waitcnt <variable_que_tiene_cnt_futuro>,<variable_que_tiene_numero_de_ciclos_a_sumar_a_la_variable_anterior_despues_de_esperar>
tene en cuenta que cada instruccion toma 4 ciclos, y que waitcnt toma un minimo de 6, asi que cuando hagas:
ciclos tiene que ser por lo menos 4+4+6, y otros_ciclos perparar
With your explanation,· I understand that passes
I am sending values very similar to those used by the cycles in WAITCNT machine, and joined gradually waitcnt
But waiting is small and so the accumulated value of the last digit behaves as if there is no
I'm doing a routine with frankenstein AxixDriver.spin jejejjej
What I am doing is to transform AxixDriver move with· two engines step by step
The engines are working 64 micro step.
Muy bueno tu ESPAÑOL!
¿de donde sos?
thank Timmoore
Vivo en Madrid
Te dije "sos", como un guiño· Argentino ;-)
·