Go to Post If it wasn't for 47, none of us would be here. - Taylor [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 27-01-2003, 10:01
Adam Shapiro's Avatar
Adam Shapiro Adam Shapiro is offline
Registered User
FRC #0555 (Montclair Robotics)
Team Role: Alumni
 
Join Date: Jan 2002
Rookie Year: 2001
Location: Montclair, NJ
Posts: 401
Adam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud of
Send a message via AIM to Adam Shapiro
Strange Serial Input

I seem to be getting very weird serial input for Dashboard3D. For example, when the robot/control board is not on/connected, I get 48 for the packet number, 176 for p2wheel, 48 for ctrl-A, etc. I don't understand... Also, when everything is connected and running, I seem to get very odd numbers. I might be doing something wrong but I don't know...
Here is the serial init code (keep in mind that it is in a bool function in a class structure):


HANDLE hfSerial;
COMMTIMEOUTS m_CommTimeouts;
hfSerial=CreateFile(Comm,GENERIC_READ,0,0,OPEN_EXI STING,FILE_ATTRIBUTE_NORMAL,0);
if(hfSerial==INVALID_HANDLE_VALUE)
{
if(GetLastError()==ERROR_FILE_NOT_FOUND){return false;}
}
SetupComm(hfSerial,128,128);
DCB dcbSerialParams;
ZeroMemory(&dcbSerialParams,sizeof(dcbSerialParams ));
dcbSerialParams.DCBlength=sizeof(dcbSerialParams);
if(!GetCommState(hfSerial,&dcbSerialParams))return false;
dcbSerialParams.BaudRate=CBR_19200;
dcbSerialParams.ByteSize=8;
dcbSerialParams.StopBits=ONESTOPBIT;
dcbSerialParams.Parity=NOPARITY;
if(!SetCommState(hfSerial,&dcbSerialParams))return false;
if(!GetCommTimeouts(hfSerial, &m_CommTimeouts))return false;
m_CommTimeouts.ReadIntervalTimeout = 50;
m_CommTimeouts.ReadTotalTimeoutConstant = 50;
m_CommTimeouts.ReadTotalTimeoutMultiplier = 10;
m_CommTimeouts.WriteTotalTimeoutConstant = 50;
m_CommTimeouts.WriteTotalTimeoutMultiplier = 10;
if(!SetCommTimeouts(hfSerial, &m_CommTimeouts))return false;
hSerial=hfSerial;
strcpy(cComm,Comm);
bConnected=true;
_beginthread(SerialThread,0,NULL);
return true;
__________________
Mentor to Teams 555, 1929, and 2070!
Currently working in hardware design at Cisco.
Cornell University DARPA Urban Challenge - http://www.cornellracing.com
Co-Captain Team 555 - 2003,2004,2005
Trust, Love, and Magic
  #2   Spotlight this post!  
Unread 29-01-2003, 19:18
rbayer's Avatar Unsung FIRST Hero
rbayer rbayer is offline
Blood, Sweat, and Code
no team (Teamless Orphan)
 
Join Date: Mar 2002
Rookie Year: 2001
Location: Minnetonka, MN
Posts: 1,087
rbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of light
Send a message via AIM to rbayer
That part all looks fine to me, but I don't have an API spec sitting in front of me, so I may have missed something. What does the actual SerialThread function look like? If you either post it here or email it to me, I'll see if I can find anything amiss.

--Rob
__________________
New C-based RoboEmu2 (code simulator) available at: http://www.robbayer.com/software.php
  #3   Spotlight this post!  
Unread 30-01-2003, 17:52
mjt902 mjt902 is offline
Registered User
#0902
 
Join Date: Apr 2002
Location: Heritage High School
Posts: 31
mjt902 is an unknown quantity at this point
maybe i'm really stupid, but my guess (after only going through one hellish college semester of C++) is that you have some data structures in your code, and some functions that you don't want to share with us. i looked through the code and don't recognize many keyword the c++ compiler knows, so that's why i assume they are names of data structures. if this is true, then i'm not as dumb as many (including i) perceive, and your error may be in the variable initializations, structures, or methods that manipulate the variables. if my insight doesn't help than just put it off until later.
__________________
Top Ten Reasons to Procrastinate:
1.
  #4   Spotlight this post!  
Unread 30-01-2003, 20:09
Adam Shapiro's Avatar
Adam Shapiro Adam Shapiro is offline
Registered User
FRC #0555 (Montclair Robotics)
Team Role: Alumni
 
Join Date: Jan 2002
Rookie Year: 2001
Location: Montclair, NJ
Posts: 401
Adam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud ofAdam Shapiro has much to be proud of
Send a message via AIM to Adam Shapiro
You are right to say that I have declared my own classes but I don't think that it is the problem. I could be wrong though... I might just write a small app to test it... As for not wanting to share, that is not the case. I don't mean to sound defensive but I am planning to make this open source as soon as I finish version 1. I'm not trying to hide anything, it is just easier to only distribute it to a few people until it's done.
__________________
Mentor to Teams 555, 1929, and 2070!
Currently working in hardware design at Cisco.
Cornell University DARPA Urban Challenge - http://www.cornellracing.com
Co-Captain Team 555 - 2003,2004,2005
Trust, Love, and Magic
  #5   Spotlight this post!  
Unread 31-01-2003, 02:01
Micah Brodsky Micah Brodsky is offline
Registered User
#0824 (SWAT)
 
Join Date: Jan 2003
Location: Seattle
Posts: 5
Micah Brodsky is an unknown quantity at this point
Hmm... can't say I'm familiar enough with the Win32 serial APIs to check your code, but...

Did you try hooking up to another computer terminal with a null modem cable, to see if you could read known-good serial data?

Are you getting the '255, 255' signature correctly? If so, it's probably a good indicator that the communication infrastructure itself is at least nominally functional and properly set up, and vice versa.

Also, you explicitly checked for timeout conditions in the code that actually does the reading, right? Otherwise, you might just be reading uninitialized data members...

--Micah
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
How do u hook up the digital input to the sensor's wires Fares Technical Discussion 2 14-02-2003 16:41
Ever seen this serial port problem before??? Aidan F. Browne Programming 5 05-02-2003 12:03
2.5 is alive !!!! (input ! .. more input ! ) Lloyd Burns Programming 2 14-01-2003 19:15
Time limits, your input, etc. Brandon Martus Announcements 36 08-11-2002 07:50
FOR SALE: Long serial cables Cheap!!! sanddrag General Forum 10 06-11-2002 15:39


All times are GMT -5. The time now is 00:48.

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