Go to Post IRI ... no contest. It is borderline insane. - Paul Copioli [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 28-06-2006, 15:16
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
Why did I come back?
AKA: Jamie Bliss
FRC #4967 (That ONE Team)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Re: Serial Communications

I can tell you about the C APIs. On Linux, it's in the Linux downloader (ifi-picloader) on SourceForge (which is down right now...). The basics you want is tcsetattr() and the termios struct.

Under Windows, you're looking for BuildCommDCB(), GetCommConfig(), GetCommProperties(), and a collection of other functions. (In MSDN.)

I don't know if Qt has functions built-in to handle configuring serial ports.
  #2   Spotlight this post!  
Unread 28-06-2006, 16:12
David55 David55 is offline
Registered User
AKA: David Hillman
FRC #1577 (Steampunk) & FRC #125 (NUTRONS)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Raanana, Israel / Boston, MA
Posts: 279
David55 is a splendid one to beholdDavid55 is a splendid one to beholdDavid55 is a splendid one to beholdDavid55 is a splendid one to beholdDavid55 is a splendid one to beholdDavid55 is a splendid one to behold
Re: Serial Communications

I have a question about the serial ports programming.

I am trying to connect an LCD module to the mini RC for creating a GUI that will help control the robot systems while testing and operating the robot (which will later be implemented on our FRC robot).

To do this I am using Kevin's edu_serial_tx code at http://www.kevin.org/frc/2005/ .

Problem is i am not a very knowledgeable programmer yet, and I have no idea how to send simple text to the LCD. For example
"To run motor test press 1
To run shooter test press 2"
(That is just an example. obviously we are aiming to have an entire interface to test all the subsystems, get information from batteries, sensors etc.)

If someone could help me with this I would really appreciate it.

David
  #3   Spotlight this post!  
Unread 28-06-2006, 16:45
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,831
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Serial Communications

Quote:
Originally Posted by David55
I am trying to connect an LCD module to the mini RC for creating a GUI that will help control the robot systems while testing and operating the robot (which will later be implemented on our FRC robot).

To do this I am using Kevin's edu_serial_tx code at http://www.kevin.org/frc/2005/ .
What kind of LCD do you have and what kind of serial communication does it use (TTL, RS232, TTL-inverted)?
What serial options does it have?

I took a quick look at that code sample of Kevin's and as it is currently configured it expects your LCD to be TTL-inverted, running at 2400 BAUD, and hooked up to digital input 1 (although there seems to be some discrepancy in how that digital input is configured - you might want to fix that).
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 28-06-2006 at 16:51.
  #4   Spotlight this post!  
Unread 28-06-2006, 16:29
6600gt's Avatar
6600gt 6600gt is offline
Registered User
AKA: Lohit
FRC #0226 (Hammerhead)
Team Role: Alumni
 
Join Date: Jan 2006
Rookie Year: 2004
Location: Troy, MI
Posts: 221
6600gt is a jewel in the rough6600gt is a jewel in the rough6600gt is a jewel in the rough
Re: Serial Communications

Quote:
Under Windows, you're looking for BuildCommDCB(), GetCommConfig(), GetCommProperties(), and a collection of other functions. (In MSDN.)
Am i looking for c++ source code that has these functions?

David:
for starters try printf("output");
There should be an example in the user_routines.c

Last edited by 6600gt : 28-06-2006 at 16:36.
  #5   Spotlight this post!  
Unread 28-06-2006, 16:41
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
Why did I come back?
AKA: Jamie Bliss
FRC #4967 (That ONE Team)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Re: Serial Communications

Quote:
Originally Posted by 6600gt
Am i looking for c++ source code that has these functions?
I would say look for the functions themselves. Microsoft does a pretty good job of documenting them.

http://msdn.microsoft.com/library/de..._functions.asp
  #6   Spotlight this post!  
Unread 28-06-2006, 17:06
6600gt's Avatar
6600gt 6600gt is offline
Registered User
AKA: Lohit
FRC #0226 (Hammerhead)
Team Role: Alumni
 
Join Date: Jan 2006
Rookie Year: 2004
Location: Troy, MI
Posts: 221
6600gt is a jewel in the rough6600gt is a jewel in the rough6600gt is a jewel in the rough
Re: Serial Communications

Quote:
Originally Posted by Astronouth7303
I would say look for the functions themselves. Microsoft does a pretty good job of documenting them.

http://msdn.microsoft.com/library/de..._functions.asp
How do I know how to set up each function??
I am ok with the PIC c programming but I am totally new to this type of programming.
  #7   Spotlight this post!  
Unread 28-06-2006, 18:33
fowlerm's Avatar
fowlerm fowlerm is offline
Bringing .NET to Robots
AKA: Matthew Fowler
FRC #0312 (Heatwave); FRC #1369 (Minotaur)
Team Role: Engineer
 
Join Date: Apr 2005
Rookie Year: 2001
Location: St. Petersburg, FL, USA
Posts: 78
fowlerm has a spectacular aura aboutfowlerm has a spectacular aura aboutfowlerm has a spectacular aura about
Re: Serial Communications

Quote:
Originally Posted by 6600gt
How do I know how to set up each function??
I am ok with the PIC c programming but I am totally new to this type of programming.
If you are doing this on Windows why aren't you using .NET 2? It has serial I/O built in.

Maybe a better question would be if you are going to run this on Windows why are you using Qt? If the goal is to make this cross platform you might want to look at mono and glade, but each platform will still have different serial code.

Last edited by fowlerm : 28-06-2006 at 18:38.
  #8   Spotlight this post!  
Unread 28-06-2006, 21:40
6600gt's Avatar
6600gt 6600gt is offline
Registered User
AKA: Lohit
FRC #0226 (Hammerhead)
Team Role: Alumni
 
Join Date: Jan 2006
Rookie Year: 2004
Location: Troy, MI
Posts: 221
6600gt is a jewel in the rough6600gt is a jewel in the rough6600gt is a jewel in the rough
Re: Serial Communications

Quote:
Originally Posted by fowlerm
If you are doing this on Windows why aren't you using .NET 2? It has serial I/O built in.

Maybe a better question would be if you are going to run this on Windows why are you using Qt? If the goal is to make this cross platform you might want to look at mono and glade, but each platform will still have different serial code.
Can you refer me a resource/article on .NET 2 that I could get started with?

No, I don't need a cross platform program but Qt is the only program that I have found to date that has a simple, straight-forward interface. Do you have any better suggestions for creating windows GUI?

Edit: I am currently downloading Visual C++ Express with .NET 2 Framework. Is this what you had in mind?

Last edited by 6600gt : 28-06-2006 at 22:08.
  #9   Spotlight this post!  
Unread 28-06-2006, 22:14
sciguy125 sciguy125 is offline
Electrical Engineer
AKA: Phil Baltar
FRC #1351
Team Role: College Student
 
Join Date: Jan 2005
Rookie Year: 2004
Location: Sunnyvale, CA
Posts: 519
sciguy125 has a reputation beyond reputesciguy125 has a reputation beyond reputesciguy125 has a reputation beyond reputesciguy125 has a reputation beyond reputesciguy125 has a reputation beyond reputesciguy125 has a reputation beyond reputesciguy125 has a reputation beyond reputesciguy125 has a reputation beyond reputesciguy125 has a reputation beyond reputesciguy125 has a reputation beyond reputesciguy125 has a reputation beyond repute
Send a message via AIM to sciguy125 Send a message via MSN to sciguy125 Send a message via Yahoo to sciguy125
Re: Serial Communications

I was writing a replacement for IFI Loader awhile back.

http://www.chiefdelphi.com/forums/sh...ad.php?t=38853

It's written in Qt (Qt3, however) and should compile for both windows and linux. I used some compiler directives to detect the platform and use the appropriate pieces of code. Look for the files called serialio.cpp and serialio.h in the "loader" folder. It's a class with functions to send and recieve data via the serial port. You should be able to use it as a starting point.

I have to warn you though that I have yet to figure out why it doesn't work on Windows XP. As far as I can tell, my code is correct. When I compile it, I don't get any errors. Interestingly the same binary will run correctly on Windows 2000 and WINE, but it will freeze on Windows XP.
__________________

-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GE/S/P a-- e y-- r-- s:++ d+ h! X+++
t++ C+ P+ L++ E W++ w M-- V? PS+ PE+
5- R-- tv+ b+ DI+++ D- G
------END GEEK CODE BLOCK------
  #10   Spotlight this post!  
Unread 28-06-2006, 22:34
6600gt's Avatar
6600gt 6600gt is offline
Registered User
AKA: Lohit
FRC #0226 (Hammerhead)
Team Role: Alumni
 
Join Date: Jan 2006
Rookie Year: 2004
Location: Troy, MI
Posts: 221
6600gt is a jewel in the rough6600gt is a jewel in the rough6600gt is a jewel in the rough
Re: Serial Communications

Quote:
Originally Posted by sciguy125
I was writing a replacement for IFI Loader awhile back.

http://www.chiefdelphi.com/forums/sh...ad.php?t=38853

It's written in Qt (Qt3, however) and should compile for both windows and linux. I used some compiler directives to detect the platform and use the appropriate pieces of code. Look for the files called serialio.cpp and serialio.h in the "loader" folder. It's a class with functions to send and recieve data via the serial port. You should be able to use it as a starting point.

I have to warn you though that I have yet to figure out why it doesn't work on Windows XP. As far as I can tell, my code is correct. When I compile it, I don't get any errors. Interestingly the same binary will run correctly on Windows 2000 and WINE, but it will freeze on Windows XP.
For one thing I am using Qt 4, which seems to be quite different for Qt 3 form everything I have read. I still have to figure out how to pull the data form the sliders so I can send it in a struct over the serial port. As you can see I am new to this stuff so I am going to try Visual C++ and .NET 2(hopefully they will make life easier) but thanks anyway.
  #11   Spotlight this post!  
Unread 28-06-2006, 22:58
fowlerm's Avatar
fowlerm fowlerm is offline
Bringing .NET to Robots
AKA: Matthew Fowler
FRC #0312 (Heatwave); FRC #1369 (Minotaur)
Team Role: Engineer
 
Join Date: Apr 2005
Rookie Year: 2001
Location: St. Petersburg, FL, USA
Posts: 78
fowlerm has a spectacular aura aboutfowlerm has a spectacular aura aboutfowlerm has a spectacular aura about
Re: Serial Communications

You can use VC++, but I use C#. You need to look at the System.IO.Ports namespace on MSDN. You are going to want to use the SerialPort class. A couple of examples (in C#) can be found here.

As for the UI, the windows System.Windows.Forms library is very easy to work with and has lots of controls. You can use the Trackbar control (which is the slider) to get input values and then send them to the RC with the serial port.
  #12   Spotlight this post!  
Unread 28-06-2006, 23:24
6600gt's Avatar
6600gt 6600gt is offline
Registered User
AKA: Lohit
FRC #0226 (Hammerhead)
Team Role: Alumni
 
Join Date: Jan 2006
Rookie Year: 2004
Location: Troy, MI
Posts: 221
6600gt is a jewel in the rough6600gt is a jewel in the rough6600gt is a jewel in the rough
Re: Serial Communications

First I would like to say thanks to everyone that helped. I just downloaded C# and it seems quite promising for me (a beginner). I am currently playing with it and we will see how far I can before I have questions again.
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 technology has impacted communications in your life =) Nhiem Chit-Chat 4 20-05-2005 22:36
Spotty Radio Communications! Mr. Lim Control System 12 22-02-2005 20:47
Timer 0/Serial Communications? steven114 Programming 2 13-02-2005 20:50
Communications via the Programming Port Larry Barello Technical Discussion 9 10-06-2003 23:33
Radio Communications... Dan 550 General Forum 9 29-12-2001 17:00


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

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