Forums for you Fast forums in a simple way
 Registrati
user
password
 


Home->it.hobby.elettronica.digitale
Rispondi  Torna al forum Notizie

USART ATMEGA32 ,UBRRH e UCSRC ..inseparabili


  • Subject: USART ATMEGA32 ,UBRRH e UCSRC ..inseparabili
  • From: blisca <bliscachiocciolinatiscalipuntoit>
  • Data: Sun, 6 Jul 2008 09:38:44 +0200
  • Newsgroups: it.hobby.elettronica.digitale


Chiedo aiuto

se non ho capito male questi registri condividono gli stessi  I/O

per cui se voglio scrivere in USRC devo prima settare il bit URSEL  e se
voglio scrivere in UBRRH devo resettarlo,
invece sia in simulazione che nella realtà appare che quello che faccio ad
un registro avviene nell'altro

es:  se scrivo 1 in UCSZ0 e UCSZ1 con URSEL=1 scrivo   1 nei corrispondenti
bit di UBRRH

se poi voglio ripulire UBRRH  mettendo prima URSEL=0 avviene che UBRRH=0
renda a nche UCRSC=0



UCSRC =UCSRC & 0x7F;//porto  esplicitamente URSEL=0 ,non si sa mai
UBRRH=0;
UBRRL=1
UCSRA=UCSRA | (1<<PE )|(1<<U2X);
UCSRB=UCSRB  &(0xFF - (1<<UCSZ2)) | (1<<RXEN ) |(1<<TXEN) ;

UCSRC =  UCSRC | 0x80;// setto URSEL da solo prima di ogni operazione su
UCSRC
UCSRC =UCSRC  |(1<<USBS);
UCSRC =UCSRC  |(3 <<UCSZ0);//ok,ho settato i bit che mi interessavano
UCSRC =UCSRC & 0x7F;//URSEL=0
UBRRH=0;// dovrebbe agire solo su UBRRH  invece  ho UCSRC=0



dice il pdf di Atmega32
When doing a write access of this I/O location, the high bit of the value
written, the USART Register
Select (URSEL) bit, controls which one of the two registers that will be
written. If URSEL is

zero during a write operation, the UBRRH value will be updated. If URSEL is
one, the UCSRC

setting will be updated



grazie






Cerca "USART ATMEGA32 ,UBRRH e UCSRC ..inseparabili" con Gooogle SiteSearch
Google
 
Web www.forumsforyou.com







ForumsForYou non è responsabile dei contenuti degli articoli che vengono inseriti dagli utenti via rete Usenet e che quindi vengono pubblicati di conseguenza sul nostro news server. Si vieta l'utilizzo delle email allegate nei vari articoli per l'invio di mail non richieste.

Copyright 2006 Powered by JTechnology s.r.l. All rights reserved.