[PD] Trying to get comport to work in windows

Martin Peach martin.peach at sympatico.ca
Sat Aug 5 04:53:35 CEST 2006


Martin Dupras wrote:
> Well, Frank seems to be right. I have 0.39.2extended-test4.exe on XP; 
> I have changed the actual com number by doing
>
> control panel->system->device manager->bluetooth devices and changing 
> the com number for my device to com 2.
>
> That seems to work fine.
>
> I have always wondered why these limitations are put in place? Why 
> limit things like that? Surely the memory usage difference is minimal 
> in comparison with the hassle that arises from hitting the 
> limitations? Or am I missing something?
>
I don't know. It probably started with the list of names being too 
boring to type after COM8 , and then got changed to an apparently 
arbitrary maximum of 99. I suppose ideally the code should find out from 
the OS how many serial ports are actually available on the system and 
use those and only those. This approach takes more time to code than 
just setting the arbitrary limit (and it will be different code for each 
OS). The easiest is to not have a limit but experience teaches that 
there are usually one or more values that will crash the program. In the 
past checking for the existence of a serial port involved accessing 
memory at its presumed address, which could cause another device at that 
location to malfunction. A quick check on MSDN shows no obvious way in 
Windows to find a list of serial devices without trying each and every 
one, which starts to take too much time beyond a few hundred...

Martin

> Thanks for the help. I don't think I would have been close to a 
> solution without it.
>
> - martin
>
>
> On 04/08/06, *Martin Peach* < martin.peach at sympatico.ca 
> <mailto:martin.peach at sympatico.ca>> wrote:
>
>     Frank Barknecht wrote:
>     > Hallo,
>     > Martin Dupras hat gesagt: // Martin Dupras wrote:
>     >
>     >
>     >> Hi,
>     >>
>     >> I'm trying to use a Spark Fun WiTilt (essentially a 3D
>     accelerometer
>     >> attached to a bluetooth radio, see
>     >>
>     http://www.sparkfun.com/commerce/product_info.php?products_id=254)
>     with PD
>     >> 0.39.2extended-test4 on win XP.
>     >>
>     >> I know the device is connected and sending because I can see
>     the correct
>     >> output if I connect to the device with hyperterminal.
>     >>
>     >> My device is on com port 12. If I try
>     >>
>     >> [comport 12 9600]
>     >>
>     >> I get the error: "[comport] invalid handle for COM".
>     >>
>     >> Is there any reason why comport should not see the port, when
>     hyperterminal
>     >> can?
>     >>
>     >
>     >
>     > You may need to recompile comport or use a different port: As
>     default it only
>     > accepts up to 8 comports.
>     >
>     > Therse is this in comport.c:
>     >
>     > #define COMPORT_MAX 8
>     > static char *sys_com_port[COMPORT_MAX] =
>     > {
>     >   "COM1", "COM2", "COM3", "COM4",
>     >   "COM5", "COM6", "COM7", "COM8"
>     > };
>     >
>     >
>     I think you have an older version of comport.
>
>     The sys_com_port array is not there. There is just this in the
>     latest version of comport.c in cvs:
>
>     #define COMPORT_MAX 99
>     so you should be able to open COM1 through COM98.
>
>     Martin
>     > which you can try to change to something like:
>     >
>     > #define COMPORT_MAX 12
>     > static char *sys_com_port[COMPORT_MAX] =
>     > {
>     >   "COM1", "COM2", "COM3", "COM4",
>     >   "COM5", "COM6", "COM7", "COM8"
>     >   "COM9", "COM10", "COM11", "COM12"
>     > };
>     >
>     > but I just guessed this, so no guarantees.
>     >
>     > Ciao
>     >
>
>
>
>     _______________________________________________
>     PD-list at iem.at <mailto:PD-list at iem.at> mailing list
>     UNSUBSCRIBE and account-management ->
>     http://lists.puredata.info/listinfo/pd-list
>
>





More information about the Pd-list mailing list