Maker Pro
Maker Pro

float and int

I recently switched to using C to program pic's. I read that I can use int data types. How does my 8 bit handle those? What im trying to ask if it is possible what would be the equivalent to assembly in order to handle 2 byte data types
 
I know what you're asking but can't think of a helpful answer. Maybe you can provide a scenario where you think you would need an int and then a C example can be given.
 
Well I was reading the manual.pdf for pic 10/12/16. It gives me supported data types for the compiler (Section 3.3). Pic 10/12/16 are all 8 bit micro's. How does a 8 bit micro handle a int type(2 bytes). Also I have read that 8 bit micros cant handle float point type either..but the compiler does.. sorry for the confusion. Good example if i wanted to do math with a larger number then 255.
 
Last edited:
It handles an int a byte at a time. Some 8 bit mcus can handle floats but it eats a lot of code space and is most often ill-advised.

Doing the math is easy provided you have the space. In C it's as simple as:

Code:
void main(void){
    unsigned int var = 0;
            var = 500 + 277;
}

Just perform the math as you would write it, though always be mindful of how big you expect or need a number to be and choose the appropriate data type.
 
Top