Ok thanks Nick. No it wont. What am doing is getting the data over the OBD port on the vehicle and storing the value in a unsigned int as a DEC number between 0 and 8000 and that works great. So what am trying to do here is take that number and turn on some LED's (depending on what the RPM value is) over the SPI port to a 16bit shift register. Sorry if i have not really explaind myself properly here but i will try and explain as best as i can again.
I will have 16 LED's in a row (1 = LED on and 0 = LED off).
For example my RPM value is 5000. Out of 16 LED's i want to turn on 5 LED's on the left and 5 LED's on the right. So the efect i want on my LED's is below
1111100000011111 <- (binary number)/(63519, dec number) 5000RPM
1111110000111111 <- (binary number)/(64575, dec number) 6000RPM, turn on 6 LED's either side
1111111001111111 <- (binary number)/(65151, dec number) 7000RPM, turn on 7 LED's either side
So i hope you can see what effect am trying to create (LED's light up from the left and right at the same time and meet up in the middle at max RPM).
Thats why am using binary (bitshift)
Display_RPM = ~((1 << (16 - temp))-1) | ((1 << temp)-1);
to create that efect everytime i read a new RPM value then send the effect out to the shift register. I was going to use a lookup table for patterns but i was told a better way would be to use bitshift and if only 1 line of code.
Hope that makes sense, if not then slap me with a fish lol. I will post my project on here when i think it's ready to share.