Professional Documents
Culture Documents
Gameofthrones Do Pic
Gameofthrones Do Pic
// CONFIG1H
#pragma config OSC = RCIO6 // Oscillator Selection bits (External RC
oscillator, port function on RA6)
#pragma config FCMEN = OFF // Fail-Safe Clock Monitor Enable bit (Fail-Safe
Clock Monitor disabled)
#pragma config IESO = OFF // Internal/External Oscillator Switchover bit
(Oscillator Switchover mode disabled)
// CONFIG2L
#pragma config PWRT = OFF // Power-up Timer Enable bit (PWRT disabled)
#pragma config BOREN = SBORDIS // Brown-out Reset Enable bits (Brown-out Reset
enabled in hardware only (SBOREN is disabled))
#pragma config BORV = 3 // Brown Out Reset Voltage bits (Minimum setting)
// CONFIG2H
#pragma config WDT = ON // Watchdog Timer Enable bit (WDT enabled)
#pragma config WDTPS = 32768 // Watchdog Timer Postscale Select bits (1:32768)
// CONFIG3H
#pragma config CCP2MX = PORTC // CCP2 MUX bit (CCP2 input/output is multiplexed
with RC1)
#pragma config PBADEN = ON // PORTB A/D Enable bit (PORTB<4:0> pins are
configured as analog input channels on Reset)
#pragma config LPT1OSC = OFF // Low-Power Timer1 Oscillator Enable bit (Timer1
configured for higher power operation)
#pragma config MCLRE = ON // MCLR Pin Enable bit (MCLR pin enabled; RE3 input
pin disabled)
// CONFIG4L
#pragma config STVREN = ON // Stack Full/Underflow Reset Enable bit (Stack
full/underflow will cause Reset)
#pragma config LVP = ON // Single-Supply ICSP Enable bit (Single-Supply
ICSP enabled)
#pragma config XINST = OFF // Extended Instruction Set Enable bit (Instruction
set extension and Indexed Addressing mode disabled (Legacy mode))
// CONFIG5L
#pragma config CP0 = OFF // Code Protection bit (Block 0 (000800-001FFFh)
not code-protected)
#pragma config CP1 = OFF // Code Protection bit (Block 1 (002000-003FFFh)
not code-protected)
#pragma config CP2 = OFF // Code Protection bit (Block 2 (004000-005FFFh)
not code-protected)
#pragma config CP3 = OFF // Code Protection bit (Block 3 (006000-007FFFh)
not code-protected)
// CONFIG5H
#pragma config CPB = OFF // Boot Block Code Protection bit (Boot block
(000000-0007FFh) not code-protected)
#pragma config CPD = OFF // Data EEPROM Code Protection bit (Data EEPROM not
code-protected)
// CONFIG6L
#pragma config WRT0 = OFF // Write Protection bit (Block 0 (000800-001FFFh)
not write-protected)
#pragma config WRT1 = OFF // Write Protection bit (Block 1 (002000-003FFFh)
not write-protected)
#pragma config WRT2 = OFF // Write Protection bit (Block 2 (004000-005FFFh)
not write-protected)
#pragma config WRT3 = OFF // Write Protection bit (Block 3 (006000-007FFFh)
not write-protected)
// CONFIG6H
#pragma config WRTC = OFF // Configuration Register Write Protection bit
(Configuration registers (300000-3000FFh) not write-protected)
#pragma config WRTB = OFF // Boot Block Write Protection bit (Boot block
(000000-0007FFh) not write-protected)
#pragma config WRTD = OFF // Data EEPROM Write Protection bit (Data EEPROM
not write-protected)
// CONFIG7L
#pragma config EBTR0 = OFF // Table Read Protection bit (Block 0 (000800-
001FFFh) not protected from table reads executed in other blocks)
#pragma config EBTR1 = OFF // Table Read Protection bit (Block 1 (002000-
003FFFh) not protected from table reads executed in other blocks)
#pragma config EBTR2 = OFF // Table Read Protection bit (Block 2 (004000-
005FFFh) not protected from table reads executed in other blocks)
#pragma config EBTR3 = OFF // Table Read Protection bit (Block 3 (006000-
007FFFh) not protected from table reads executed in other blocks)
// CONFIG7H
#pragma config EBTRB = OFF // Boot Block Table Read Protection bit (Boot block
(000000-0007FFh) not protected from table reads executed in other blocks)
#include <xc.h>
void main(){
ADCON1 = 0x0F;
TRISA = 0;
TRISB = 0;
TRISC = 255;
TRISD = 0;
int numa = 0;
int numb = 0;
int quedasA =0;
int quedasB =0;
while(1){
if(numa == 1){
ledA1 = 1;
ledA2 = 0;
ledA3 = 0;
ledA4 = 0;
ledA5 = 0;
ledA6 = 0;
ledA7 = 0;
ledA8 = 0;
ledA9 = 0;
ledA10 = 0;
ledA11 = 0;
ledA12 = 0;
}
if(numa == 2){
ledA1 = 1;
ledA2 = 1;
ledA3 = 0;
ledA4 = 0;
ledA5 = 0;
ledA6 = 0;
ledA7 = 0;
ledA8 = 0;
ledA9 = 0;
ledA10 = 0;
ledA11 = 0;
ledA12 = 0;
}
if(numa == 3){
ledA1 = 1;
ledA2 = 1;
ledA3 = 1;
ledA4 = 0;
ledA5 = 0;
ledA6 = 0;
ledA7 = 0;
ledA8 = 0;
ledA9 = 0;
ledA10 = 0;
ledA11 = 0;
ledA12 = 0;
}
if(numa == 4){
ledA1 = 1;
ledA2 = 1;
ledA3 = 1;
ledA4 = 1;
ledA5 = 0;
ledA6 = 0;
ledA7 = 0;
ledA8 = 0;
ledA9 = 0;
ledA10 = 0;
ledA11 = 0;
ledA12 = 0;
}
if(numa == 5){
ledA1 = 1;
ledA2 = 1;
ledA3 = 1;
ledA4 = 1;
ledA5 = 1;
ledA6 = 0;
ledA7 = 0;
ledA8 = 0;
ledA9 = 0;
ledA10 = 0;
ledA11 = 0;
ledA12 = 0;
}
if(numa == 6){
ledA1 = 1;
ledA2 = 1;
ledA3 = 1;
ledA4 = 1;
ledA5 = 1;
ledA6 = 1;
ledA7 = 0;
ledA8 = 0;
ledA9 = 0;
ledA10 = 0;
ledA11 = 0;
ledA12 = 0;
}
if(numa == 7){
ledA1 = 1;
ledA2 = 1;
ledA3 = 1;
ledA4 = 1;
ledA5 = 1;
ledA6 = 1;
ledA7 = 1;
ledA8 = 0;
ledA9 = 0;
ledA10 = 0;
ledA11 = 0;
ledA12 = 0;
}
if(numa == 8){
ledA1 = 1;
ledA2 = 1;
ledA3 = 1;
ledA4 = 1;
ledA5 = 1;
ledA6 = 1;
ledA7 = 1;
ledA8 = 1;
ledA9 = 0;
ledA10 = 0;
ledA11 = 0;
ledA12 = 0;
}
if(numa == 9){
ledA1 = 1;
ledA2 = 1;
ledA3 = 1;
ledA4 = 1;
ledA5 = 1;
ledA6 = 1;
ledA7 = 1;
ledA8 = 1;
ledA9 = 1;
ledA10 = 0;
ledA11 = 0;
ledA12 = 0;
}
if(numa == 10){
ledA1 = 1;
ledA2 = 1;
ledA3 = 1;
ledA4 = 1;
ledA5 = 1;
ledA6 = 1;
ledA7 = 1;
ledA8 = 1;
ledA9 = 1;
ledA10 = 1;
ledA11 = 0;
ledA12 = 0;
}
if(numa == 11){
ledA1=1;
ledA2 = 1;
ledA3 = 1;
ledA4 = 1;
ledA5 = 1;
ledA6 = 1;
ledA7 = 1;
ledA8 = 1;
ledA9 = 1;
ledA10 = 1;
ledA11 = 1;
ledA12 = 0;
}
if(numa == 12){
ledA1=1;
ledA2 = 1;
ledA3 = 1;
ledA4 = 1;
ledA5 = 1;
ledA6 = 1;
ledA7 = 1;
ledA8 = 1;
ledA9 = 1;
ledA10 = 1;
ledA11 = 1;
ledA12 = 1;
}
if(numa == 0){
ledA1 = 0;
ledA2 = 0;
ledA3 = 0;
ledA4 = 0;
ledA5 = 0;
ledA6 = 0;
ledA7 = 0;
ledA8 = 0;
ledA9 = 0;
ledA10 = 0;
ledA11 = 0;
ledA12 = 0;
}
/*
quedasA=quedasA+1;
}
if(quedasA == 0){
AQ1 = 0;
AQ2 = 0;
AQ3 = 0;
}
if(quedasA == 1){
AQ1 = 0;
AQ2 = 0;
AQ3 = 1;
}
if(quedasA == 2){
AQ1 = 0;
AQ2 = 1;
AQ3 = 0;
}
if(quedasA == 3){
AQ1 = 0;
AQ2 = 1;
AQ3 = 1;
}
*/
for (int i=1;i<2;i++)
{
ledA1 = 1;
__delay_ms(1000);
ledA1 = 0;
delay_ms(1000);
ledA2 = 1;
__delay_ms(1000);
ledA2 = 0;
delay_ms(1000);
ledA3 = 1;
__delay_ms(1000);
ledA3 = 0;
delay_ms(1000);
ledA4 = 1;
__delay_ms(1000);
ledA4 = 0;
delay_ms(1000);
ledA5 = 1;
__delay_ms(1000);
ledA5 = 0;
delay_ms(1000);
ledA6 = 1;
__delay_ms(1000);
ledA6 = 0;
delay_ms(1000);
ledA7 = 1;
__delay_ms(1000);
ledA7 = 0;
delay_ms(1000);
ledA8 = 1;
__delay_ms(500);
ledA8 = 0;
delay_ms(1000);
ledA9 = 1;
__delay_ms(1000);
ledA9 = 0;
delay_ms(1000);
ledA10 = 1;
__delay_ms(1000);
ledA10 = 0;
delay_ms(1000);
ledA11 = 1;
__delay_ms(1000);
ledA11 = 0;
delay_ms(1000);
ledA12 = 1;
__delay_ms(1000);
ledA12 = 0;
delay_ms(1000);
}
}
if(numb == 1){
ledB1 = 1;
ledB2 = 0;
ledB3 = 0;
ledB4 = 0;
ledB5 = 0;
ledB6 = 0;
ledB7 = 0;
ledB8 = 0;
ledB9 = 0;
ledB10 = 0;
ledB11 = 0;
ledB12 = 0;
}
if(numb == 2){
ledB1 = 1;
ledB2 = 1;
ledB3 = 0;
ledB4 = 0;
ledB5 = 0;
ledB6 = 0;
ledB7 = 0;
ledB8 = 0;
ledB9 = 0;
ledB10 = 0;
ledB11 = 0;
ledB12 = 0;
}
if(numb == 3){
ledB1 = 1;
ledB2 = 1;
ledB3 = 1;
ledB4 = 0;
ledB5 = 0;
ledB6 = 0;
ledB7 = 0;
ledB8 = 0;
ledB9 = 0;
ledB10 = 0;
ledB11 = 0;
ledB12 = 0;
}
if(numb == 4){
ledB1 = 1;
ledB2 = 1;
ledB3 = 1;
ledB4 = 1;
ledB5 = 0;
ledB6 = 0;
ledB7 = 0;
ledB8 = 0;
ledB9 = 0;
ledB10 = 0;
ledB11 = 0;
ledB12 = 0;
}
if(numb == 5){
ledB1 = 1;
ledB2 = 1;
ledB3 = 1;
ledB4 = 1;
ledB5 = 1;
ledB6 = 0;
ledB7 = 0;
ledB8 = 0;
ledB9 = 0;
ledB10 = 0;
ledB11 = 0;
ledB12 = 0;
}
if(numb == 6){
ledB1 = 1;
ledB2 = 1;
ledB3 = 1;
ledB4 = 1;
ledB5 = 1;
ledB6 = 1;
ledB7 = 0;
ledB8 = 0;
ledB9 = 0;
ledB10 = 0;
ledB11 = 0;
ledB12 = 0;
}
if(numb == 7){
ledB1 = 1;
ledB2 = 1;
ledB3 = 1;
ledB4 = 1;
ledB5 = 1;
ledB6 = 1;
ledB7 = 1;
ledB8 = 0;
ledB9 = 0;
ledB10 = 0;
ledB11 = 0;
ledB12 = 0;
}
if(numb == 8){
ledB1 = 1;
ledB2 = 1;
ledB3 = 1;
ledB4 = 1;
ledB5 = 1;
ledB6 = 1;
ledB7 = 1;
ledB8 = 1;
ledB9 = 0;
ledB10 = 0;
ledB11 = 0;
ledB12 = 0;
}
if(numb == 9){
ledB1 = 1;
ledB2 = 1;
ledB3 = 1;
ledB4 = 1;
ledB5 = 1;
ledB6 = 1;
ledB7 = 1;
ledB8 = 1;
ledB9 = 1;
ledB10 = 0;
ledB11 = 0;
ledB12 = 0;
}
if(numb == 10){
ledB1 = 1;
ledB2 = 1;
ledB3 = 1;
ledB4 = 1;
ledB5 = 1;
ledB6 = 1;
ledB7 = 1;
ledB8 = 1;
ledB9 = 1;
ledB10 = 1;
ledB11 = 0;
ledB12 = 0;
}
if(numb == 11){
ledB1=1;
ledB2 = 1;
ledB3 = 1;
ledB4 = 1;
ledB5 = 1;
ledB6 = 1;
ledB7 = 1;
ledB8 = 1;
ledB9 = 1;
ledB10 = 1;
ledB11 = 1;
ledB12 = 0;
}
if(numa == 12){
ledB1 = 1;
ledB2 = 1;
ledB3 = 1;
ledB4 = 1;
ledB5 = 1;
ledB6 = 1;
ledB7 = 1;
ledB8 = 1;
ledB9 = 1;
ledB10 = 1;
ledB11 = 1;
ledB12 = 1;
}
if(numb == 0){
ledB1 =0;
ledB2 = 0;
ledB3 = 0;
ledB4 = 0;
ledB5 = 0;
ledB6 = 0;
ledB7 = 0;
ledB8 = 0;
ledB9 = 0;
ledB10 = 0;
ledB11 = 0;
ledB12 = 0;
}
/*
quedasB=quedasB+1;
}
if(quedasB == 0){
AQ1 = 0;
AQ2 = 0;
AQ3 = 0;
}
if(quedasB == 1){
AQ1 = 0;
AQ2 = 0;
AQ3 = 1;
}
if(quedasB == 2){
AQ1 = 0;
AQ2 = 1;
AQ3 = 0;
}
if(quedasB == 3){
AQ1 = 0;
AQ2 = 1;
AQ3 = 1;
}*/
for (int j=1;j<3;j++)
{
ledB1 = 1;
__delay_ms(1000);
ledB1 = 0;
delay_ms(500);
ledB2 = 1;
__delay_ms(1000);
ledB2 = 0;
delay_ms(500);
ledB3 = 1;
__delay_ms(1000);
ledB3 = 0;
delay_ms(500);
ledB4 = 1;
__delay_ms(1000);
ledB4 = 0;
delay_ms(500);
ledB5 = 1;
__delay_ms(1000);
ledB5 = 0;
delay_ms(500);
ledB6 = 1;
__delay_ms(1000);
ledB6 = 0;
delay_ms(500);
ledB7 = 1;
__delay_ms(1000);
ledB7 = 0;
delay_ms(500);
ledB8 = 1;
__delay_ms(1000);
ledB8 = 0;
delay_ms(500);
ledB9 = 1;
__delay_ms(1000);
ledB9 = 0;
delay_ms(500);
ledB10 = 1;
__delay_ms(1000);
ledB10 = 0;
delay_ms(1000);
ledB11 = 1;
__delay_ms(1000);
ledB11 = 0;
delay_ms(500);
ledB12 = 1;
__delay_ms(1000);
ledB12 = 0;
delay_ms(500);
}
}
}