Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

animated Line/Graph on Grafic-Display?

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive
View previous topic :: View next topic  
Author Message
Kasch

Bascom Member



Joined: 18 Jun 2005
Posts: 33

PostPosted: Mon Jun 18, 2007 9:44 pm    Post subject: animated Line/Graph on Grafic-Display? Reply with quote

Hi,

i try to find a solution to make an aninmated line/graph (like a oszislscop) possible on a grafic display. I have something, realy simple. I read datas from an array and make with pset/line a line, wait 20ms and delete it. than i modifing the array, reads the new data and write it again with pset/line.
But it is flickering, it looks not good. does anybody how it make it more faster wihout flickering?
Thank you
Back to top
View user's profile
gumby

Bascom Member



Joined: 28 Apr 2006
Posts: 80

usa.gif
PostPosted: Tue Jun 19, 2007 12:45 am    Post subject: Reply with quote

yeah,

remove the 'wait 20ms'....







gumby
Back to top
View user's profile
Kasch

Bascom Member



Joined: 18 Jun 2005
Posts: 33

PostPosted: Tue Jun 19, 2007 6:08 am    Post subject: Reply with quote

nice, but than you see nothing, because the flickering is highest....
Back to top
View user's profile
gumby

Bascom Member



Joined: 28 Apr 2006
Posts: 80

usa.gif
PostPosted: Tue Jun 19, 2007 7:39 am    Post subject: Reply with quote

hi,


the graphic lcd display has it's own display ram for every pixel. once you turn a pixel on, it is on - it doesn't need the program to re-write it like a phosphor tv tube. once you write out the current pattern - don't write it again until you erase it by turning those same pixels off. imagine using 2 buffers to do this for speed and 'ping-pong' them. your loop should write out the current pattern from the 1st buffer- load the data for the next pattern in the 2nd buffer - write out the 2nd buffer pattern and then turn the previous pattern pixels off according to the 1st pixel buffer. then load the 1st buffer again & write out the new data. rinse, lather, repeat. the trick of course is that you'll have to logically compare the contents of the new data buffer with the previous one so that you don't turn off pixels that should be on during the 'erase cycle'. but at least this way there is always some data on the screen and the only thing you may see is a slight ghosting from the pattern just turning off. the slow response time of the lcd graphic display will actually help compensate for the time the cpu needs to load & write the data out & then erase the previous pattern. the more 'efficient' your loop is, the better the results will be. just one approach i'm sure...


good luck,



gumby


Last edited by gumby on Tue Jun 19, 2007 7:54 am; edited 1 time in total
Back to top
View user's profile
Kasch

Bascom Member



Joined: 18 Jun 2005
Posts: 33

PostPosted: Tue Jun 19, 2007 7:50 am    Post subject: Reply with quote

nice theorie, do you have a code example of this? thank you.
Back to top
View user's profile
gumby

Bascom Member



Joined: 28 Apr 2006
Posts: 80

usa.gif
PostPosted: Tue Jun 19, 2007 8:08 am    Post subject: Reply with quote

sorry no handy example of that one today but maybe google has some ideas.

i guess the other obvious caveat is that you'll have to 'paint' a smaller display section at a time if the display is large unless you have a cpu with a whole lot of static ram or you assign 4 pixels to each mapped point... great homework assignment though....






gumby
Back to top
View user's profile
Kasch

Bascom Member



Joined: 18 Jun 2005
Posts: 33

PostPosted: Tue Jun 19, 2007 8:18 am    Post subject: Reply with quote

with other words you has never been used it by yourself, you only think it is so possibly. okay, thank you for your help..


the others: has anyone experience, praticly experience with this?
Back to top
View user's profile
kimmi

Moderator



Joined: 24 Feb 2006
Posts: 1922
Location: Denmark

denmark.gif
PostPosted: Tue Jun 19, 2007 8:50 am    Post subject: Reply with quote

HI,
here is some code for 240x128 lcd
It read volt on a adc pin can set trigger speed (dont think you need that)


Code:
$regfile = "m128def.dat"
$crystal = 4000000
Config Graphlcd = 240 * 64 , Dataport = Porta , Controlport = Portc , Ce = 2 , Cd = 3 , Wr = 0 , Rd = 1 , Reset = 4 , Fs = 5 , Mode = 6
Config Adc = Single , Prescaler = Auto , Reference = Avcc
Start Adc
'Config Timer1 = Pwm , Pwm = 10 , Compare A Pwm = Clear Up , Prescale = 1
Cls
Cursor Off

Dim Volt As Single
Dim W As Word
Dim X As Integer
Dim Ly As Integer
Dim Lly As Integer
Dim Lx As Integer
Dim Llx As Integer
Dim Lf As Single
Dim Dw As Single
Dim T As String * 10
Dim Alo As Single
Dim Ahi As Single
Dim Trg As Integer
Dim Tcnt As Integer
Config Portd.0 = Input
Config Portd.1 = Input
Config Portd.2 = Input

Dim A As Integer
Lf = 5 / 53
Dw = 5 / 1023
Lx = 3
Llx = 3
Lly = 0
Alo = 5
Ahi = 0
Trg = 0
Tcnt = 10

' FRAME ON LCD
Line(1 , 1) -(239 , 1) , 255
Line(1 , 102) -(239 , 102) , 255
Line(1 , 1) -(1 , 102) , 255
Line(239 , 1) -(239 , 102) , 255


Locate 3 , 3
 Lcd "         TEST AVR ADC VOLT"
 Wait 1
 Cls Text


Do
:

If Tcnt >= Trg Then
   ' Write pos
   X = Lx - 1
   Line(x , 106) -(x , 108) , 0

   'adc use for input
   ' Write one
   W = Getadc(0)
  Volt = W * Lf
  Ly = Int(volt) '*********** Ly   is the add line Y to lcd
  Volt = W * Dw
  Volt = Volt + 10
  If Volt > Ahi Then                                        'VOLT HIGH
    Ahi = Volt
  End If
  If Volt < Alo Then                                        'VOLY LOW
   Alo = Volt
  End If


   Ly = 100 - Ly
   If Lly = 0 Then
     Lly = Ly
   End If
   Line(llx , Lly ) -(lx , Ly) , 255
   T = Fusing(volt , "#.###")
   Locate 15 , 1 : Lcd "V " ; T
   T = Fusing(ahi , "#.###")
   Locate 15 , 21 : Lcd "HI " ; T
   T = Fusing(alo , "#.###")
   Locate 15 , 31 : Lcd "LO " ; T
   Lly = Ly

   ' Set last X and incr LcdX
   Llx = Lx
   Incr Lx

   ' Wipe out One
   X = Lx
   Line(x , 2) -(x , 100) , 0
   Incr X
   Line(x , 2) -(x , 100) , 0

   ' End of track ?
   If Lx > 236 Then
     Lx = 3
     Llx = 3

   End If
 Tcnt = 0

 End If
Incr Tcnt
 Debounce Pind.0 , 1 , Trgu , Sub                           'trigger up button
 Debounce Pind.1 , 1 , Trgd , Sub                           'trigger down button
 Debounce Pind.2 , 1 , Rehilo , Sub                         'reset high low button
Loop


' TRIGGER SPEED
Trgu:
  Trg = Trg + 100
Locate 15 , 1 : Lcd "TRIG " ; "     "
Locate 15 , 1 : Lcd "TRIG " ; Trg
Return

Trgd:

  Trg = Trg - 100
  If Trg < 0 Then Trg = 0
Locate 15 , 1 : Lcd "TRIG " ; "     "
Locate 15 , 1 : Lcd "TRIG " ; Trg
Return
Rehilo:
  Alo = 15
  Ahi = 0
Return
 

_________________
/ Kim
Back to top
View user's profile Visit poster's website MSN Messenger
Kasch

Bascom Member



Joined: 18 Jun 2005
Posts: 33

PostPosted: Tue Jun 19, 2007 9:04 am    Post subject: Reply with quote

and this is realy without flickering? a smooth animation? i can't believe it, because i using a system like that. painting, removing and painting on new position.

i have a 8MHZ-System with a KS108-Display. Is my sytem not fast enough?
Back to top
View user's profile
kimmi

Moderator



Joined: 24 Feb 2006
Posts: 1922
Location: Denmark

denmark.gif
PostPosted: Tue Jun 19, 2007 9:07 am    Post subject: Reply with quote

hi,
i have smooth animation on the lcd

_________________
/ Kim
Back to top
View user's profile Visit poster's website MSN Messenger
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    www.mcselec.com Forum Index -> BASCOM-AVR Archive All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum