Shop OBEX P1 Docs P2 Docs Learn Events
Do Ways to use WAITCNT into machine code? — Parallax Forums

Do Ways to use WAITCNT into machine code?

hal2000hal2000 Posts: 66
edited 2008-08-02 18:13 in Propeller 1
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!

Comments

  • TimmooreTimmoore Posts: 1,031
    edited 2008-07-27 07:01
    2 things to think about
    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
  • AleAle Posts: 2,363
    edited 2008-07-27 07:38
    hal2000,

    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:

       mov  tiempo,CNT
       add  tiempo,ciclos
       waitcnt tiempo,otros_ciclos
    
    



    ciclos tiene que ser por lo menos 4+4+6, y otros_ciclos perparar
  • hal2000hal2000 Posts: 66
    edited 2008-07-28 13:29
    Jejejeje, this year more English classes for my!
    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
  • AleAle Posts: 2,363
    edited 2008-07-28 14:08
    If my "vos", my "tene" and "hacelo" do not give you an idea... I think your "sos" gave me the idea that we should be from the same region smile.gif. Like BTX, I'm from Argentina, but I'm not there anymore wink.gif
  • hal2000hal2000 Posts: 66
    edited 2008-08-02 18:13
    I am Gaita!!!··roll.gif··· Gaita not = gay
    Vivo en Madrid
    Te dije "sos", como un guiño· Argentino ;-)
    ·
Sign In or Register to comment.