Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
tlucas
PostPosted: May 28, 2010 - 07:51 AM
Hangaround


Joined: Jan 23, 2010
Posts: 448
Location: Edmonton, Alberta

"8data, 1stop bit" (and no parity) is what each transmitted packet will contain - ASCII code is within the 8 data bits. Is Hyperterminal setup to receive this type of packet? All the relevant options need to be set: 9600 baud, 8 data bits, 1 stop bit, no parity, and no handshaking. Also remember to verify the correct COM port is being used.
 
 View user's profile Send private message  
Reply with quote Back to top
vele0011
PostPosted: Jun 01, 2010 - 02:36 PM
Newbie


Joined: May 17, 2010
Posts: 4


Yes I have all of those setup correctly. How can I ensure that my atmega is running at 4mhz, which is what i used for all the calculations.
 
 View user's profile Send private message  
Reply with quote Back to top
nobbyv
PostPosted: Jul 19, 2010 - 08:54 PM
Rookie


Joined: Mar 17, 2008
Posts: 43


I read this great tutorial several times, but am still having a strange problem. I am using a MAX232 in conjunction w/ Hyperterminal to try and receive some simple data from my AVR (MEGA168). The issue is that the ONLY thing I can get to show up in Hyperterminal, repeated over and over again, is the letter "p". The only values that appear to even generate this are when I load UDR0 with a byte of data containing some combination of F and 7 ONLY (i.e., 0xF7, 0x77, etc).

Settings:
Code:
#define FOSC 8000000 // Clock Speed
  #define BAUD 9600
  #define MYUBRR FOSC/16/BAUD-1
 
  UBRR0H = (unsigned char)(MYUBRR>>8);
  UBRR0L = (unsigned char)MYUBRR;
  //Enable receiver and transmitter */
  UCSR0B = 0x98;                                                                //Enable Rx/Tx, enable Rx interrupt
  /* Set frame format: 8data, 1stop bit */
  UCSR0C = 0x06;                                                                //8-bit, one stop, no parity, asynchronous


Is this some common ASCII characher for newline or something that's getting sent???

Hyperterminal is set for 9600 Baud, 8 data bits, no parity, one stop, and no Flow Control.
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: Jul 19, 2010 - 09:17 PM
10k+ Postman


Joined: Jul 18, 2005
Posts: 34545
Location: (using avr-gcc in) Finchingfield, Essex, England

As it's a 168 have you cleared CKDIV8 or reprogrammed CLKPR to achieve the same effect?

Also how sure are you (apart from this) that the 8MHz clock source is enabled as the active clock source.

Finally, if you have a scope, if you sit in a loop attempting to send 'U' repeatedly does the scope show the bit widths to be 104us?

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
nobbyv
PostPosted: Jul 20, 2010 - 01:08 PM
Rookie


Joined: Mar 17, 2008
Posts: 43


I should have clarified: I am using an older ICE50 to emulate the MEGA168 in Studio. In the ICE50 options screen, I have verified in the platform options that CKDIV8 is not checked and also that I am definitely running at 8MHz.

On the scope, sending a "U", I get periodic groups of five pulses, 500uS in width, separated by 500uS. The groups are 18mS apart, which makes sense as my code strobes the message w/ this period. Still getting "p" in Hyperterminal.

Tried sending some other string chars (i.e., "B", "S") and the bit pattern on the scope changes, but I no longer get anything in Hyperterminal.
 
 View user's profile Send private message  
Reply with quote Back to top
Koshchi
PostPosted: Jul 20, 2010 - 04:26 PM
Raving lunatic


Joined: Nov 17, 2004
Posts: 9295
Location: Vancouver, BC

Quote:
I get periodic groups of five pulses, 500uS in width, separated by 500uS.
That would seem to be 2000 baud, not 9600 baud.

_________________
Regards,
Steve A.

The Board helps those that help themselves.
wylfwt?
 
 View user's profile Send private message  
Reply with quote Back to top
nobbyv
PostPosted: Jul 20, 2010 - 06:49 PM
Rookie


Joined: Mar 17, 2008
Posts: 43


You are exactly right, there was a mistake in my macro. I have fixed it now and its working great.

One last question: I am loading hex data into my UART, and I would prefer getting that raw data instead of its ASCII equivalent. Is there a setting in Hyperterminal to allow this?
Thanks!
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: Jul 21, 2010 - 10:49 AM
10k+ Postman


Joined: Jul 18, 2005
Posts: 34545
Location: (using avr-gcc in) Finchingfield, Essex, England

Quote:

Is there a setting in Hyperterminal to allow this?

Not HT - but other terminal programs such as Teraterm, Realterm and Brays offer this.

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
opalstear
PostPosted: Aug 10, 2010 - 07:12 PM
Newbie


Joined: Jun 14, 2010
Posts: 18
Location: Riverside USA

Thank you ^^
 
 View user's profile Send private message Send e-mail Visit poster's website 
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits