Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Create 10-bit and 20-bit number to 32-bit number

Solved!
Go to solution

Hello,

 

I want to create a 32-bit number from one 10-bit number and one 20-bit number and merging them.

 

Please find attached snap of my question.

 

Please help, thanks in advance.

0 Kudos
Message 1 of 4
(2,310 Views)
Solution
Accepted by topic author Karan_jasani

Cast the 10 bit and 20 bit numbers into a 32-bit.  Then shift the 10 bit number to the left 20 times and OR the values together.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 4
(2,295 Views)

Hello,

 

Thanks for quick solution.

 

Now can I apply this operation to entire table elements ? I have a table in which 1st column consists of 10 bit address and 2nd column consists of 20 bit data. Can I apply similar operation to all the table elements ?

0 Kudos
Message 3 of 4
(2,277 Views)

@Karan_jasani wrote:

Now can I apply this operation to entire table elements ? I have a table in which 1st column consists of 10 bit address and 2nd column consists of 20 bit data. Can I apply similar operation to all the table elements ?


Use a FOR loop to iterate through your rows and apply the logic to combine and make a new array.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 4
(2,274 Views)