Anda di halaman 1dari 3

// ------------------------------------------------------

// GLCD Picture name: Imagen_02.bmp


// GLCD Model: KS0108 128x64
// ------------------------------------------------------

unsigned char const Imagen_02_bmp[1024] = {


0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,128,
192, 64,224,224,224,240,224,224,224,192,192,128, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 56, 64, 64,120, 0, 0, 0,124, 36, 24, 0, 0,
64, 88,116, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 56,255,254,
255,211,193, 67,195, 1,195,195,195,131, 39,255,254, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 48,208, 0,160, 96,224, 0,240, 0,224, 96, 64, 0,
96,128,224, 0,160, 96,224, 0,224, 32,224, 0,224, 32,224, 0,
96,160, 0, 0, 0,144,112, 0,224,144,144, 96, 16,240, 0, 0,
240, 80,240, 0,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, 0, 0, 0, 0, 0, 0, 0, 0
};

//Declarations------------------------------------------------------------------
const code char truck_bmp[1024];
//--------------------------------------------------------------end-declarations

// Glcd module connections


char GLCD_DataPort at PORTB;

sbit GLCD_CS1 at RD0_bit;


sbit GLCD_CS2 at RD1_bit;
sbit GLCD_RS at RD2_bit;
sbit GLCD_RW at RD3_bit;
sbit GLCD_EN at RD4_bit;
sbit GLCD_RST at RD5_bit;

sbit GLCD_CS1_Direction at TRISD0_bit;


sbit GLCD_CS2_Direction at TRISD1_bit;
sbit GLCD_RS_Direction at TRISD2_bit;
sbit GLCD_RW_Direction at TRISD3_bit;
sbit GLCD_EN_Direction at TRISD4_bit;
sbit GLCD_RST_Direction at TRISD5_bit;
// End Glcd module connections
bit oldstate, oldstate1;
bit onoff;
int cont=0,cont1=0,pot,radio;
int x,y;
void main() {
trisc.f0=1;
trisc.f1=1;
trisc.f7=0;
ADCON1=13;
Glcd_Init(); // Initialize GLCD
Glcd_Fill(0x00); // Clear GLCD
oldstate=0;
oldstate1=0;
while(1) {
if (Button(&PORTC, 0, 1, 1)) oldstate = 1;
if (oldstate && Button(&PORTC, 0, 1, 0)) {
onoff=~onoff;
cont=1;
oldstate = 0;
}
if (Button(&PORTC, 1, 1, 1)) oldstate1 = 1;
if (oldstate1 && Button(&PORTC, 1, 1, 0)) {

cont1=1;
oldstate1 = 0;
}

if(onoff){
if(cont==1){
portc.f7=0;
Glcd_Image(Imagen_02_bmp);
Glcd_Write_Text("Jami Herrera", 0, 5, 1);
Glcd_Write_Text("Christian Alexander", 0, 6, 1);
Glcd_Write_Text("Grupo 1", 0, 7, 1);
delay_ms(5000);
Glcd_Fill(0x00);
}
cont=0;
if(cont1==1){
Glcd_Line(64-x,31+y , 64+x, 31+y, 0);
Glcd_Line(64-radio,31,64-x,31+y , 0);
Glcd_Line(64-radio,31,64-x,31-y , 0);
Glcd_Line(64-x,31-y , 64+x, 31-y, 0);
Glcd_Line(64+x, 31-y,64+radio,31, 0);
Glcd_Line(64+radio,31,64+x,31+y, 0);
Glcd_Circle(64, 31, radio, 0);
pot=Adc_Read(0);
radio=pot*0.0303030303030;
// Draw a circle with center in (50,50) and radius=10
Glcd_Circle(64, 31, radio, 1);
x=radio*sin(0.52359877);
y=radio*cos(0.52359877);
Glcd_Line(64-x,31+y , 64+x, 31+y, 1);
Glcd_Line(64-radio,31,64-x,31+y , 1);
Glcd_Line(64-radio,31,64-x,31-y , 1);
Glcd_Line(64-x,31-y , 64+x, 31-y, 1);
Glcd_Line(64+x, 31-y,64+radio,31, 1);
Glcd_Line(64+radio,31,64+x,31+y, 1);

}
cont1=0;

}else{
portc.f7=1;
Glcd_Fill(0x00);
}

}
}

Anda mungkin juga menyukai