void roundsch_AB(ANODE *phead, BNODE *head, CNODE *hd) { if (phead->next == NULL) { printf("无进程\n"); } ANODE *p = phead->next; while (1) { my_diaodu(phead, head); if (head->next != NULL) { int n = 2; while (n--) { my_zhixing(head); BNODE *p1 = head->next; if (p1 != NULL) { if (p1->pcb.NEEDTIME != 0) { p1->prev->next = p1->next; if (p1->next == NULL) { head->next = p1; } else { head->tail->next = p1;//error p1->next = NULL; p1->prev = head->tail; head->tail = p1; } } else { insert_C(hd, p1); p1->prev->next = p1->next; free(p1); } } phead->COUNT++; my_diaodu(phead, head); } phead->CPUTIME++; printf("第%d次时间轮转\n", phead->CPUTIME); if (phead->next != NULL) { display_A(phead); } if (head->next != NULL) { display_B(head); } if (hd->next != NULL) { display_C(hd); } } phead->COUNT++; if (CNODE_length(hd) == 2) { break; } } }
void main() { P0 = OFF; // Turn Off diodes on PORT0 P1 = OFF; // Turn Off diodes on PORT1 P2 = OFF; // Turn Off diodes on PORT2 P3 = OFF; // Turn Off diodes on PORT3 Delay_ms(ONE_SEC); while(1) { display_W(); P2 = OFF; Delay_us(1000); display_E(); P2 = OFF; Delay_us(1000); display_L(); P2 = OFF; Delay_us(1000); display_C(); P2 = OFF; Delay_us(1000); display_O(); P2 = OFF; Delay_us(1000); display_M(); P2 = OFF; Delay_us(1000); display_E(); P2 = OFF; Delay_us(1000); display_T(); P2 = OFF; Delay_us(1000); display_O(); P2 = OFF; Delay_us(1000); display_T(); P2 = OFF; Delay_us(1000); display_E(); P2 = OFF; Delay_us(1000); display_C(); P2 = OFF; Delay_us(1000); display_H(); P2 = OFF; Delay_us(1000); display_N(); P2 = OFF; Delay_us(1000); display_O(); P2 = OFF; Delay_us(1000); display_B(); P2 = OFF; Delay_us(1000); display_L(); P2 = OFF; Delay_us(1000); display_A(); P2 = OFF; Delay_us(1000); display_S(); P2 = OFF; Delay_us(1000); display_T(); P2 = OFF; Delay_us(1000); /*display_-(); P2 = OFF; Delay_us(1000); display_2(); P2 = OFF; Delay_us(1000); display_0(); P2 = OFF; Delay_us(1(); P2 = OFF; Delay_us(1000); display_3(); P2 = OFF; Delay_us(1000);*/ } }