| ??? 01/11/05 09:44 Read: times |
#84725 - Multiplication Problems and data types |
Hi, I am having problems with a calculation in the keil evaluation software. i cannot use floating point numbers since it is an evaluation version. My first problem is trying to convert the timers values into a 16-bit number and output to screen. I am trying to do the following:
totcount=(timehi * 256) + timelo; where i am assigning totcount as an unsigned int, timehi and timelo as an unsigned char and 256 as an int. if: timehi = 239 timelo = 0 when i output to screen, 'totcount' keeps giving me -4348 when the answer should be 61184 (decimal). Does anybody know what i am doing wrong! |
| Topic | Author | Date |
| Multiplication Problems and data types | 01/01/70 00:00 | |
| use unsigned int for totcount | 01/01/70 00:00 | |
| Wrong printf format specifier? | 01/01/70 00:00 | |
| yes i am using printf | 01/01/70 00:00 | |
| manual! | 01/01/70 00:00 | |
| using %d and %x | 01/01/70 00:00 | |
| %u | 01/01/70 00:00 | |
| Exactly what it says on the tin! | 01/01/70 00:00 | |
| Division problem? | 01/01/70 00:00 | |
| division problem in keil evaluation? | 01/01/70 00:00 | |
| Which Part? | 01/01/70 00:00 | |
| its ok i have sorted it! | 01/01/70 00:00 | |
| Still a problem, then... | 01/01/70 00:00 | |
| not so strange | 01/01/70 00:00 | |
| Not so strange? | 01/01/70 00:00 | |
| Need complete code! | 01/01/70 00:00 | |
| Like this | 01/01/70 00:00 | |
| code | 01/01/70 00:00 | |
| Calling printf from an ISR | 01/01/70 00:00 | |
| other interrupts wont get in the way | 01/01/70 00:00 | |
| ISR | 01/01/70 00:00 | |
| yes i see what you mean | 01/01/70 00:00 | |
No No Inside ISR | 01/01/70 00:00 |



