![]() |
Forum Index : Microcontroller and PC projects : MM2: Digital picture frame, fast display
Author | Message | ||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10180 |
Open here to see the code in action This code uses my favourite 4.3" SSD1963 display and the paged driver running on a 44-pin Micromite to achieve instantaneous updating of pictures on the display. It also uses the overlay text capability of the driver to superimpose the time and date on the pictures. The pictures are read off SD card and must be in binary PPM format. The code reads the directory off the SD card and displays all pictures found in sequence. The display duration of each picture is controlled through a global constant. The code below comprises two files. The first contains the display and SDcard drivers which are stored in the library. The second contains the simple main program and specific functions. 2016-04-08_181401_pictures.zip The main program really is trivial: option explicit
option default none ' ' Electronic picture frame using 44-pin Micromite ' const mount=0 const fileopen=1 const readfile=2 const writefile=3 const opendir=4 const readdir=5 ' const CS_PIN=32 'Chip select pin conected to the SD card const filename = 1 'set to 0 for no filaname const rate = 5 ' number of seconds for each pic to show, must be >=5 dim pics$(200) length 18, s$ length 18 dim integer i,num=0,page%,offset,nt if(SDcard(mount,CS_PIN)) THEN : Print "Unable to mount Disk" : END : ENDIF ' open directory if(SDcard(opendir,"")) THEN : Print "Unable to open directory" : END : ENDIF font 8 'read the directory do s$="" i=SDcard(readdir,s$) if i>0 then : Print "Unable to read directory" : END : ENDIF if i=0 and right$(s$,4)=".PPM" then pics$(num)=s$ num=num+1 endif loop while i<>-1 cls ssd1963 2 'display the second page page%=0 'set write to the first page nt=val(right$(time$,2)) if num<>0 then i=0 do nt=nt+rate: if nt>59 then nt=nt-60 offset=page%*272 box 0,offset,mm.Hres,272,0,0,0 'clear the page to be written displaypicture(pics$(i),0,0,offset) do loop while val(right$(time$,2))<>nt text mm.hres,272+offset,space$(8)+date$,RB,,,rgb(white),1 text 0,272+offset,time$,LB,,,rgb(white),1 i=i+1 i=i mod num ssd1963 page%+1 page%=(page%+1) mod 2 loop endif end To use the display driver on the 44-pin Micromite see this thread To use the SD card drivers see this thread |
||||
plasma Guru ![]() Joined: 08/04/2012 Location: GermanyPosts: 437 |
haha i see you cnc @0.15. also i think i can hear it in the background. have you some files for the wooden clock ? ![]() cool work. |
||||
Chris Roper Senior Member ![]() Joined: 19/05/2015 Location: South AfricaPosts: 280 |
It got one of the pictures upside down :) Now I see the need for a true 9 degrees of freedom Artificial Horizon instrument. Cheers Chris http://caroper.blogspot.com/ |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |