Page 1 of 1

Print UInt number on two ports (solved)

Posted: Sun Jul 29, 2018 12:08 pm
by bercioiu
Hi all!

I have a counter from 0 to 65535 that i want to "print" it to port A and port B, and I1m stuck up... I dont know how to do it...
I use Port A for 0 to 255 and port B for 256 to 65535.
Please show me the way to see the light :-)

Thanks!

Re: Print UInt number on two ports

Posted: Sun Jul 29, 2018 12:34 pm
by kersing
Use a calculation icon to split it into two byte sized variables like this:

(Create two variables counter_low and counter_high of type byte)

Code: Select all

counter_low = counter & 255
counter_high = (counter >> 8)
Now you can use these to set port A & B.

(If you want to you can skip the variables and just use counter & 255 as the argument for one output icon and counter >> 8 for another output icon)

Re: Print UInt number on two ports

Posted: Sun Jul 29, 2018 12:53 pm
by bercioiu
Thank you very much, sir! You told me exactly what I did not know!