|  |   
	
		|  
 | 
	  			
	  				|  Elektronika.lt portalo forumasJūs esate neprisijungęs lankytojas. Norint dalyvauti diskusijose, būtina užsiregistruoti ir prisijungti prie forumo.
						Prisijungę galėsite kurti naujas temas, atsakyti į kitų užduotus klausimus, balsuoti forumo apklausose. 
 Administracija pasilieka teisę pašalinti pasisakymus bei dalyvius,
						kurie nesilaiko forumo taisyklių.
						Pastebėjus nusižengimus, prašome pranešti.
 
 Dabar yra 2025 10 31, 10:11. Visos datos yra GMT + 2 valandos.
 |  |  |  
	
		| 
	|  | Forumas » Mikrovaldikliai » Atmega16 fuses nustatymai |  
	| 
		
			| Jūs negalite rašyti naujų pranešimų į šį forumą Jūs negalite atsakinėti į pranešimus šiame forume
 Jūs negalite redaguoti savo pranešimų šiame forume
 Jūs negalite ištrinti savo pranešimų šiame forume
 Jūs negalite dalyvauti apklausose šiame forume
 
 |  |  |  
	|  |  
	|  |  
	|  | Atmega16 fuses nustatymai |  
  | 
	| 
	
		|  Parašytas: 2016 04 16, 16:10 |     |  |  
	| 
	
		|  | 
			
				| Sveiki, 
 Darau is zurnalo winamp'o valdyma. Proteus simuletoriui programa pasileidzia ir lcd uzsidega "welcome" pasveikinimas, o realybei ant lcd tik dega visa eilute ir daugiau nieko. Gal blogi fuse nustatymai? Naudoju Atmega16A.
 
 Kodas:
 
 
 
	  | Kodas: |  
	  | 'ATmega16 $hwstack = 128
 $swstack = 128
 $framesize = 128
 Config Lcdpin = Pin , Db4 = Portc.2 , Db5 = Portc.3 , Db6 = Portc.4 , Db7 = Portc.5 , Rs = Portc.0 , E = Portc.1       'LCD 16*2
 $baud = 9600
 $crystal = 8000000                                          'Internal clock
 
 
 Declare Function Getad() As Byte
 Config Adc = Single , Prescaler = Auto , Reference = Aref
 Dim Last As Word
 
 Dim Value As Byte , Temp As Byte , Send As Byte , Diff As Integer , Cn As Byte
 Dim Tmp As Byte
 
 Dim Tex(40) As Byte                                         'Text memory
 
 Config Portd.3 = Output                                     'Button setup
 Config Portd.5 = Output
 Config Portd.6 = Output
 
 Config Porta.0 = Input
 Config Porta.1 = Input
 Config Porta.2 = Input
 Config Porta.3 = Input
 
 Set Porta.0
 Set Porta.1
 Set Porta.2
 Set Porta.3
 
 Tas1 Alias Pina.0                                           'Button 1
 Tas3 Alias Pina.1                                           'Button 2
 Tas4 Alias Pina.2                                           'Button 3
 Tas2 Alias Pina.3                                           'Button 4
 
 
 En Alias Portd.3                                            'Enable output for L293D
 A1 Alias Portd.5                                            'Output 1 of L293D
 A2 Alias Portd.6                                            'Output 2 of L293D
 
 
 
 Last = 250
 
 Cursor Off                                                  'LCD init
 Cls
 Lcd " Winamp Control"
 Lowerline
 Lcd " v.1.1"
 Locate 1 , 1
 
 New:
 Waitms 100
 Newi:
 Temp = Udr                                                  'Read serial input
 Value = Getad()                                             'Start position
 Do
 Temp = Getad()                                           'Current position
 Diff = Value - Temp
 Diff = Abs(diff)
 If Diff > 5 Then                                         'Manual move?
 Goto Manual
 End If
 
 If Tas1 = 0 Then                                         'Button 1 pressed?
 Do
 Waitms 100
 Loop Until Tas1 = 1
 Printbin 251
 Printbin 0
 End If
 If Tas2 = 0 Then                                         'Button 2 pressed?
 Do
 Waitms 100
 Loop Until Tas2 = 1
 Printbin 252
 Printbin 0
 End If
 If Tas3 = 0 Then                                         'Button 3 pressed?
 Do
 Waitms 100
 Loop Until Tas3 = 1
 Printbin 253
 Printbin 0
 End If
 If Tas4 = 0 Then                                         'Button 4 pressed?
 Do
 Waitms 100
 Loop Until Tas4 = 1
 Printbin 254
 Printbin 0
 End If
 
 Temp = Inp(&H2b)                                         'Serial data received?
 Temp = Temp And &B10000000
 Loop Until Temp > 0
 
 Value = Udr                                                 'Process data
 Sync:
 If Value = 125 Then Goto Textd                              'Command 125 -> receive data and set LCD
 Send = 140
 If Value = 120 Then Send = 100                              'Valid command?
 If Value = 110 Then Send = 0
 If Send = 140 Then Goto New
 
 Do
 Temp = Inp(&H2b)                                         'Wait for second data byte
 Temp = Temp And &B10000000
 Waitms 1
 Loop Until Temp > 0
 
 Value = Udr
 If Value > 101 Then Goto Sync                               'Error
 Send = Send + Value                                         'Check data
 If Send > 200 Then Send = 200
 Send = 200 - Send
 Value = Getad()
 
 Diff = Value - Send                                         'Diference between leaver and received value
 Diff = Abs(diff)
 If Diff < 5 Then Goto New                                   'Difference to small return
 
 If Value > Send Then                                        'Drive leaver up
 '###############################################################################
 Temp = Getad()
 If Temp = 0 Then Goto Endpush
 
 Cn = 0
 Value = Getad()
 
 Reset A1
 Set A2
 Set En
 
 Do
 Temp = Getad()
 If Value < Temp Then Goto Manual
 If Value = Temp Then
 Cn = Cn + 1
 If Cn = 250 Then Goto Manual
 Else
 Cn = 0
 End If
 Value = Temp
 Loop Until Temp =< Send Or Temp = 0
 Goto Endpush
 Else
 '############################################################################### 'or drive leaver down
 Temp = Getad()
 If Temp = 200 Then Goto Endpush
 
 Cn = 0
 Value = Getad()
 
 Set A1
 Reset A2
 Set En
 
 Do
 Temp = Getad()
 If Value > Temp Then Goto Manual
 If Value = Temp Then
 Cn = Cn + 1
 If Cn = 250 Then Goto Manual
 Else
 Cn = 0
 End If
 Value = Temp
 Loop Until Temp => Send Or Temp = 200
 Goto Endpush
 End If
 '###############################################################################
 Endpush:
 Reset En
 Goto New
 
 
 Textd:                                                      'Receive 32 bytes for display
 Tmp = 1
 For Cn = 1 To 32
 Do
 Waitus 50
 Temp = Inp(&H2b)
 Temp = Temp And &B10000000
 Loop Until Temp > 0
 Tex(cn) = Udr
 Next Cn
 Tmp = 1
 
 Locate 1 , 1
 For Cn = 1 To 32
 If Tex(cn) > 32 And Tex(cn) < 127 Then
 Lcd Chr(tex(cn))
 Else
 Lcd " "
 End If
 If Tex(cn) = 0 Then Goto Newi
 If Cn = 16 Then
 Locate 2 , 1
 End If
 Next Cn
 Goto Newi
 
 
 Manual:                                                     'Manuall override
 Printbin 240                                             'Notifie PC that leaver was pushed manual
 Printbin 0
 Manualt:
 Reset En
 Value = Getad()
 Waitms 250                                               'If leaver stood dtill for 250ms then notifie PC
 Temp = Getad()
 If Value <> Temp Then Goto Manualt
 Temp = 200 - Temp
 Temp = Temp + 1
 Printbin Temp
 Printbin 0
 Goto New
 
 
 Function Getad() As Byte
 Local A As Word , B As Integer
 A = Getadc(4)
 A = A / 5.12
 
 If A > 200 Then A = 200
 If A < 0 Then A = 0
 
 If A = 0 Or A = 200 Then
 Last = A
 Goto Exget
 End If
 
 B = A - Last
 B = Abs(b)
 If B < 5 Then
 A = Last
 Goto Exget
 End If
 Last = A
 Exget:
 Getad = A
 End Function
 |  
 Fuses:
 
   
 Patarkit ka dar perziuret.
 |  |  
		|  |  |  |  
	|  |  
	|  | Atmega16 fuses nustatymai |  
  | 
	| 
	
		|  Parašytas: 2016 04 16, 17:04 |     |  |  
	| 
	
		|  | 
			
				| Zvilgtelk http://www.engbedded.com/fusecalc/ ir nusistatyk kaip reikia Kad Atmega veiktu 8MHz dazniu, tau reikia nustatyti CKSEL0 bei nuimti CKSEL2 varnas.
 Abejoju ar tau reikia JTAGEN
 Manau, kad praverstu BODEN, o BODLEVEL priklauso nuo kiek maitini Atmega (jei nuo 5V, tai gali uzdeti varna).
 |  |  
		|  |  |  |  
	|  | Atmega16 fuses nustatymai |  
  | 
	| 
	
		|  Parašytas: 2016 04 16, 18:56 |     |  |  
	| 
	
		|  | 
			
				| Gaila,kad pas mus nėra"Laik" mygtuko, Laidback jau spaustų, o aš spausčiau du kart, už tai kad žmogus, aukodamas savo laiką tokius gerus patarimus dalina  . |  |  
		|  |  |  |  | 
				
					|  | Google paieška forume |  
					|  |  
				
					|  | Naujos temos forume |  
					|  |    
	
		|  | FS25 Tractors Farming Simulator 25 Mods,
	    	FS25 Maps,
			FS25 Trucks
 |  
		|  | ETS2 Mods ETS2 Trucks,
			ETS2 Bus,
			Euro Truck Simulator 2 Mods
 |  
		|  | FS22 Tractors Farming Simulator 22 Mods,
	    	FS22 Maps,
		FS25 Mods
 |  
	|  | VAT calculator VAT number check,
	    	What is VAT,
	    	How much is VAT
 |  
	|  | Dantų protezavimas All on 4 implantai,
 Endodontija mikroskopu,
 Dantų implantacija
 |  
	|  | FS25 Mods FS25 Maps,
		FS25 Cheats,
		FS25 Install Mods
 |  
	|  | FS25 Mods Farming Simulator 25 Mods,
 FS25 Maps
 |  
	|  | ATS Trailers American Truck Simulator Mods,
		ATS Trucks,
		ATS Maps
 |    |   
 
 
 |  |