This question relates to my tilt sensor project. I have decided to use a table look-up to convert a calculated value from the accelerometer (i.e., a whole number proportional to duty cycle) to tilt angle.
I have read about table look-ups and gone through some tutorials to get a tenuous grasp of what is done. These questions relate to setting up and reading the table. MCU=12F683 at 8 MHz.
Question 1: The calculated values range from 471 to 553. I plan to subtract 384 from each value to give 87 to 169. I chose 384 (256 +128) on a wild guess -- largest number less than 471 with only two 1's -- that it might speed the calculation. Would it be faster to subtract a one-byte number, say 235, twice?
Question 2: What are the largest values one can enter in a line of Assembly such as: "movlw <calculated number> - 1 ". Can I just subtract ".471" that way and be done with it?
Question 3: My spreadsheet program (QuattroPro) has a nice catenation ("catb") command so one can pluck just the desired bits from a larger binary number. Is there a similar one-step operator in MPAsm?
Question 4: Related to #3 above, do the shift commands (<< and >>) rotate through carry?
Thanks.
John
I have read about table look-ups and gone through some tutorials to get a tenuous grasp of what is done. These questions relate to setting up and reading the table. MCU=12F683 at 8 MHz.
Question 1: The calculated values range from 471 to 553. I plan to subtract 384 from each value to give 87 to 169. I chose 384 (256 +128) on a wild guess -- largest number less than 471 with only two 1's -- that it might speed the calculation. Would it be faster to subtract a one-byte number, say 235, twice?
Question 2: What are the largest values one can enter in a line of Assembly such as: "movlw <calculated number> - 1 ". Can I just subtract ".471" that way and be done with it?
Question 3: My spreadsheet program (QuattroPro) has a nice catenation ("catb") command so one can pluck just the desired bits from a larger binary number. Is there a similar one-step operator in MPAsm?
Question 4: Related to #3 above, do the shift commands (<< and >>) rotate through carry?
Thanks.
John
Last edited: