roghenr Posted September 19, 2023 Report Share Posted September 19, 2023 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 Link to comment Share on other sites More sharing options...
MVP 2023 Flex727 Posted September 19, 2023 MVP 2023 Report Share Posted September 19, 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 More sharing options...
roghenr Posted September 20, 2023 Author Report Share Posted September 20, 2023 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 More sharing options...
MVP 2023 Ausman Posted September 20, 2023 MVP 2023 Report Share Posted September 20, 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 More sharing options...
roghenr Posted September 21, 2023 Author Report Share Posted September 21, 2023 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 In the first pulse, set 1 to MB16 and from then on it goes up to mb10. 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 More sharing options...
MVP 2023 Flex727 Posted September 21, 2023 MVP 2023 Report Share Posted September 21, 2023 If you want to turn them all off at once, use Vector Fill: Link to comment Share on other sites More sharing options...
Fernando Castro Posted September 21, 2023 Report Share Posted September 21, 2023 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. 1 Link to comment Share on other sites More sharing options...
roghenr Posted September 21, 2023 Author Report Share Posted September 21, 2023 7 hours ago, Flex727 said: Se você quiser desligar todos de uma vez, use o Preenchimento vetorial: 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 More sharing options...
MVP 2023 Ausman Posted September 21, 2023 MVP 2023 Report Share Posted September 21, 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 More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now