Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Please check this microchip XC8 C code?

Status
Not open for further replies.
The 'typedef' in the stdint.h just gives a nickname to 'unsigned char' so it can be called 'unit8_t', the two terms become interchangeable. The more common use of a typedef is to give a meaningful name to a complex data structure where it would be tedious to type the whole structure definition each time.

Don't worry about the bitwise operations, whether they are uint8_t or unsigned char they work exactly the same.

If you are unfamiliar with the data types, you can assume 'char' is any 8-bit value, it doesn't have to be printable. Similarly 'int' is any 16-bit value. The signed/unsigned declarations just alert the compiler that the most significant bit may be used as a polarity indicator (MSB = 1 means negative) in math operations but for bitwise operations it doesn't matter. Technically, the size of char/int/float variables depends on the size of the processors data bus, that's why there may be a specific size assigned to them somewhere, otherwise code would not be portable between different processor structures.

Brian.

edit: Horace1 beat me to it. As they advise, the 'sizeof' directive wil return the actual size of a variable or structure so you can interrogate the compiler to see what it has allocated if you want to.
 
  • Like
Reactions: treez

    T

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top