$regfile = "xm128a4udef.dat"
$crystal = 62000000 '32MHz
$hwstack = 128
$swstack = 128
$framesize = 128
$lib "xmega.lib" : $external _xmegafix_clear : $external _xmegafix_rol_r1014
Config Osc = Disabled , 32mhzosc = Enabled , 32khzosc = Enabled '32MHz
Config Sysclock = 32mhz '32Mhz
'(Dim A As Byte
Out &H50 , &B00000001 ' enable 2MHz Oscillator
Out &H55 , &B00011111 'PLL Clocksource = 2MHz internal Osc.
' ,Multiplicator = 16 to get 32 MHz Out
Out &H34 , &HD8 'No write protection for 4 cycles
Out &H41 , &B00000000 'Prescaler= No division Prescaler A, B and C
While A.0 = 0 'Wait for 2MHz Osc. to be ready
A = Inp(&H51)
Wend
Out &H50 , &B00010001 ' enable PLL
While A.4 = 0 'Wait for PLL to be ready
A = Inp(&H51)
Wend
Out &H34 , &HD8 'No write protection for 4 cycles '
Out &H40 , &B00000100 'Select PLL as system Clock
Out &H34 , &HD8 'No write protection for 4 cycles '
Out &H42 , &B00000001 'Lock System Clock Settings
')
'Config Priority = Static , Vector = Application , Lo = Enabled 'config interrupts
'Enable Interrupts
$lib "glcdeadogm128x6.lbx"
Config Graphlcd = 128 * 64eadogm , Cs1 = Portc.4 , A0 = Portc.1 , Si = Portc.5 , Sclk = Portc.7 , Rst = Portc.0
Glcdcmd 141 '&B10001101 'pętla zmieniająca kontrast co sekunde
Glcdcmd 32
Waitms 10
Glcdcmd 141 '&B10001101 'pętla zmieniająca kontrast co sekunde
Glcdcmd 38
Setfont My6_8 'My12_16
Cls
Dim Tick As Long
Tick = 0
Dim Ttt As Long
Config Adca = Free , Convmode = Signed , Resolution = 12bit , Dma = Off , Reference = Intvcc , Event_mode = None , Prescaler = 16 , _
Ch0_gain = 1 , Ch0_inp = Single_ended , Mux0 = &B00000000 'Setup Channel 0 in Single Ended Mode
' ADC Clock = 32MHz/512 = 62.5 KHz
Config Tcc0 = Normal , Prescale = 1024
Tcc0_per = 0 '31250 '32MHz/1024 = 31250
On Tcc0_ovf Tc0_isr 'Setup overflow interrupt of Timer/Counter C0 and name ISR
Enable Tcc0_ovf , Lo 'Enable overflow interrupt in LOW Priority
Enable Interrupts
Config Priority = Static , Vector = Application , Lo = Enabled
Dim Mensure As Word
Dim Mensurepom As Long
Dim Minn As Word
Minn = 9999
Mensure = 0
Mensurepom = 9999
Dim Tttt As Integer
Dim Measurement As Word
Dim Single_measurment As Single
Dim Single_measurment1 As String * 10
Dim Single_measurment2 As String * 10
Dim I As Byte
Do
For Mensurepom = 0 To 10000
Measurement = Getadc(adca , 0 , &B00000000)
If Measurement < Minn Then Minn = Measurement
Next Mensurepom
Lcdat 1 , 1 , Tick
Lcdat 2 , 1 , Measurement
Wait 1
Tick = 0
Loop
End
Tc0_isr:
'Lcdat 2 , 1 , "tick"
Incr Tick
'Onlyfortesting
Return
$include "font8x8TT.font"
$include "my12_16.font"
$include "my6_8.font"
|