Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Comm Port opening?  RSS feed

 
Jeff Grant
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am currently writing my senior project in college and it is a cash register program. I have a cash drawer which hooks up to the computer via the Comm Port. Now, I have searched on java.sun.com without much luck of finding a tutorial or sample code that was very understandable. My OS is Windows 2000. If anyone could give me a nice little code snippet for taking ownership of the port, and then sending just a little 'bit' through a line (I'm not sure which pin it is so I'll just try them one by one), that'd be greatly appreciated! Even a link that has some easily read example code would be great also.
I have already downloaded the javax.comm package but it cannot find the SerialPort.open function. This is where I am stuck. Thanks for any help you can provide me in advance.
 
Matt Senecal
Ranch Hand
Posts: 255
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, I hope this will help you. Here's how to open a port:

Here's how you get that data input and output streams to the ports:

To write to the port:

Please let me know if you have any more questions.
[ July 16, 2002: Message edited by: Matt Senecal ]
 
Raghav Mathur
Ranch Hand
Posts: 641
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Matt
i,am new to serial port programming . I've explored the javax.comm Api and even understood it .Since i,am new to serial port communication i would like to read some tutotrials on serial and parallel ports, how do they work and theory behind ports . Is there a good book for beginers or are there good tutorials on the net .
thanks in addvance
regards
raghav mathur
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!