avatar_Hattuşa

ekrana grafik basma

Başlatan Hattuşa, 15 Mart 2015, 14:47:25

Hattuşa

slm arkadaşlar;
aşağıdaki linkteki gibi bir grafik basmak istedim, başlangıçta tamam adc değerim oranınca şekli çiziyorum. sorun şu (ben çizgiyi sağdan sola doğru çizdiriyorum. (120 den 0 a doğru) )
0 noktasına geldiğinde linkteki gibi sinyalin kaymasını istiyorum ama başaramadım, daha doğrusu nasıl bir algoritma geliştirmeliyim, aklıma gelmedi.
https://www.youtube.com/watch?v=dExNSTW1lbA
https://www.youtube.com/watch?v=B-7_FLvz2NM

konu ile alakalı simüle dosyası ve bas dosyası ektedir. yardımcı olacak arkadaşlara şimdiden tşk ederim.

Hattuşa

hiç bir fikri olan yokmu

gergy

#2
Alıntı yapılan: pro-TR - 16 Mart 2015, 13:22:29
hiç bir fikri olan yokmu

Ben ekte sizin kod üzerinde gerekli düzenlemeyi yaparak ve protondaki lcdread ve lcdwrite komutlarını kullanarak ram'e frame buffer alan (ekranı belleğe tamponlayan) bir kod kullandım. İlk videodaki gibi sağdan sola doğru veriyi kaydırarak yazdırabiliyorsunuz, gerisini sanırım siz getirirsiniz.


Device 18F2520
Config_Start
   OSC = HS'HSPLL ; HS oscillator, PLL enabled (Clock Frequency=4 x FOSC1)
   FCMEN = OFF ; Fail-Safe Clock Monitor disabled
   IESO = OFF ; Oscillator Switchover mode disabled
   PWRT = OFF ; PWRT disabled
   BOREN = OFF ; Brown-out Reset disabled in hardware and software
   WDT = OFF ; WDT disabled (control is placed on the SWDTEN bit)
   MCLRE = On ; MCLR pin enabled; RE3 input pin disabled
   LPT1OSC = OFF ; Timer1 configured for higher power operation
   PBADEN = OFF ; PORTB<4:0> pins are configured as digital I/O on Reset
   CCP2MX = PORTC ; CCP2 input/output is multiplexed with RC1
   STVREN = OFF ; Stack full/underflow will not cause Reset
   LVP = OFF ; Single-Supply ICSP disabled
   XINST = OFF ; Instruction set extension and Indexed Addressing mode disabled (Legacy mode)
   Debug = OFF ; Background debugger disabled, RB6 and RB7 configured as general purpose I/O pins
Config_End
Xtal 8
'Declare PLL_Req TRUE
    Declare All_Digital =0
Include "FONT.INC"   
Declare LCD_DTPort =PORTB
Declare LCD_ENPin =PORTC.5
Declare LCD_RWPin =PORTC.4
Declare LCD_RSPin =PORTC.3
Declare LCD_CS1Pin =PORTC.6
Declare LCD_CS2Pin =PORTC.7
Declare LCD_Type = Graphic
Declare Internal_Font =On
'Declare GLCD_CS_Invert =On
Declare Font_Addr = 0
'Declare GLCD_Strobe_Delay 100
Cls
DelayMS 50
TRISA =%00000111
TRISB =%00000000
TRISC =%00000000
PORTA =0
PORTB =0
PORTC =0

ADCON0 =%00000001
ADCON1 =%00001110   '1 kanal secili
ADCON2 =%10000110 

Declare Adin_Res 10         ' 10-bit result required      '-----------------------bvuraya hexi yüklerken baaaaaaaaaaaaak
Declare Adin_Tad FRC'64_FOSC       ' RC OSC chosen
Declare Adin_Stime 40   ' Allow 50us sample time



Dim AdC As Word
'Dim X As Byte
'Dim Y As Byte
Dim SaY As Word     ':SaY =120
Dim SoN As Byte
'Dim SsO[120] As Byte
Dim OkU[1024] As Byte
Dim XpOs As Byte
Dim YpOs As Byte


MaIN:

AdC =ADIn 0
DelayUS 20
SoN =64 -(AdC /16)
 
Plot SoN, 127

SaY=0
XpOs=0
YpOs=0
Repeat
    OkU[SaY]=LCDRead YpOs,XpOs
    Inc SaY
    Inc YpOs
    If YpOs>7 Then YpOs=0 : Inc XpOs
Until SaY > 1023

Line 0,127,0,127,63

SaY=8
XpOs=0
YpOs=0
Repeat
    LCDWrite YpOs,XpOs,[OkU[SaY]]
    Inc SaY
    Inc YpOs
    If YpOs>7 Then YpOs=0 : Inc XpOs
Until SaY > 1023

GoTo MaIN

End

gergy


Powered by EzPortal