CS计算机代考程序代写 // 7-segment, display only 1 digit

// 7-segment, display only 1 digit
#include
// PTC pins connected to A-G and DP of 7–segment display
const uint32_t led_mask[] = {1UL << 0, 1UL << 6, 1UL << 12, 1UL << 16, 1UL << 17, 1UL << 3, 1UL << 11, 1UL << 13}; // PTC pins connected to DIGIT 1-4 of 7–segment display const uint32_t led_ctrl_mask[] = {1UL << 7, 1UL << 4, 1UL << 5, 1UL << 10}; void IO_Config(void); void LED_Display(int8_t x, int8_t y); void LED_Clear(void); void Delay(uint32_t nCount); int main(void) { // VARIABLE DECLARATION IF REQUIRED SystemCoreClockUpdate(); // Optional- Setup SystemCoreClock variable // Configure LED outputs IO_Config(); while(1){ // YOUR CODE HERE }; } /*---------------------------------------------------------------------------- I/O pin config *----------------------------------------------------------------------------*/ void IO_Config(void) { /* Enable Clock to Port C */ /* All PTC pins as output */ /* Pin PTC17 is GPIO */ /* Pin PTC16 is GPIO */ /* Pin PTC13 is GPIO */ /* Pin PTC12 is GPIO */ /* Pin PTC11 is GPIO */ /* Pin PTC10 is GPIO */ /* Pin PTC7 is GPIO */ /* Pin PTC6 is GPIO */ /* Pin PTC5 is GPIO */ /* Pin PTC4 is GPIO */ /* Pin PTC3 is GPIO */ /* Pin PTC0 is GPIO */ return; } /*--------------------------------------------------------------------------------- display number, x (0-9), in digit y (1-4) of the 7-segment display *---------------------------------------------------------------------------------*/ void LED_Display(int8_t x, int8_t y) { FPTC->PCOR = led_ctrl_mask[y-1]; // select digit
switch(x){
/* Display 0 */
case 0:

break;
/* Display 1 */
case 1:

break;
/* Display 2 */
case 2:

break;
/* Display 3 */
case 3:

break;
/* Display 4 */
case 4:

break;
/* Display 5 */
case 5:

break;
/* Display 6 */
case 6:

break;
/* Display 7 */
case 7:

break;
/* Display 8 */
case 8:

break;

/* Display 9 */
case 9:

break;
}
return;
}

/*—————————————————————————
Clear all digits on the 7-segment display
*—————————————————————————*/
void LED_Clear(void)
{
/* clear all display on the 7-segment display */

/* disable all digits of the 7-segment display*/

return;
}

void Delay(uint32_t nCount) // delay subroutine
{
while(nCount–)
{
}
}