??? 10/30/05 10:20 Read: times |
#103136 - Read the datasheet carefully! Responding to: ???'s previous message |
In some of analog device's parts, the representation of negative numbers differs from the classic way - why this is is beyond me. In the aduc842 the adc values are represented this way. As to why your first piece of code doesn't work - maybe its because the int in CB6 is most likely 32bits so the line Code -= 0x7fff; won't do what you expect. By looking at the results of your code it will tell you why. The lesson here is be aware of your variable sizes and the fundamentals of the operations you're performing - no magic is involved. Lookup the manual of CB6 and find a type that is 16bits - something like WORD and you might find the first bit of code will perform better. |
Topic | Author | Date |
Question about 2's Complementary Code | 01/01/70 00:00 | |
Why? | 01/01/70 00:00 | |
ok! if it is not suitable,delete my post | 01/01/70 00:00 | |
Just wondreing... | 01/01/70 00:00 | |
sorry, I miss understanding your meaning | 01/01/70 00:00 | |
Read the datasheet carefully! | 01/01/70 00:00 | |
size of int are 4 bytes in CB6 | 01/01/70 00:00 | |
1's and 2's complement | 01/01/70 00:00 | |
yes, it is wrong!![]() | 01/01/70 00:00 |