Teknisyen__
Üye
- Katılım
- 13 Mar 2016
- Mesajlar
- 82
- Puanları
- 1
- Yaş
- 36
okulda hocamız bir ödev verdi. Mikro C de 2X16 lcd panelde sıcaklık gösteren bir devre yapıpğı similasyonda çalıştırmamızı istedi kodların çoğu ders notunda var yazdık ama şöyle bir sıkıntı var lcd ekranda ismimizi kaydırmak istiyoruz acaba bunu nasıl yaparız kodlarımız bunlar ;
int temp1, temp2 ,sign;
char text[3];
sbit LCD_RS at RB4_bit;
sbit LCD_EN at RB5_bit;
sbit LCD_D4 at RB0_bit;
sbit LCD_D5 at RB1_bit;
sbit LCD_D6 at RB2_bit;
sbit LCD_D7 at RB3_bit;
sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D4_Direction at TRISB0_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;
void main(){
ADCON1 = 7;
PORTA = 0xFF;
PORTB = 0;
TRISA = 0xFF;
TRISB = 0;
LCD_Init();
LCD_Cmd(_LCD_CURSOR_OFF);
LCD_Out(1, 1, "Sicaklik");
while (1){
OW_Reset(PORTA, 0) ; 'reset sinyali
OW_Write(PORTA, 0, $CC) ; 'skip rom
OW_Write(PORTA, 0, $44) ; 'convert
Delay_ms(1000);
OW_Reset(PORTA, 0);
OW_Write(PORTA, 0, $CC) ; 'skip rom
OW_Write(PORTA, 0, $BE); 'read scratchpad
temp1 = OW_Read(PORTA, 0);
temp2 = OW_Read(PORTA, 0);
if (temp2 == 0xFF) {
sign = "-";
temp1 = not(temp1) + 0x01;
else
sign = "+";
}
temp2 =( (temp1) and (0x01) * 5 + 48);
temp1 = temp1 >> 1;
ByteToStr(temp1, text);
LCD_Chr(2, 9, sign);
LCD_Chr(2, 10 , text[0])
LCD_Chr(2, 11, text[1]);
LCD_Chr(2, 12, text[2]);
LCD_Chr(2, 13, ".");
LCD_Chr(2, 14, temp2);
LCD_Chr(2, 15, 223);
LCD_Chr(2, 16, "C");
Delay_ms(500);
}}}}
int temp1, temp2 ,sign;
char text[3];
sbit LCD_RS at RB4_bit;
sbit LCD_EN at RB5_bit;
sbit LCD_D4 at RB0_bit;
sbit LCD_D5 at RB1_bit;
sbit LCD_D6 at RB2_bit;
sbit LCD_D7 at RB3_bit;
sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D4_Direction at TRISB0_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;
void main(){
ADCON1 = 7;
PORTA = 0xFF;
PORTB = 0;
TRISA = 0xFF;
TRISB = 0;
LCD_Init();
LCD_Cmd(_LCD_CURSOR_OFF);
LCD_Out(1, 1, "Sicaklik");
while (1){
OW_Reset(PORTA, 0) ; 'reset sinyali
OW_Write(PORTA, 0, $CC) ; 'skip rom
OW_Write(PORTA, 0, $44) ; 'convert
Delay_ms(1000);
OW_Reset(PORTA, 0);
OW_Write(PORTA, 0, $CC) ; 'skip rom
OW_Write(PORTA, 0, $BE); 'read scratchpad
temp1 = OW_Read(PORTA, 0);
temp2 = OW_Read(PORTA, 0);
if (temp2 == 0xFF) {
sign = "-";
temp1 = not(temp1) + 0x01;
else
sign = "+";
}
temp2 =( (temp1) and (0x01) * 5 + 48);
temp1 = temp1 >> 1;
ByteToStr(temp1, text);
LCD_Chr(2, 9, sign);
LCD_Chr(2, 10 , text[0])
LCD_Chr(2, 11, text[1]);
LCD_Chr(2, 12, text[2]);
LCD_Chr(2, 13, ".");
LCD_Chr(2, 14, temp2);
LCD_Chr(2, 15, 223);
LCD_Chr(2, 16, "C");
Delay_ms(500);
}}}}