: CC78K0R error E0402: Incompatible type conversion

I want to Store PIN VALUES to Array. This Program Showing  : CC78K0R error E0402: Incompatible type conversion

uint8_t segmentPins[8] = {P3.0,P3.1,P5.0,P5.1,P6.0,P6.1,P0.0,P0.1};

Parents Reply Children
  • Problem is when i type cast Led in array and if i want to change state of led. Let sat segment[0] = 1; it will not reflect on pin.

  • I'm sorry but I don't understand what you try to do with the array.

    You try to write the addresses of ports to the array. This means in the first place it has to be an array of pointers. A pointer cannot be defined to point to a specific bit.

    So I would guess you need a 2 dimensional array, where an element consists of a pointer to an 8 bit variable (the special function register), and an 8 bit variable indicating the bit number.

    Then you need macros for set bit and clear bit that use the pointer and the bit number to set or clear this bit.

    I have no clear idea how coding could be done but it will be tricky... .