Jump to content

How vector shift register works to shift bits


Recommended Posts

I don't understand, I'm using vector shift and I wanted to shift bits for example
In vector shift A = mb200
In vector shift B = 1
To activate several motors in sequence but it does not always reset on the next pulse in A but it does not work
In the help it says that I can shift mb bits but it only exemplifies in bytes

image.png.f2b5f64bcf6890e3d30f72c34e826b22.png

Link to comment
Share on other sites

  • MVP 2023

This function is a bit confusing and I've never had the need to delve into it to understand fully, but here is what I would do in the absence of any additional help: create a test program and download into an available PLC then trigger the function while watching online to see precisely what it does. Try various scenarios until you have a complete understanding. It would probably take less than 20 minutes to have it all figured out.

Alternatively (which is what I would probably do since I'm usually time-pressed), would be to simply brute force it with several ladder rungs and coils as needed to make it work without the Vector Shift FB.

Link to comment
Share on other sites

8 hours ago, Flex727 said:

Esta função é um pouco confusa e nunca tive a necessidade de me aprofundar nela para entendê-la completamente, mas aqui está o que eu faria na ausência de qualquer ajuda adicional: criar um programa de teste e fazer download em um PLC disponível e acionar o função enquanto assiste online para ver exatamente o que ele faz. Experimente vários cenários até ter um entendimento completo. Provavelmente levaria menos de 20 minutos para descobrir tudo.

Alternativamente (que é o que eu provavelmente faria, já que normalmente estou pressionado pelo tempo), seria simplesmente forçá-lo com força bruta com vários degraus e bobinas conforme necessário para fazê-lo funcionar sem o Vector Shift FB.

Hi Flex, it really doesn't work.
I set it to a [1] and I would like this bit to move every time I generate a pulse at the block input, but what it does is move only once and then reset it to zero.
I have a V130 and tested it for hours before giving up.
I chose to use the other shift and then with numeric for bit and it solved my problem.
It goes to a[1] mb40 to mb47 successively and activates outputs to turn on motors.
I'm from Brazil and I appreciate your attention at the moment.

Link to comment
Share on other sites

  • MVP 2023

I don't use this, but your description is exactly what help says.  I believe your need is to move the 1 progressively from MB40-47, which then changes motors being run as only one of these MBs will be on.  Correct?  If you change your Vector Shift amount to 8, it should work as you want.  But I can't check this at present.

cheers, Aus 

Link to comment
Share on other sites

12 hours ago, Ausman said:

Eu não uso isso, mas sua descrição é exatamente o que a ajuda diz. Acredito que sua necessidade é mover o 1 progressivamente do MB40-47, que então muda os motores em funcionamento, pois apenas um desses MBs estará ligado. Correto? Se você alterar o valor do deslocamento do vetor para 8, ele deverá funcionar como desejado. Mas não posso verificar isso no momento.

felicidades, Aus 

Good evening Ausman, I would like you to analyze it and say what you think, I did it this way

 

image.png.c516e3bc959ad361a34d284e27af033a.png

In the first pulse, set 1 to MB16 and from then on it goes up to mb10.

image.png.4140d088cd233289dab4ff98045b3819.png

my problem will be to turn off the engines after pressing the off button
And then it works well for my project

 

 

 

Link to comment
Share on other sites

you already got the answers needed. but I think it will be worth to explain the bit shift function.

when you do shift a bit, the most left bit goes to the void. it does not continue shifting all the bits in the memory address infinitely, so using an MB and a bit shift of 1 was essentially shifting 1 bit 1 place, if it was 1 then it would become 0 because the 1 was thrown into the void all the following MBS are unchanged because you only shifted the first Bit.

shifting by 8 is taking 8 bits and shifting all of those, effectively displacing 1 position on a vector of 8 bits.

  • Upvote 1
Link to comment
Share on other sites

7 hours ago, Flex727 said:

Se você quiser desligar todos de uma vez, use o Preenchimento vetorial:

imagem.png.1a157c8cddd2f0aebd35a5b08cb99536.png

Thank you for the information, so I will use these instructions in my project as they are explained here unless someone has another idea and is against it

 

3 hours ago, Fernando Castro said:

você já tem as respostas necessárias. mas acho que valerá a pena explicar a função bit shift.

quando você muda um pouco, a parte mais à esquerda vai para o vazio. ele não continua mudando todos os bits no endereço de memória infinitamente, então usar um MB e um deslocamento de bit de 1 estava essencialmente mudando 1 bit para 1 lugar, se fosse 1 então se tornaria 0 porque o 1 foi jogado no vazio tudo os seguintes MBS permanecem inalterados porque você deslocou apenas o primeiro bit.

mudar para 8 é pegar 8 bits e mudar todos eles, efetivamente deslocando 1 posição em um vetor de 8 bits.

Thank you for the information, so I will use these instructions in my project as they are explained here unless someone has another idea and is against it

Link to comment
Share on other sites

  • MVP 2023

And to top off the info from Flex and Fernando, it looks like you want to use ON status for your controls so you end up with all 8 MBs ON., instead of one ON shifting along through the MBs like I thought.

To easily restart such a sequence, use 16MBs and vector fill.  Do 2 fills in your "turning off" action.  1 fill is 1 to  the adjacent 8 MBs, the other fill sets your controlling MBs to 0, and then leave fill alone until the next "all stop" which repeats both fills ready for the next start.  By moving 16 bits, you will progress the 8 ON bits along your MB vector, progressively turning them all ON.

cheers, Aus

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...