8 Replies - 1542 Views - Last Post: 10 July 2010 - 08:48 AM Rate Topic: -----

#1 maverick8  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 09-July 10

Serial Port Communication

Posted 10 July 2010 - 02:21 AM

Hello all,

I am looking for help with programming (how to/assistance). You see I have this very old program at work that is used in dos. This program seems to me to be a very simple program but i can not seem to find a starting point of trying to reproduce this program in something more modern, my bigger issue is that this program is very finicky when used in windows. Long story short, this program sends ascii to a serial port which goes out to a inkjet printer, pretty much only the current date is being sent to the printer. I have the program and the port settings which i have seen using text editors.

Is this relally that difficult or am i just having a hell of a time getting started? I understand there are basics that i need to learn, which i will, but right now time is not on my side.

Any help will be greatly appreciated!

Is This A Good Question/Topic? 0
  • +

Replies To: Serial Port Communication

#2 alias120  Icon User is offline

  • The Sum over All Paths
  • member icon

Reputation: 122
  • View blog
  • Posts: 700
  • Joined: 02-March 09

Re: Serial Port Communication

Posted 10 July 2010 - 02:38 AM

You need to start with the basics. Anybody can be given a program and or copy and paste it off the internet. If you really want to learn something though, get some books and some good resources from the internet together. Pick a language and a compiler. Then begin coding. It is important to have resources, such as this site, at your disposal. What is more important is to do actual coding. This is the only way you will really learn. Assuming you want to learn C or C++, given the forum your posting in, here are a few resources that might assist you in your learning.

http://www.cplusplus.com/doc/tutorial/
http://www.cprogramm...m/tutorial.html
http://mindview.net/...ingInCPP2e.html
Was This Post Helpful? 0
  • +
  • -

#3 Bench  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 856
  • View blog
  • Posts: 2,339
  • Joined: 20-August 07

Re: Serial Port Communication

Posted 10 July 2010 - 04:01 AM

View Postmaverick8, on 10 July 2010 - 09:21 AM, said:

I am looking for help with programming (how to/assistance). You see I have this very old program at work that is used in dos. This program seems to me to be a very simple program but i can not seem to find a starting point of trying to reproduce this program in something more modern, my bigger issue is that this program is very finicky when used in windows.
Its most likely a program which was designed only to be used on a 16-bit platform; migrating it to a 32-bit platform is likely to be less simple than you may be hoping for

View Postmaverick8, on 10 July 2010 - 09:21 AM, said:

Long story short, this program sends ascii to a serial port which goes out to a inkjet printer, pretty much only the current date is being sent to the printer. I have the program and the port settings which i have seen using text editors.
C and C++ know nothing about "serial ports" or "printers", so you're at the mercy of whichever library the program uses to do that (or worse, it may have done things 'by hand' and directly interfaced with the hardware through interrupt handling); Its possible that there is no 32-bit version of the library you're using, which means you might need to find another library which does what you want to do, and start from there.

View Postmaverick8, on 10 July 2010 - 09:21 AM, said:

Is this relally that difficult or am i just having a hell of a time getting started? I understand there are basics that i need to learn, which i will, but right now time is not on my side.

Any help will be greatly appreciated!
The best way to get up to speed is find a good mentor who can guide you through the basics; these are generally very hard to find, so the alternative is to enrol on an introductory course, where you'll at least have a tutor who you can ask questions to.

In any case, whether you enrol on a course, or if you decide to go it alone, you should invest in a good C++ book; a subject which has been covered plenty of times in recent forum threads here:
http://www.dreaminco...mers-bookshelf/
http://www.dreaminco...179827-learn-c/

I don't recommend relying on internet resources/tutorials - the quality of material found on the web is fairly mediocre (sites like 'learncpp.com' and 'cplusplus.com' are really inadequate for anyone who is serious about learning to program)

You should be aware that learning C or C++ as a complete beginner will not be a quick or easy endeavour, and in the meantime, you might want to put the plans for your program on hold until you have a firm grasp on how to use all of the tools you'll need; if your employer needs that program working on a 32-bit or 64-bit platform urgently, then their best option might be to hire an experienced contract developer to solve the problem.

This post has been edited by Bench: 10 July 2010 - 04:08 AM

Was This Post Helpful? 1
  • +
  • -

#4 alias120  Icon User is offline

  • The Sum over All Paths
  • member icon

Reputation: 122
  • View blog
  • Posts: 700
  • Joined: 02-March 09

Re: Serial Port Communication

Posted 10 July 2010 - 04:41 AM

Bench is right about the websites, though I believe they are good for being introduced to the basics. As bench said, these resources are inadequate for real research into the language. A good book will get you much further. I can say from personal experience that the sites can assist in your learning of a language, but to a point. Once you get beyond simple variable declaration and initialization, basic functions and loops, the websites don't do a great job of covering the scope of the language. That is where a few good books will be invaluable. Good luck in your endeavour and if you have any additional questions feel free to ask.
Was This Post Helpful? 0
  • +
  • -

#5 maverick8  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 09-July 10

Re: Serial Port Communication

Posted 10 July 2010 - 07:24 AM

would c+ be the "best" language for something like this? I did a little bit of visual basic some 5-7 years ago but totally lost it all because i never used it. i did some simple form stuff but nothing interfacing with ports namely serial, can this be done in vb?
Was This Post Helpful? 0
  • +
  • -

#6 KYA  Icon User is offline

  • g++ jameson.cpp -o beverage
  • member icon

Reputation: 3105
  • View blog
  • Posts: 19,144
  • Joined: 14-September 07

Re: Serial Port Communication

Posted 10 July 2010 - 07:37 AM

Anything can be done in any language. Just depends on how easy/hard you want your task to be.
Was This Post Helpful? 0
  • +
  • -

#7 maverick8  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 09-July 10

Re: Serial Port Communication

Posted 10 July 2010 - 08:03 AM

View PostKYA, on 10 July 2010 - 06:37 AM, said:

Anything can be done in any language. Just depends on how easy/hard you want your task to be.


lets go with easy. what would be the easiest language to start with? VIsual Basic? Is this just a few lines of code?
Was This Post Helpful? 0
  • +
  • -

#8 KYA  Icon User is offline

  • g++ jameson.cpp -o beverage
  • member icon

Reputation: 3105
  • View blog
  • Posts: 19,144
  • Joined: 14-September 07

Re: Serial Port Communication

Posted 10 July 2010 - 08:07 AM

It's not the language, as Bench has already said, it's all about the libraries. Pick a language that you're comfortable with and start researching what libraries are available to communicate with serial ports.


*Modified title to be more descriptive of the problem*
Was This Post Helpful? 0
  • +
  • -

#9 NickDMax  Icon User is offline

  • Can grep dead trees!
  • member icon

Reputation: 2250
  • View blog
  • Posts: 9,245
  • Joined: 18-February 07

Re: Serial Port Communication

Posted 10 July 2010 - 08:48 AM

There is a nice C++ serial comm lib and tutorial here.

I have been dealing with serial communications with my micro controller and I have been finding Java a good language to work from for serial communications using the JavaComm library.

For modern windows development (with a shorter rampup time than C++) I suggest C# -- we have a tutorial on serial comms with C# here

C++ is a great language, but it has a very steep learning curve (especially for GUI programming) and really takes a level of commitment, if you are just trying to hack together some new features for some old DOS program (and are not dedicated to programming) then I would look into C# or VB.Net.
Was This Post Helpful? 2
  • +
  • -

Page 1 of 1