Serial Ports

I'm wondering why my arduino uno gets assigned as a different serial port from time to time.

When I plug it into the same OSX machine, sometimes it is assigned as.

/dev/tty.usbmodem1d21

and sometimes

/dev/tty.usbmodem1d11

This is a real pain for me as I'm communicating to it through the serial port and when that changes to /dev/tty.usbmodem1d21 my code stops working unless I modify it.

Any ideas?

Cheers.

Phil

For me, on OS X, the serial port device name corresponds to the physical USB port I plug the device into. Does using the same physical port every time help?

I am using windows and sometimes it goes weird i unplug and plug back and it gets recognized from the same port

I thought I was using the same physical port, I'll check that out later.

Thanks.

Phil