Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Robotics Chat


Robotics Chat Specific to discussions about robots and the making of.

Reply
 
Thread Tools Display Modes
Old 14th February 2007, 08:27 PM   (permalink)
Question C++ talking to PIC16F877A via serial

Hey people, this is a robotics question as such but im having a bit of a problem with getting a C++ program, running in cygwin (on windows xp), to chat with a navigation controller (running on a PIC16F877A).

How can i access and read from/write to the serial port (COM1) inside cygwin?!?! I can use the standard terminal program in windows and it (the PIC) recieves and echos back any characters that i send.

if this is WAAAAY off topic for the board then i apologise :s
mrvanx is offline   Reply With Quote
Old 14th February 2007, 09:57 PM   (permalink)
Default

Are you refering to writting an application that talks to the serial port that is compiled using gcc?

A simple goolgle search will yeild windows code to talk to the serial ports.
I have used serial ports in MFC applications and under linux but not using cygwin under windows.
__________________
Dude, no way!!!!
Kingpin094 is offline   Reply With Quote
Old 14th February 2007, 10:20 PM   (permalink)
Default

Yer i am compiling using g++ (so yes gcc). I find LOADS of stuff concerning visual C++ and things but i am coding in just straight C++ at the command line, not a windows app etc...
mrvanx is offline   Reply With Quote
Old 15th February 2007, 02:07 AM   (permalink)
Default

Are you stuck to C++? I've used a free compiler called LCC-Win32 which allows windows program, it's ANSI C though.
__________________
"Because I be what I be. I would tell you what you want to know if I
could, mum, but I be a cat, and no cat anywhere ever gave anyone a
straight answer, har har."
Sceadwian is offline   Reply With Quote
Old 15th February 2007, 12:59 PM   (permalink)
Default

Quote:
Originally Posted by Sceadwian
Are you stuck to C++? I've used a free compiler called LCC-Win32 which allows windows program, it's ANSI C though.
Yer im kinda restricted to using g++ (gcc). The administrator is jammed so far up his own A$$ that he wont even tell me if i can install a USB driver for my camera (a nice 2 minute job!), let alone let us use a different compiler!
mrvanx is offline   Reply With Quote
Old 9th March 2007, 01:39 PM   (permalink)
Default

Given that Cygwin imitates a unix environment, I'd think that UNIX code would do the job. I haven't tried it with Cygwin, but I think you need to execute the standard termios (and maybe ioctl) commands to the "file" in /dev/ that points to your serial port. The commands are confusing but I've managed to get code to work based on sample C code that I've found, I just have not tried it under Windows yet.

Another possibility is Python. I don't know if Cygwin includes Python, but there is dirt-simple cross-platform code (it's less than 10 lines of code) to make python scripts to perform serial I/O. Then you can possibly call those scripts within C++.

Last edited by JeffDM; 9th March 2007 at 01:43 PM.
JeffDM is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Latest
PIC16F877A interfacing with Serial Port jasbertfalutine Micro Controllers 10 18th June 2006 07:25 AM
serial port cud u extend it?????? jam_mafia Electronic Projects Design/Ideas/Reviews 5 15th February 2006 06:51 AM
Serial to Parallel mstechca Electronic Projects Design/Ideas/Reviews 6 30th March 2005 04:40 AM
pic16f877 serial recieve acting screwy masconejos Micro Controllers 6 9th April 2004 10:08 AM
Can a Basic Stamp support 2 serial ports? Scruit Electronic Projects Design/Ideas/Reviews 13 15th August 2003 02:07 PM



All times are GMT. The time now is 11:38 AM.


Electronic Circuits  |  Electronics Wiki
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.