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!
Print UInt number on two ports (solved)
-
- Valued Contributor
- Posts: 2045
- Joined: Wed Aug 27, 2008 10:31 pm
- Location: Netherlands
- Has thanked: 553 times
- Been thanked: 1081 times
- Contact:
Re: Print UInt number on two ports
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)
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)
(Create two variables counter_low and counter_high of type byte)
Code: Select all
counter_low = counter & 255
counter_high = (counter >> 8)
(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)
“Integrity is doing the right thing, even when no one is watching.”
― C.S. Lewis
― C.S. Lewis
-
- Posts: 161
- Joined: Sun Feb 25, 2007 10:56 am
- Location: bucharest, romania
- Has thanked: 90 times
- Been thanked: 34 times
- Contact:
Re: Print UInt number on two ports
Thank you very much, sir! You told me exactly what I did not know!