PIC+GLCD

Başlatan Ankaralı, 03 Eylül 2010, 00:19:39

Ankaralı

Bir tane dikdörtgen çizdirtmek için bu kadar kod mu yazmalıyım? Ya sinüs çizdirtmek isteseydim?????

For xpos = 20 To 100
 Plot 20 , xpos 
 DelayMS 10 
 Next
For ypos= 20 To 40
 Plot ypos,20
 DelayMS 10
 Next
 For xpos = 20 To 100
 Plot 40 , xpos 
 DelayMS 10 
 Next
For ypos= 20 To 40
 Plot ypos,100
 DelayMS 10
 Next

End


Yokmudur protonda basit bir yolu...
İyi çalışmalar.
@ NEXYS2

muhittin_kaplan

plot neden kullanıyorsunuz ?
line,circle,box komutlarını inceleyiniz.

Ankaralı

Muhittin hocam iyi akşamlar.

Abicim bu basit şekilleri biraz uzun kod yazarakda halledebileceğimi göstermekdi amaç, ancak ya sinüs çizdirtmek isteseydim yada picin analog portundan okuduğum sinyali örnekleyip göstermek isteseydim nasıl yapabilirdim bunu sormak istedim aslında. En basitinden bir sinüs nasıl çizdirtebilirim ?
@ NEXYS2

muhittin_kaplan

plot ve unplot kullanmak gerekir.Bbildiğim başka yolu yok.

ahmet2004


Ankaralı

#5
Alıntı yapılan: muhittin_kaplan - 03 Eylül 2010, 23:16:55
plot ve unplot kullanmak gerekir.Bbildiğim başka yolu yok.

Belki 50den fazla deneme yaptım ancak adam gibi bişey çizdiremedim Muhittin hocam.





glcd_pixel(dongu, 210-x, ON);
glcd_pixel(dongu+1, (210-x), ON);
     
      glcd_pixel(dongu, (210-x)+1, ON);
      glcd_pixel(dongu+1, (210-x)+1, ON);
   }
      delay_ms(100);
      glcd_fillScreen(OFF);
  }
}
     


Ahmet hocam öncelikle Teşekkür ederim.Bu glcd_pixel denen komut basicdeki plot' a karşılık gelen bişeymidir tam anlayamadım.
@ NEXYS2

muhittin_kaplan

Sanırım GLCD_PIXEL, protonda plot a denk geliyor.
sonrası sizin noktaları nereye koyacağınıza dair algoritmaya kalıyor (ahmet hocanınki çevrilebilinir)

Ankaralı

biraz kasayım hele hocam ne çıkacak yarına
@ NEXYS2

ahmet2004

#8
Büyük ihtimalle değişkenlerin hepsini tamsayı olarak kullandın.


128*64 Glcd için örnek kod aşağıda (18 değeri değiştirilerek peryot süresi değiştirilir.)

Dim k As Float
Dim j As Float
Dim y As Float
Dim t As Float
Dim x As Byte


 For x = 1 To 126
     k = x
     t = Sin(k / 18)
     y = t * 31 + 31
     Plot y , k
 Next



Sonuç:



OG

Alıntı YapAdded commands ISin, ICos, and ISqr for integer Sine, Cosine, and Square Root.  3.5.0.5 of the Proton Compiler. (20th June 2010)

ISin
Syntax
Assignment Variable = ISin Variable
Overview
Deduce the integer Sine of an integer value
Operators
Assignment Variable can be any valid variable type.
Variable can be a constant, variable or expression that requires the Sine extracted. The value
expected and returned by ISin is in decimal radians (0 to 255).
Example
Include "Proton18_4.Inc" ' Use the Proton board for the demo
Dim ByteIn as Byte ' Holds the value to Sin
Dim ByteOut as Byte ' Holds the result of the Sin
DelayMs 100 ' Wait for the LCD to stabilise
Cls ' Clear the LCD
ByteIn = 123 ' Load the variable
ByteOut = ISin ByteIn ' Extract the Sin of the value
Print Dec ByteOut ' Display the result
Stop
ICos
Syntax
Assignment Variable = ICos Variable
Overview
Deduce the integer Cosine of an integer value
Operators
Assignment Variable can be any valid variable type.
Variable can be a constant, variable or expression that requires the Cosine extracted. The
value expected and returned by ICos is in decimal radians (0 to 255).
Example
Include "Proton18_4.Inc" ' Use the Proton board for the demo
Dim ByteIn as Byte ' Holds the value to Cos
Dim ByteOut as Byte ' Holds the result of the Cos
DelayMs 100 ' Wait for the LCD to stabilise
Cls ' Clear the LCD
ByteIn = 123 ' Load the variable
ByteOut = ICos ByteIn ' Extract the ICos of the value
Print Dec ByteOut ' Display the result
Stop

Isqr
Syntax
Assignment Variable = ISqr Variable
Overview
Deduce the integer Square Root of an integer value
Operators
Assignment Variable can be any valid variable type.
Variable can be a constant, variable or expression that requires the Squrare Root extracted.
Example
Include "Proton18_4.Inc" ' Use the Proton board for the demo
Dim ByteIn as Byte ' Holds the value to Sqr
Dim ByteOut as Byte ' Holds the result of the Sqr
DelayMs 100 ' Wait for the LCD to stabilise
Cls ' Clear the LCD
ByteIn = 123 ' Load the variable
ByteOut = ISqr ByteIn ' Extract the Sqr of the value
Print Dec ByteOut ' Display the result
Stop





page 99
http://hotfile.com/dl/66879985/8f03db3/1_-_Proton_Compiler_Manual.rar.html
FORUMU İLGİLENDİREN KONULARA ÖM İLE CEVAP VERİLMEZ.

teknikelektronikci

Alıntı yapılan: ahmet2004 - 04 Eylül 2010, 06:50:38
Büyük ihtimalle değişkenlerin hepsini tamsayı olarak kullandın.


128*64 Glcd için örnek kod aşağıda (18 değeri değiştirilerek peryot süresi değiştirilir.)

Dim k As Float
Dim j As Float
Dim y As Float
Dim t As Float
Dim x As Byte


 For x = 1 To 126
     k = x
     t = Sin(k / 18)
     y = t * 31 + 31
     Plot y , k
 Next



Sonuç:
(Resim gizlendi görmek için tıklayın.)

(Resim gizlendi görmek için tıklayın.)

biraz matematik bilmenin faydasi :)
Ey Türk istikbalinin evlâdı! İşte, bu ahval ve şerâit içinde dahi, vazifen; Türk İstiklâl ve Cumhuriyetini kurtarmaktır! Muhtaç olduğun kudret, damarlarındaki asil kanda mevcuttur!

Ankaralı

Yok ahmet hocam gönderdiğiniz program çalışmadı.
Resmi;



[img=http://img1.loadtr.com/k-621467-afda.jpg][/img]
@ NEXYS2

ahmet2004

Canın sağolsun program senden önemlimi.

Ankaralı

Eyvallah hocam sağolasın...
@ NEXYS2

muhittin_kaplan

modifiye ettiğiniz programı koyarmısınız