|  |   
	
		|  
 | 
	  			
	  				|  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 25, 23:34. Visos datos yra GMT + 2 valandos.
 |  |  |  
	
		| 
	|  | Forumas » Mikrovaldikliai » UART per "paprastas" kojas |  
	| 
		
			| 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
 
 |  |  |  
	|  | UART per "paprastas" kojas |  
  | 
	| 
	
		|  Parašytas: 2006 11 17, 00:09 |     |  |  
	| 
	
		|  | 
			
				| Sveiki gal kam teko rasit koki nors koda kad mestu per betkoki porto koja tekstiniu ar kitus tekstus duomenys, informacija perdavineti. Pavizdziui per uart gali lengvai atiduodi tekstini ar kita informacija, noreciau ta pacia funcija atlikti per kita avr'o valdikli kuris neturi uart, ka tada daryt..??? |  |  
		|  |  |  |  
	|  | UART per "paprastas" kojas |  
  | 
	| 
	
		|  Parašytas: 2006 11 17, 10:51 |     |  |  
	| 
	
		|  | 
			
				| AVRLIB turi softwarinio UART biblioteka uartsw.h aisku jeigu programuoji naudodamasis WINAVR. |  |  
		|  |  |  |  
	|  | UART per "paprastas" kojas |  
  | 
	| 
	
		|  Parašytas: 2006 11 18, 23:21 |     |  |  
	| 
	
		|  | 
			
				| na as polkas codevisionavr, bet pabaiges pora likusiu pradetu projektuku pereisiu arba bent po truputi bandysiu CrossWorks del ARM, kiek zinau tas CrossWorks palaiko ir AVR... ir daugiau galimybiu turi... |  |  
		|  |  |  |  
	|  | UART per "paprastas" kojas |  
  | 
	| 
	
		|  Parašytas: 2006 11 19, 14:32 |     |  |  
	| 
	
		|  | 
			
				| idomu koks % erroru su sw uart? as tai siulyciau daryti softwarini SPI jei yra galimybe, tai butu gerokai paprasciau ir tiksliau nei uart. |  |  
		|  |  |  |  
	|  | UART per "paprastas" kojas |  
  | 
	| 
	
		|  Parašytas: 2006 12 31, 00:02 |     |  |  
	| 
	
		|  | 
			
				| Na man reikia siai dienai nepilno "uart" arba tiksliau tik TX issiusti duomenys... velesniuose projektuose pilno rx ir tx... 
 
 Gal kas turi pavizdziu codevisionavr kompiliatoriui... (atmega8 arba atmega16)? Buvau rades atmega128... bet ten daug papildomo kodo, nelabai einasi susigaudyti...
 |  |  
		|  |  |  |  
	|  |  
	|  |  
	|  | UART per "paprastas" kojas |  
  | 
	| 
	
		|  Parašytas: 2007 01 09, 11:13 |     |  |  
	| 
	
		|  | 
			
				| ;*************************************************************************************** ;
 ;
 ;	Title: RF remote control at 418MHz with roll-code
 ;
 ;	(RF 418MHz transmitter code)
 ;
 ;Device:AT90s2323 at 4MHz crystal
 ;and TLP-434 RF transmitter (418 MHz)
 ;Author:		Serasidis Vasilis
 ;Date:		04.06.2004
 ;Updated:		15.04.2005 Added roll-code feaure.
 ;				Home:		http://www.serasidis.gr
 ;				email:		info@serasidis.gr
 ;
 ;				Based in software UART at 2400bps, 8n1
 ;
 ;***************************************************************************************
 
 
 .include "2323def.inc"			;Define chip
 
 .equ	TxD		=0	;Transmition pin is PB0
 .equ	key1		=2	;Key No1 is connected to pin PB2
 .equ	key2		=1	;Key No2 is connected to pin PB1
 .equ	Key_1		=01
 .equ	Key_2		=02
 
 .def	temp		=R16	;temporary storage register.
 .def	temp2		=R17	;temporary storage register.
 .def	Txbyte		=R18	;Data to be transmitted.
 
 .def	init_byte	=R19	;This byte is sended first and its to recognize the receiver the correct remote control.
 .def	second_byte	=R20	;This byte is sended second and its to recognize the receiver the correct remote control.
 .def	command	=R21	;The command byte mean which key is pressed from the remote.
 .def	bitcnt		=R23	;bit counter
 .def	count		=R24
 .def	dcount		=R25
 .def	dcount2		=R26
 .def	rollcode	=R27
 
 .cseg
 
 .org	0
 rjmp 	reset	;Reset handler
 ret	;Return from sleep and go to "keys" address.
 
 
 
 reset:
 
 ldi		temp,RAMEND
 out		SPL,temp		;Init Stack Pointer
 
 ldi		temp,0b00000001 ;PB0 output, PB1, PB2 inputs
 out		DDRB,temp
 
 ldi		temp,0b00000111
 out		portB,temp      ;enable internal pullup resistor on PB1 and disable on PB2...
 ;...and enable Data-pin TxD (PB0).
 start:
 clr		second_byte
 Release_keys:
 rcall	delay
 sbis	PINB,key1		;
 rjmp	Release_keys
 
 rcall	delay
 sbis	PINB,key2		;
 rjmp	Release_keys
 
 ;subi	second_byte,$20
 
 ldi 	temp,0x30		;turn on sleep mode (Power-down mode)
 out 	MCUCR,temp		;interrupt on low level.
 ldi 	temp,0x40		;enable external interrupts (INT0)
 out 	GIMSK,temp
 sei						;enable global interrupts ready
 sleep					;go to sleep mode
 
 
 
 ;===================================================================================
 
 keys:
 sbic	PINB,key1		;
 rjmp	next_key
 
 ldi		command,Key_1		;load the code for key No1
 rjmp	Enable_RF
 
 next_key:
 ldi		command,Key_2		;load the code for key No2
 
 Enable_RF:
 
 ldi		count,4
 
 load:
 
 ldi		init_byte,$30		;Load init_byte register with initial byte (recognition byte).
 
 mov		txbyte,init_byte	;1) send initial byte
 rcall	b_transmit
 mov		txbyte,second_byte	;2) send second byte
 rcall	b_transmit
 mov		txbyte,command		;3) send the command byte
 rcall	b_transmit
 
 eor		init_byte,second_byte	;4) create the checksum of bytes "init_byte" and "second_byte"...
 eor		init_byte,command
 mov		txbyte,init_byte	;...move the resault to transmit byte (txbyte)...
 rcall	b_transmit			;and send it out.
 
 dec		count				;send 4 times the data
 brne	load
 
 inc		second_byte
 rjmp 	Release_keys	;
 
 
 ;***************************************************************************
 ;*			Transmition routine TxD
 ;***************************************************************************
 
 
 b_transmit:
 
 ldi		bitcnt,10	;1+8+sb (sb is # of stop bits)
 com		Txbyte		;Invert everything
 
 sec					;Start bit
 
 putchar0:
 brcc	putchar1	;If carry set
 cbi		PORTB,TxD	;    send a '0'
 rjmp	putchar2	;else
 
 putchar1:
 sbi		PORTB,TxD	;    send a '1'
 nop
 
 putchar2:
 rcall	UART_delay	;One bit delay
 rcall	UART_delay
 
 lsr		Txbyte		;Get next bit
 dec		bitcnt		;If not all bit sent
 brne	putchar0	;send next
 
 ret					;return
 ;***************************************************************************
 ;*
 ;* "UART_delay"
 ;*
 ;* This delay subroutine generates the required delay between the bits when
 ;* transmitting and receiving bytes. The total execution time is set by the
 ;* constant "b":
 ;*
 ;*	3xb + 7 cycles (including rcall and ret)
 ;***************************************************************************
 
 .equ	b=135	;2400 bps @ 4 MHz crystal, +5V
 .equ	c=2
 
 UART_delay:
 ldi		temp2,c
 UART_delay2:
 ldi		temp,b
 UART_delay1:
 dec		temp
 brne	UART_delay1
 dec		temp2
 brne	UART_delay2
 ret
 
 
 ;***************************************************************************
 ;*			Delay routine
 ;***************************************************************************
 
 
 delay:
 ldi		dcount2,10
 delay_:
 ldi		dcount,250
 delay1:
 dec		dcount
 brne	delay1
 dec		dcount2
 brne	delay_
 ret
 
 .db "(c) 09.06.2004 by Serasidis Vasilis. www.serasidis.gr"
 |  |  
		|  |  |  |  
	|  |  
	|  | UART per "paprastas" kojas |  
  | 
	| 
	
		|  Parašytas: 2007 01 09, 11:20 |     |  |  
	| 
	
		|  | 
			
				| Štai tau asmo porcija, bandyk sukramtyti   Jei pavyks, papostinsiu SoftReceive;
 
 Tiesa, turbūt aišku kad ten kodas iš tam tikro projekto, todėl jį reikia perrašyti.
 |  |  
		|  |  |  |  | 
				
					|  | 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
 |    |   
 
 
 |  |