7 inch display board

From MCS Wiki
Revision as of 11:17, 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

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

Personal tools
Namespaces
Variants
Actions
Navigation
Language