7 inch display board

From MCS Wiki
Revision as of 11:31, 26 February 2013 by Admin (Talk | contribs)
Jump to: navigation, search

Contents

Description

Hardware

  • WIZFI210 Wireless network 
  • ITRAX300 GPS 
  • BTM220 Class 1 bluetooth 
  • Bluegiga WT41 1 kilometer bluetooth 
  • SCP1000 barometer 
  • DS1337 clock with battery backup 
  • RS232 
  • Alvidi AVRB Atxmega128A1 module 
  • 7 inch display 
  • FT232RL USB

Pictures

7inch display5.jpg

Source code

Include a PDF-file for the 7 inch display and some pictures for the Alvidi on-board SD-card : File:Ssd1963 7inch.zip


Example of main program:

'*******************************************************************************
'
' Copyright Michael Koecher aka six1 8/2010
' -> http://www.six1.net/ michael@koecher-web.de
'
' http://creativecommons.org/licenses/by-sa/3.0/de/
' Original nur von http://bascom-forum.de
' Sie dürfen:
'
' * das Werk bzw. den Inhalt vervielfältigen, verbreiten und öffentlich zugänglich machen
'
' * Abwandlungen und Bearbeitungen des Werkes bzw. Inhaltes anfertigen
'
' Zu Den Folgenden Bedingungen:
'
' * Namensnennung.
' Sie müssen den Namen des Autors/Rechteinhabers in der von ihm festgelegten Weise nennen.
'
' * Keine kommerzielle Nutzung.
' Dieses Werk darf nicht für kommerzielle Zwecke verwendet werden.
'
' * Weitergabe unter gleichen Bedingungen.
' Wenn Sie das lizenzierte Werk bzw. den lizenzierten Inhalt bearbeiten
' oder in anderer Weise erkennbar als Grundlage für eigenes Schaffen verwenden,
' dürfen Sie die daraufhin neu entstandenen Werke bzw. Inhalte nur
' unter Verwendung von Lizenzbedingungen weitergeben, die mit denen
' dieses Lizenzvertrages identisch oder vergleichbar sind.
'
' Wobei gilt:
'
' * Verzichtserklärung
' Jede der vorgenannten Bedingungen kann aufgehoben werden, sofern Sie
' die ausdrückliche Einwilligung des Rechteinhabers dazu erhalten.
'
' * Sonstige Rechte
' Die Lizenz hat keinerlei Einfluss auf die folgenden Rechte:
' - Die gesetzlichen Schranken des Urheberrechts und sonstigen
' Befugnisse zur privaten Nutzung
' - Das Urheberpersönlichkeitsrecht des Rechteinhabers
' - Rechte anderer Personen, entweder am Lizenzgegenstand selber oder
' bezüglich seiner Verwendung, zum Beispiel Persönlichkeitsrechte abgebildeter Personen.
'
' Hinweis
'
' Im Falle einer Verbreitung müssen Sie anderen alle Lizenzbedingungen
' mitteilen, die für dieses Werk gelten. Am einfachsten ist es,
' einen Link auf http://creativecommons.org/licenses/by-sa/3.0/de/ einzubinden.
'
'
'*******************************************************************************
'auf Treiber IC SSD1963 geändert 26.11.2011
'10.09.2012 angepast für Display Typ AT070TN90
'Hkipnik@aol.com
'*******************************************************************************
 
$regfile = "xm128a1def.dat"
$hwstack = 200
$swstack = 200
$framesize = 500
$crystal = 32000000
 
Config Osc = Enabled , 32mhzosc = Enabled
Config Sysclock = 32mhz '--> 32MHz
 
'*******************************************************************************
 
 Config Osc = Disabled , 32mhzosc = Enabled
 Osc_pllctrl = &B10_0_00100
 Do
 Loop Until Osc_status.1 = 1 'Check if RC2MRDY is ready '
 'enable PLL
 Set Osc_ctrl.4 'PLL enable
 'configure the systemclock
 Config Sysclock = Pll , Prescalea = 1 , Prescalebc = 1_1 'use PLL
 
 Stop Watchdog
'*******************************************************************************
 
'*******************************************************************************
'Touch Interrupt
'*******************************************************************************
Const Use_touch = 1 'use Touch = 1
#if Use_touch = 1
 Config Pinf.0 = Input 'Set PINF.4 as Input
 'Because of the activated Pullup the PIN Level is high and there is a falling edge when switch is pressed
 Config Xpin = Portf.0 , Outpull = Pullup , Sense = Falling 'enable Pull up and reaction on falling edge
 
 Portf_int0mask = &B0000_0001 'include PIN0 in INT0 Mask
 Portf_intctrl = &B0000_00_01
 '^ 'Low Level INT0 Interrupt
 
 Dim Touch_flag As Bit
 Touch_flag = 0
 On Portf_int0 Touch_int
 Enable Portf_int0 , Lo
#endif
'*******************************************************************************
 Config Priority = Static , Vector = Application , Lo = Enabled , Med = Enabled
 
 
 Config Com5 = 57600 , Mode = Asynchroneous , Parity = None , Stopbits = 1 , Databits = 8
 Open "COM5:" For Binary As #1
 
 Print #1 , "Graphic 800x480"
'*******************************************************************************
 $include "SSD1963_declarations.inc"
 $include "SSD1963__sd-card_declarations.inc"
'*******************************************************************************
 Call Sdcard_initialize()
'*******************************************************************************
 'use for Demo
 Dim Farbe As Word , Countx As Word , Xx1 As Word , Xx2 As Word , Yy1 As Word , Yy2 As Word , Penwidth As Byte , Box_fill As Byte , Show_border As Byte , Radius As Word
 Dim Help_str As String * 10
 
'*******************************************************************************
'Start SSD1963
'*******************************************************************************
 Call Ssd1963_init()
'*******************************************************************************
 
 Enable Interrupts
 
'*** MAIN **********************************************************************
 Do
 Call Lcd_clear(blue)
 Call Lcd_text( "Clear area" , 230 , 20 , 1 , Yellow , Blue)
 
 Call Lcd_clear_area(100 , 100 , 200 , 200 , White)
 Wait 2
 Call Lcd_clear_area(1 , 1 , 200 , 200 , White)
 Wait 2
 Call Lcd_clear(red)
 Call Lcd_text( "BMP 800x480 hallo world" , 100 , 224 , 1 , Gold , Black)
 Call Lcd_text( "BMP 800x480 hallo world" , 20 , 20 , 2 , Yellow , Red)
 Wait 1
 
 Call Lcd_clear(black)
 Call Lcd_draw_bmp( "frau5.bmp" , 200 , 0) '24Bit
 Wait 1
 Call Lcd_clear(red)
 Call Lcd_draw_bmp( "tieger5.bmp" , 1 , 0) '24Bit
 Call Lcd_text_trans( "24Bit Bmp" , 310 , 100 , 1 , Red , Transparent)
 Wait 1
 Call Lcd_clear(red)
 Call Lcd_draw_bmp( "tieg8bit.bmp" , 0 , 0) '8Bit
 Call Lcd_text_trans( "8Bit Bmp" , 310 , 100 , 1 , Red , Transparent)
 Wait 1
 Call Lcd_draw_bmp( "frau5.bmp" , 200 , 0) '24Bit
 Wait 1
 
 Call Lcd_draw_bmp( "pic18bit.bmp" , 0 , 0) '8Bit
 Call Lcd_text_trans( "8Bit Bmp" , 310 , 100 , 1 , Red , Transparent)
 Wait 1
 Call Lcd_clear(red)
 Call Lcd_draw_bmp( "pic28bit.bmp" , 0 , 0) '8Bit
 Call Lcd_text_trans( "8Bit Bmp" , 310 , 100 , 1 , Red , Transparent)
 
 Wait 3
 Call Lcd_negate(0)
 Call Lcd_text_trans( "negate" , 310 , 200 , 1 , Red , Transparent)
 Wait 3
 Call Lcd_negate(1)
 
 Wait 3
 Call Lcd_clear(red)
 Call Lcd_draw_bmp( "test8bit.bmp" , 0 , 0) '8Bit
 Wait 1
 
 Call Lcd_clear(blue)
 
#if Use_touch = 1
 Call Lcd_box(700 , 420 , 790 , 470 , Red , White , 1 , 1)
 Call Lcd_box(100 , 100 , 105 , 105 , Red , White , 1 , 1)
 Call Lcd_text( "Touch me" , 390 , 10 , 2 , Yellow , Black)
 Call Lcd_text( "next" , 720 , 435 , 2 , Yellow , Red)
 Do
 If Touch_flag = 1 Then
 
 Touchx = 0
 Touchy = 0
 Call Lcd_read_touch()
 
 Select Case Touchx
 Case 570 To 630 :
 If Touchy > 5 And Touchy < 65 Then
 Ende = 1
 End If
 End Select
 
 
 If Ende = 1 Then
 Ende = 0
 Exit Do
 End If
 Touch_flag = 0
 End If
 
 Loop
#endif
 
 Call Lcd_clear(black)
 
 Call Lcd_text( "LINE" , 390 , 10 , 2 , Yellow , Black)
 For Countx = 1 To 100
 Farbe = Rnd(10)
 Xx1 = Rnd(740)
 Xx2 = Rnd(740)
 Yy1 = 90 + Rnd(300)
 Yy2 = 90 + Rnd(300)
 Penwidth = Rnd(4)
 Penwidth = Rnd(4)
 Call Lcd_line(xx1 , Yy1 , Xx2 , Yy2 , Penwidth , Color_array(farbe))
 Next
 
 Wait 2
 Call Lcd_clear(black)
 
 Call Lcd_text( "BOX FILL" , 390 , 10 , 2 , Yellow , Black)
 
 For Countx = 1 To 100
 Xx1 = Rnd(740)
 Xx2 = Rnd(740)
 Yy1 = 90 + Rnd(300)
 Yy2 = 90 + Rnd(300)
 Farbe = Rnd(10)
 Box_fill = Rnd(100)
 If Box_fill < 50 Then Box_fill = 0
 Show_border = Rnd(100)
 If Show_border < 70 Then Show_border = 0
 Call Lcd_box(xx1 , Yy1 , Xx2 , Yy2 , Color_array(farbe) , White , Box_fill , 1)
 Next
 Wait 2
 Call Lcd_clear(black)
 
 Call Lcd_text( "BOX" , 390 , 10 , 2 , Yellow , Black)
 
 For Countx = 1 To 100
 Xx1 = Rnd(740)
 Xx2 = Rnd(740)
 Yy1 = 90 + Rnd(300)
 Yy2 = 90 + Rnd(300)
 Farbe = Rnd(10)
 Call Lcd_box(xx1 , Yy1 , Xx2 , Yy2 , White , Color_array(farbe) , 0 , 1)
 Next
 Wait 2
 
 Call Lcd_clear(black)
 Call Lcd_text( "Circle" , 370 , 10 , 2 , Yellow , Black)
 For Countx = 1 To 100
 Xx1 = 40 + Rnd(640)
 Yy1 = 20 + Rnd(400)
 Radius = Rnd(50)
 Farbe = Rnd(10)
 Call Lcd_drawcircle(xx1 , Yy1 , Radius , 100 , 2 , Color_array(farbe))
 Next
 Wait 2
 Call Lcd_clear(black)
 Call Lcd_text( "Circle Fill" , 370 , 10 , 2 , Yellow , Black)
 For Countx = 1 To 100
 Xx1 = 50 + Rnd(540)
 Yy1 = 80 + Rnd(300)
 Radius = Rnd(50)
 Farbe = Rnd(10)
 Call Lcd_fill_circle(xx1 , Yy1 , Radius , Color_array(farbe))
 Next
 Wait 2
 Call Lcd_clear(black)
 
 Call Lcd_text( "BMP 320x240" , 330 , 10 , 2 , Yellow , Black)
 Call Lcd_draw_bmp( "sylt1.bmp" , 240 , 100)
 Wait 1
 Call Lcd_draw_bmp( "tieger5.bmp" , 0 , 0)
 
 Call Lcd_setscrollarea(0 , 480 , 0)
 For Countx = 0 To 479
 Call Lcd_scroll(countx)
 Waitms 2
 Next
 For Countx = 479 To 0 Step -1
 Call Lcd_scroll(countx)
 Waitms 2
 Next
 
 Wait 2
 Call Lcd_clear(black)
 Loop
End
#if Use_touch = 1
Touch_int:
 Touch_flag = 1
 ' Print #1 , "Touch"
Return
#endif
 
'*******************************************************************************
 
 $include "SSD1963__sd-card_routines.inc"
 $include "SSD1963_functions.inc"
 
 $include "Font12x16.font"
 $include "font25x32.font"

DS1338-33 clock

Put a DS1338-33 clock IC on the board. It is the 3,3 volts 1307. 
Got some help to get soft I2c running, the command $forcesofti2c did the trick. And if you study the history.txt files of the Bascom-AVR updates, you will find this command.


7inch DS1338 33.jpg


And here the software, with on top a little scan to check if the clock can be found on the soft i2c bus
$regfile = "xm128a1def.dat" 
$hwstack = 200 
$swstack = 200 
$framesize = 500 
$crystal = 32000000 
 
Config Osc = Enabled , 32mhzosc = Enabled 
Config Sysclock = 32mhz 
 
Config Osc = Disabled , 32mhzosc = Enabled 
Osc_pllctrl = &B10_0_00100 
Do 
Loop Until Osc_status.1 = 1 'Check if RC2MRDY is ready ' 
'enable PLL 
Set Osc_ctrl.4 'PLL enable 
'configure the systemclock 
Config Sysclock = Pll , Prescalea = 1 , Prescalebc = 1_1 'use PLL 
 
Config Priority = Static , Vector = Application , Lo = Enabled , Med = Enabled 
 
Config Com5 = 57600 , Mode = Asynchroneous , Parity = None , Stopbits = 1 , Databits = 8 
Open "COM5:" For Binary As #1 
 
Print #1 , "Start clock" 
 
$forcesofti2c ' with this the software I2C/TWI commands are used when including i2c.lbx 
$lib "i2c.lbx" ' override the normal xmega i2c lib 
 
Dim B As Byte 
Dim Weekday As Byte 
Dim Text As String * 30 
 
Declare Sub Setdate 
Declare Sub Settime 
Declare Sub Getdatetime 
 
'We use here Virtual port 0 
Config Vport0 = B ' 'map portB to virtual port0 
 
Config Scl = Port0 .3 ' Pin to use as SCL (The hardware pin is Pinb.1) 
Config Sda = Port0 .4 ' Pin to use as SDA (The hardware pin is Pinb.0) 
I2cinit ' Bring the Pin's in the proper state 
 
 
Print #1 , "Scan start" 
For B = 0 To 254 Step 2 'for all odd addresses 
 I2cstart 'send start 
 I2cwbyte B 'send address 
 If Err = 0 Then 'we got an ack 
 Print #1 , "Slave at : " ; B ; " hex : " ; Hex(b) ; " bin : " ; Bin(b) 
 End If 
 I2cstop 'free bus 
Next 
Print #1 , "End Scan" 
 
Wait 5 ' Bring the Pin's in the proper state 
 
 
'DS1338 
Const Ds1338w = &HD0 ' Adres van de Ds1338 clock 
Const Ds1338r = &HD1 
 
'Clock 
Config Clock = User 
Config Date = Dmy , Separator = . 
 
$lib "ds1307clock.lib" 
 
'Time$ = "00:07:00" 
'Date$ = "24.02.13" 
 
 
Do 
Call Getdatetime 
Print #1 , _hour 
Print #1 , _min 
Wait 5 
Loop 
 
End 
 
 
'called from ds1307clock.lib 
 
'------------------------------------------------------------------------------- 
' DS1338 Get date-time routine 
'------------------------------------------------------------------------------- 
Getdatetime: 
 I2cstart ' Generate start code 
 I2cwbyte Ds1338w ' send address 
 I2cwbyte 0 ' start address in 1338 
 
 I2cstart ' Generate start code 
 I2cwbyte Ds1338r ' send address 
 I2crbyte _sec , Ack 
 I2crbyte _min , Ack ' MINUTES 
 I2crbyte _hour , Ack ' Hours 
 I2crbyte Weekday , Ack ' Day of Week 
 I2crbyte _day , Ack ' Day of Month 
 I2crbyte _month , Ack ' Month of Year 
 I2crbyte _year , Nack ' Year 
 I2cstop 
 _sec = Makedec(_sec) : _min = Makedec(_min) : _hour = Makedec(_hour) 
 _day = Makedec(_day) : _month = Makedec(_month) : _year = Makedec(_year) 
Return 
 
 
'------------------------------------------------------------------------------- 
' DS1338 set date routine 
'------------------------------------------------------------------------------- 
Setdate: 
 _day = Makebcd(_day) : _month = Makebcd(_month) : _year = Makebcd(_year) 
 I2cstart ' Generate start code 
 I2cwbyte Ds1338w ' send address 
 I2cwbyte 4 ' starting address in 1338 
 I2cwbyte _day ' Send Data to SECONDS 
 I2cwbyte _month ' MINUTES 
 I2cwbyte _year ' Hours 
 I2cstop 
Return 
 
 
'------------------------------------------------------------------------------- 
' DS1338 set time routine 
'------------------------------------------------------------------------------- 
Settime: 
 _sec = Makebcd(_sec) : _min = Makebcd(_min) : _hour = Makebcd(_hour) 
 I2cstart ' Generate start code 
 I2cwbyte Ds1338w ' send address 
 I2cwbyte 0 ' starting address in 1338 
 I2cwbyte _sec ' Send Data to SECONDS 
 I2cwbyte _min ' MINUTES 
 I2cwbyte _hour ' Hours 
 I2cstop 
Return 
 
End

Video

WizFi210 test UDP and Bascom (by HKipnik)


SSD1963 7zoll mit ATxmega128A1 (by HKipnik)
Personal tools
Namespaces
Variants
Actions
Navigation
Language