68hc12

How to scale a number/range of numbers in c

∥☆過路亽.° 提交于 2019-12-12 05:09:29
问题 I want to be able to display the altitude in ft ranging from 0ft to 20000ft on my LCD module. The numbers are read from a potentiometer that I can rotate to change the values. At the moment the potentiometer displays from 0 to 1023 but I need to scale these appropriately so they read from 0-20000ft. As well as this I want the line below to display a 'bar graph' to represent the altitude increasing. The LCD has 20 blocks per line so the bar graph can range from 1 block to 20 blocks. sprintf

Reverse a byte using assembly language

大城市里の小女人 提交于 2019-12-01 15:35:34
问题 I'm in a microprocessors class and we are using assembly language in Freescale CodeWarrior to program a 68HCS12 micro controller. Our assignment this week is to revers a byte, so if the byte was 00000001, the output would be 10000000, or 00101011 to 11010100. We have to use assembly language, and were told we could use rotates and shifts (but not limited to!) to accomplish this task. I'm really at a loss as to where I should start. 回答1: If you can spare the 256 bytes extra code size, a lookup