Wrox Programmer Forums
|
Pro VB 6 For advanced Visual Basic coders working in version 6 (not .NET). Beginning-level questions will be redirected to other forums, including Beginning VB 6.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 27th, 2005, 07:44 PM
Authorized User
 
Join Date: Aug 2004
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
Default Accessing COM port

hi friends,

  I've installed attendance scanning system. connected to my system. When we scan, its storing the data in the machine(scanner). The we have to upload the data from the scanner console. it will get the data in a text file in the format(cardno datetime)
Ex: 0000304065 200504281625(year,month,day,time)

I want to link it to my payroll

I dont want to do the long procedure. Is it possible to recognise an event when the com port receives data(means when anyone scans)
so that i want to store directly to my sql server database.

how can i do this?

thanx in advance

 
Old April 28th, 2005, 01:27 PM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

To have your machine respond when there are data at the com port, you will need to set up a timed polling of the com port. Every so often you will need to go have a lok regarding whether the com port is awaiting being serviced.

I don’t believe it is possible to have an event at the com port cause the computer to do something, rather the computer must be looking to see if the com port is making a request.
 
Old April 28th, 2005, 02:01 PM
Registered User
 
Join Date: Sep 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi tsimsha,

To have a COM Port effectively create an Event is not impossible. However, there is sting in the tail. You will need to create a routine using Embedded "C" within the COM Port Software. I have never done this myself but as a supplier of Contract Software Engineers, I supplied a Company to do design just that. It took six weeks to prototype and test it ! The previous respondent to your question has suggested the other alternative which I feel is not so reliable and requires overhead resources continually being used to scan the COM Port. If the machine is well loaded with other chores it may not look at the Port to regularly. Doesn't help you that much but I can only re-iterate, it is possible.

 
Old April 29th, 2005, 10:37 AM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

That’s interesting that you get a COM port to trigger events; didn’t know that.

But of course, events are not interrupts, so it is still a cse of polling, except the ‘guts’ of the polling procedure are handled without you having to write the code. But then, that’s a good deal!

I believe that the details behind “Embedded "C" within the COM Port Software” are this: adding an interrupt service routine.

On a regular basis, the computer runs what is called the interrupt service routine. The processor goes to a pre-determined location to get the address of the first routine in the series of interrupt service routines. That code runs, and at the end of it is stored the address of the next service routine. This goes on until all members of the chain of routines have been serviced, and then you are returned to your regularly scheduled programming (so to speak).

This is an area where it is [i]very[/] easy to hang the machine...

(All this is if I understand Draffus correctly...)
 
Old April 29th, 2005, 07:23 PM
Authorized User
 
Join Date: Aug 2004
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi all,

  thanx for the response. sorry i was unable to respond since 2 days.

My main intention is to get the data into my sql server database.
When the user scans the card, the data is temporarly stored in the machine memory. later we need to upload data. it will transfer data to a text file(i already mentioned in my first post).

I need to get data in the form

cardno date in1 out1 in2 out2 in3 out3 in4 out4

guess 8 scans a day.
but, when a scan occurs it will maintain a record(textfile)
so that each user will have 8 records a day.
if i have 250 users, it will be more in a day. per month its very high.

how can i manipulate this?

thanx






Similar Threads
Thread Thread Starter Forum Replies Last Post
USB Port kanoorani Beginning VB 6 8 August 12th, 2009 04:28 PM
Accessing USB and Serial Port through Java taraprasad Pro JSP 3 April 10th, 2008 06:20 AM
Serial Port johnjohn Access VBA 2 November 19th, 2004 02:53 PM
Serial Port johnjohn Classic ASP Databases 1 November 16th, 2004 03:08 AM
Usb Port? dedex C# 1 November 9th, 2004 06:14 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.