I am currently working on a vision system platform that inspects the marking and orientation of ICs. I have at my disposal is a PC, PIC circuitry, motors, steppers, their respective controllers, and a monochrome progressive scan cameras.

The PIC controls all the functions for mechanism as it receives instructions from the PC through serial port. The mechanism is basically a reel-tape filled with ICs going through inspection by the camera. And then it tells the PC whether it the function has been performed, which puts the respective IC directly under the camera. It is written all in C.

From here on the PC, a VB6 program will compare the image and decide whether the markings are similar or not. IF the markings have too much difference, it then prompts the user to decide whether it is a defect or not.

After that the PC should be sending a signal to the PIC, asking to either move to the next IC or stop or whatever. I plan to make all the IC tracking on the PC instead of PIC, since the result can be displayed on screen.

I need suggestion on how do I go about reading the serial port. Should I read the serial port constantly, from the moment the PC sends signal to the PIC? The function for PIC sending signal to PC is done only once, that is during the time where PIC already determined the IC is in place. Other than that and emergency procedures, there aren't any that I can think of yet.

Is 'constantly reading the port until the appropriate character is received' , the way to go about this? Would it affect the system? Make it hang, or slow it down or anything? I tested this out without any device at the serial port, and naturally it returns an empty string(or so I think it does, not too sure myself), but I'm not sure how it would behave if real hardware sending data is implemented.

Thanks in advance for any form of feedback or suggestion.

sorry about this. i couldnt find any "Edit Message" tab, so i posted a new reply to my own topic. -_-

anyway. how do i write a command that constantly reads the port as long as the form is in view? basically i'm asking here how do i make something that runs transparently when the form is open.

hmn, You could try something like:

if me.visible = true then
    ' /* Do Stuff To Read The Port */
end if

thanks for that.

unfortunately there's more question. For the camera part, inspecting the marking and orientation of the IC. How do I load a frame from that camera into a PicBox? I need it to set a reference image for comparison purposes, every time the IC passes, the camera captures, the VB program compares. Is a PicBox suitable for this? I went with this due to the fact that i can actually compare dot by dot, getting the percentage difference in its colour, to determine whether it pass or fails.

the camera in use now is a JAI Pulnix TM6760. And i tried using ezVid60.ocx i got off the net, to no avail. it keeps restarting my compiler whenever i run it.

OK.. I have another question. I'll try to get by the previous one.

I have the forms Inspection and PassFail. In the form Inspection there is a function that scans the image, and then calls the form PassFail, prompting the user to decide whether it is a pass or a fail or already end of cycle. PassFail form displays a bit of info.

How do I make PassFail work like a Msgbox/Inputbox? Where it prompts the user and waits for the user to input some stuff, which is when the actual form resumes its operation.

I have a function to stop the machine, before PassFail is loaded, and then resumes machine operation, once PassFail is closed(which decides the next move for the machine, either resume, or stop cycle).

this is what I have conjured so far for that part

CheckForm = False
If Stats = False Then
Load PassFail
CheckForm = True
End If
Loop While CheckForm = True

*here CheckForm(which is "Global CheckForm as Boolean" in some module where i store all global functions and variables) will be turned to False once the user decided the next move in PassFail form

it hangs the program. i was hoping the loop to keep the form "Inspection" waiting for result, which is only available after the user input some stuff into PassFail. but it ended up hanging

any suggestion on going about this?

Allow me introduce you to a part of the .Show method that will make this part much easier for you. Instead of

CheckForm = False
CheckForm = True
Loop While CheckForm = True

you would use

PassFail.Show vbModal

This has the effect of halting the rest of the application until the form PassFail is closed, which is what you seem to be looking for. It also reduces the number of extra variables you have to create, which means it takes up less memory and fewer lines of code - which means a smaller exectuable.

I unfortunately cannot (as of yet) help you with the camera images issue. I'm currently having an issue of my own involving images, though I have a few more tricks I'm going to try before I ask for help here.

Anyhow, I hope this little tidbit helps a bit!

- Sendoshin

thanks sedonshin for that snippet. Never noticed such feature for form loading.

anyway.. i got myself a Jai Pulnix CV-M10 and a Matrox MeteorII Multichannel imager. is there any thing i should be worried about before plugging these into my PC?