Desenarea functiilor sinus si cosinus pe GLCD cu PIC16F887
Desenarea functiilor sinus si cosinus pe GLCD cu PIC16F887
char GLCD_DataPort at PORTD;
sbit GLCD_CS1 at RB0_bit;
sbit GLCD_CS2 at RB1_bit;
sbit GLCD_RS at RB2_bit;
sbit GLCD_RW at RB3_bit;
sbit GLCD_EN at RB4_bit;
sbit GLCD_RST at RB5_bit;sbit GLCD_CS1_Direction at TRISB0_bit;
sbit GLCD_CS2_Direction at TRISB1_bit;
sbit GLCD_RS_Direction at TRISB2_bit;
sbit GLCD_RW_Direction at TRISB3_bit;
sbit GLCD_EN_Direction at TRISB4_bit;
sbit GLCD_RST_Direction at TRISB5_bit;}
void main() {
int ii;Glcd_Init();
Glcd_Fill(0x00);Glcd_Rectangle(0, 0, 127, 63, 1);
Glcd_H_Line(0, 127, 31, 2);
Glcd_V_Line(0, 63, 63, 2);while(1) {
Glcd_Write_Text(“sin”, 1, 0, 0);
for (ii=0; ii<127; ii++){
Glcd_Dot(ii,32+(sin(((ii*2.85)*3.14)/180)*31),2);
delay_ms(1);
}Glcd_Write_Text(” “, 1, 0, 0);
Glcd_Write_Text(“cos”, 1, 0, 0);
for (ii=0; ii<127; ii++){
Glcd_Dot(ii,32+(cos(((ii*2.85)*3.14)/180)*31),2);
delay_ms(1);
}
}
}
}
