Using Two''s complement math for SIN and COS
One part of my dead reackoning navigation project involves a vector
solution of position based on a Lat/Long position, heading and
distance traveled.
Because I don't really understand how to perform multiply and divide
operations using two's complement values (which are the form SIN and
COS come in BS2SX), I have some very messy code (which is
contributing to a lack of eeprom) to deal with heading directions
where sin and/or cos return a negative value.
Does anyone have any example code or a good reference to explain how
to handle SIN and COS in the STAMP. The manual explains the bit
inversion with add of 1, for negative values, but that doesn't really
help me.
solution of position based on a Lat/Long position, heading and
distance traveled.
Because I don't really understand how to perform multiply and divide
operations using two's complement values (which are the form SIN and
COS come in BS2SX), I have some very messy code (which is
contributing to a lack of eeprom) to deal with heading directions
where sin and/or cos return a negative value.
Does anyone have any example code or a good reference to explain how
to handle SIN and COS in the STAMP. The manual explains the bit
inversion with add of 1, for negative values, but that doesn't really
help me.