Mikrobasic Derleme Hatası

Katılım
6 Ara 2010
Mesajlar
31
Puanları
1
Yaş
35
merhaba arkadaşlar micro basicle ilgilenmeye başladım beti yanınlarının kitabını aldım fakat kitapda yazan kodları bile derlemiyo kodlar bunlar :
program MyProject1

TRISC = 0
lcd_init(portc)
lcd_out(1, 1,"text")
end.

hatalar bunlar
PRO for PIC\Examples\DENEME\MyProject1.mbas" MyProject1.mbas
4 304 Syntax error: Expected "end" but "TRISC" found MyProject1.mbas
4 304 Syntax error: Expected "." but "=" found MyProject1.mbas
0 102 Finished (with errors): 14 Eyl 2011, 17:27:50 MyProject1.mbppi
programı şölede denedim fakat yine olmadı


program MyProject1

main:
TRISC = 0
lcd_init(portc)
lcd_out(1, 1,"text")
end.
yardımlarınızı bekliyorum
 
Mikrobasic kullanmıyorum ama ilk gözüme çarpan eksikler:

-Kullandığınız değişkenleri tanımlamamışsınız

-Lcd ile ilgili pin tanımlamalarını yapmamışsınız

Şu kodu deneyin:


Kod:
program MyProject1


dim LCD_RS as sbit  at RB4_bit   'pin tanımlarını kendi devrenize göre değiştirin
    LCD_EN as sbit  at RB5_bit
    LCD_D4 as sbit  at RB0_bit
    LCD_D5 as sbit  at RB1_bit
    LCD_D6 as sbit  at RB2_bit
    LCD_D7 as sbit  at RB3_bit

    LCD_RS_Direction as sbit at TRISB4_bit
    LCD_EN_Direction as sbit at TRISB5_bit
    LCD_D4_Direction as sbit at TRISB0_bit
    LCD_D5_Direction as sbit at TRISB1_bit
    LCD_D6_Direction as sbit at TRISB2_bit
    LCD_D7_Direction as sbit at TRISB3_bit


dim txt1 as char[16]
    txt2 as char[9]
    txt3 as char[8]
    txt4 as char[7]
 
dim i as byte

sub procedure Move_Delay()      
  Delay_ms(500)                
end sub

main:
  TRISB = 0
  PORTB = 0xFF
  TRISB = 0xFF
  ANSEL  = 0                    
  ANSELH = 0

  txt1 = "mikroElektronika"
  txt2 = "EasyPIC6"
  txt3 = "Lcd4bit"
  txt4 = "example"

  Lcd_Init()                     ' Initialize Lcd
  Lcd_Cmd(_LCD_CLEAR)            ' Clear display
  Lcd_Cmd(_LCD_CURSOR_OFF)       ' Cursor off
  Lcd_Out(1,6,txt3)              ' Write text in first row
  Lcd_Out(2,6,txt4)              ' Write text in second row
  Delay_ms(2000)
  Lcd_Cmd(_LCD_CLEAR)            ' Clear display

  Lcd_Out(1,1,txt1)              ' Write text in first row
  Lcd_Out(2,5,txt2)              ' Write text in second row
  Delay_ms(500)

  ' Moving text
  for i=0 to 3                   ' Move text to the right 4 times
      Lcd_Cmd(_LCD_SHIFT_RIGHT)
      Move_Delay()
  next i

  while TRUE                     ' Endless loop
    for i=0 to 7                 ' Move text to the left 8 times
      Lcd_Cmd(_LCD_SHIFT_LEFT)
      Move_Delay()
    next i

    for i=0 to 7                 ' Move text to the right 8 times
      Lcd_Cmd(_LCD_SHIFT_RIGHT)
      Move_Delay()
    next i
  wend
end.





düzenleme: "dim i as byte" tanımı eklendi
 
Son düzenleme:
teşekkür ederim şimdi anladım kitapta sadece yukarıda yazdığım kodlar vardı değişken tanımlamaları olmadığın için hata veriyo saolaun hocam
 
28 303 Identifier "ANSEL" was not declared glcd.mbas
28 303 Identifier "ANSEL" was not declared glcd.mbas
28 304 Syntax error: Expected "end" but "ANSEL" found glcd.mbas
28 304 Syntax error: Expected "." but "=" found glcd.mbas
0 102 Finished (with errors): 14 Eyl 2011, 20:39:03 glcd.mbppi

hocam bu seferde böle bi hata veriyo
 
hocam buldum ansel 18f452 için kullanılmıyo adcon kullanılıyo yanlış anlamadıysam
 
hocam bu kodu kitapta buldum yukarıda tanımlamaları yapmadan çalıştırmışlar forumda fakat bende çalışmıyo tanımlamaları yapmadan bi türlü çözemedim yardımcı olabilrseniz çok sevinirim kod
Program _f877
Dim a as char[16]
Dim b as char[16]
main:
Trisb=0
lcd_init(portb)
lcd_cmd(lcd_clear)
lcd_cmd(lcd_cursor_off)
a="ELEKTRONIK"
b="Mikro"
LCD_OUT(1,1,a)
LCD_OUT(2,1,b)
end.
hatalar:

6 304 Syntax error: Expected ")" but "portb" found f877.mbas
6 304 Syntax error: Expected "end" but ")" found f877.mbas
7 304 Syntax error: Expected "." but "lcd_cmd" found f877.mbas
 
Son düzenleme:
hocam ben neden böle bi hata yaptığını sordum mikrobasici çöpe atıyım mı diye bişi sormadım kusra bakmayın
 
Sen bilirsin.
Bilen birinden gelen tavsiyeyi dinleyip dinlememek sana kalmış.
Adı üstünde tavsiye , dayatma değil.

Uslubun çok teşvik edici , herkes yardımına koşmak için can atacak .
 
Bu siteyi kullanmak için çerezler gereklidir. Siteyi kullanmaya devam etmek için onları kabul etmelisiniz. Daha fazla bilgi edin…