Go to Post FIRST has taught me to mind my semicolons. - ComradeNikolai [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 30-11-2006, 22:11
Josh Siegel's Avatar
Josh Siegel Josh Siegel is offline
lurker
#0448 (Crandroids)
 
Join Date: Nov 2003
Rookie Year: 2003
Location: Bloomfield Hills, Michigan
Posts: 67
Josh Siegel will become famous soon enough
Send a message via AIM to Josh Siegel Send a message via MSN to Josh Siegel
2004 Edubot Serial String Help (TTL in)

Hi everyone,
I've been fooling around with this code for awhile and I'm at a total loss as to what I can try next. Here's what I aim to do:
-I have an RS232 GPS device that is tested and known good.
-I have a TTL to RS232/RS232 to TTL conversion board that is tested and known good
-I want to read, and ultimately parse, the data string (but don't know about C string parsing). For now, I would be happy with printing it out from the RS232 (feed in TTL and out to PC).

I tried Kevin's serial code, but it never actually seemed to read the data. A few times, I got it to "acknowledge" that it captured something (just a simple print if this portion is reached), but it never printed it properly. It also only did it once per boot of the board. How does the EDU know when a string is coming in? I know I can use interrupts, but that seems like an awful lot of trouble to set up a reader for a GPS device.

Does anyone have experience with this? Sample code, perhaps?
I'd post what I have, but its mostly the default serial code, with the parameters changed to 4800 baud.

Thanks,
Josh
  #2   Spotlight this post!  
Unread 06-12-2006, 22:01
Josh Siegel's Avatar
Josh Siegel Josh Siegel is offline
lurker
#0448 (Crandroids)
 
Join Date: Nov 2003
Rookie Year: 2003
Location: Bloomfield Hills, Michigan
Posts: 67
Josh Siegel will become famous soon enough
Send a message via AIM to Josh Siegel Send a message via MSN to Josh Siegel
Re: 2004 Edubot Serial String Help (TTL in)

Anyone with experience with circular read buffers? I'm completely at a loss here.
  #3   Spotlight this post!  
Unread 07-12-2006, 00:22
Kingofl337's Avatar
Kingofl337 Kingofl337 is offline
You didn't see anything....
AKA: Adam
FRC #0501 (Power Knights)
Team Role: Mentor
 
Join Date: Feb 2005
Rookie Year: 1998
Location: Manchester, NH
Posts: 861
Kingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond repute
Send a message via Yahoo to Kingofl337
Re: 2004 Edubot Serial String Help (TTL in)

The TTL runs at 115,200bps by default and most GPS devices run at 9600bps. You need to intialize the serial port at 9600 or convert 9600 to 115,200.

I don't know what to change in the code to properly initialize the port for 9600.
__________________
FIRST Team 501 PowerKnights - Mentor
FIRST Team 40 Checkmate - Mentor Alum
FIRST Team 146 Blue Lightning - Alumni

Last edited by Kingofl337 : 07-12-2006 at 00:25.
  #4   Spotlight this post!  
Unread 07-12-2006, 09:39
EHaskins EHaskins is offline
Needs to change his user title.
AKA: Eric Haskins
no team (CARD #6 (SCOE))
Team Role: College Student
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Elkhorn, WI USA
Posts: 998
EHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond reputeEHaskins has a reputation beyond repute
Send a message via MSN to EHaskins
Re: 2004 Edubot Serial String Help (TTL in)

Quote:
Originally Posted by Kingofl337
The TTL runs at 115,200bps by default and most GPS devices run at 9600bps. You need to intialize the serial port at 9600 or convert 9600 to 115,200.

I don't know what to change in the code to properly initialize the port for 9600.
If its the BAUD then you will need to open serial_ports.c, and find the Init_Serial_Port_Two;

The current code should look like this:
Code:
void Init_Serial_Port_Two(void)
{
	// Start by initializing the serial port with code 
	// common to receive and transmit functions
	SPBRG2 = BAUD_115200;	// baud rate generator register [251]
							//
	TXSTA2bits.BRGH = 1;	// high baud rate select bit (asynchronous mode only) [248]
							//  0: low speed
							//  1: high speed
							//
You need to change the TXSTA2bits.BRGH to 0, and SPBRG2 = BAUD_9600.

When your finished the code should look like this:
Code:
void Init_Serial_Port_Two(void)
{
	// Start by initializing the serial port with code 
	// common to receive and transmit functions
	SPBRG2 = BAUD_9600;	// baud rate generator register [251]
							//
	TXSTA2bits.BRGH = 0;	// high baud rate select bit (asynchronous mode only) [248]
							//  0: low speed
							//  1: high speed
							//
I haven't tested this code, but I think its correct.
__________________
Eric Haskins KC9JVH
  #5   Spotlight this post!  
Unread 07-12-2006, 14:06
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: 2004 Edubot Serial String Help (TTL in)

Quote:
Originally Posted by EHaskins
I haven't tested this code, but I think its correct.
Yes, you're right. 4800 baud is another common baud rate used by GPS receivers.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #6   Spotlight this post!  
Unread 07-12-2006, 14:17
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: 2004 Edubot Serial String Help (TTL in)

Quote:
Originally Posted by Josh Siegel
...I want to read, and ultimately parse, the data string (but don't know about C string parsing). For now, I would be happy with printing it out from the RS232 (feed in TTL and out to PC).
For fun, a few years ago I wrote some EDU-RC code to parse the GPS GGA message and write the current GPS time, which is very accurate, to a serial LCD display. To get you started, have a look at the Camera_Handler() and Camera_State_Machine() functions in camera.c for one way to parse serial data.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #7   Spotlight this post!  
Unread 10-12-2006, 08:28
Josh Siegel's Avatar
Josh Siegel Josh Siegel is offline
lurker
#0448 (Crandroids)
 
Join Date: Nov 2003
Rookie Year: 2003
Location: Bloomfield Hills, Michigan
Posts: 67
Josh Siegel will become famous soon enough
Send a message via AIM to Josh Siegel Send a message via MSN to Josh Siegel
Re: 2004 Edubot Serial String Help (TTL in)

Thanks guys, I think I missed the high speed option when I changed my baud rate. I'll try that tonight and see if it does anything different, and then take a look at the camera parsing code.
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Serial Port Help? StargateFan Programming 12 05-07-2006 14:06
TTL port to a serial port on a demo board ImmortalAres Programming 16 09-07-2005 23:44
TTL Serial Port and PS2 Mouse Interface cbolin Electrical 8 29-12-2004 15:00
EduBot Help, RC Controller Allison K Robotics Education and Curriculum 5 29-03-2004 16:48
USB to 9-pin serial port (HELP!!) n00b Technical Discussion 10 01-02-2004 21:25


All times are GMT -5. The time now is 20:54.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi