From: David N. <dno...@ya...> - 2007-03-21 02:20:19
|
I don't understand why you are using the "unpack" function on the data before you send it. This converts a byte string into a an ascii representation of that string. Does the device expect 5 raw bytes (0xFE, 0x04, 0x01, 0xBE, 0xD2) or 10 ascii characters "fe0401bed2"? David ----- Original Message ----- From: "Thorsten Weiss" <tho...@we...> To: <mis...@li...> Sent: Sunday, March 18, 2007 10:01 AM Subject: Re: [mh] Problems creating USB-Serial Port > > me again... > I've tried sending data with this short code: > > my @bytes = (0xFE, 0x04, 0x01, 0xBE, 0xD2); > my $hexstr = pack('C*',@bytes); > > my @on_bytes = (0xFD, 0x00, 0x00, 0x0E, 0x30, 0x98, 0x00, 0x00, > 0x00, 0x00, 0x06, 0x73, 0x00, 0x03, 0x01, 0x14, 0x86); > my @off_bytes = (0xFD, 0x00, 0x00, 0x0E, 0x30, 0x98, 0x00, 0x00, > 0x00, 0x00, 0x06, 0x73, 0x00, 0x03, 0x00, 0x04, 0x84); > my $on_hexstr = pack('C*',@on_bytes); > my $off_hexstr = pack('C*',@off_bytes); > > if ($Startup or $Reload) { > my $send_data = unpack ('H*',$hexstr); > print_log "$send_data"; > } > > i#ve put this in mh.ini: > > @ Parameter für HS485PCI > hs485pci_interface_module = hs485pci_interface > hs485pci_interface_port =/dev/ttyUSB1 > hs485pci_interface_baudrate =19200 > hs485pci_interface_datatype =raw > hs485pci_interface_parity =even > hs485pci_interface_handshake=rts > > then i restartet mh, but i'm not been able to send the data i get no > respose > from my interface.... > > I wrote a stand alone test-programm where i defined the following serial > interface: > > my $device = Device::SerialPort->new ($port) or die " Konnte $port nicht > öffnen!\n"; > > $device->error_msg(1); # use built-in error messages > $device->user_msg(0); > $device->databits(8); > $device->baudrate(19200); > $device->parity("even"); > $device->stopbits(1); > $device->dtr_active(0); > $device->handshake("rts"); > $device->write_settings || die "Konnte Einstellungen für $port nicht > setzen\n"; > > after running my test-programm, i could send my commands also from MH but > the receiving with the said method won't work. > > It seems to me that MH din't set the PORT parameters correctly... > > Does anybody has a solution for that problem? > > Regards, > thorsten. > > > > -- > View this message in context: > http://www.nabble.com/Problems-creating-USB-Serial-Port-tf3398171.html#a9540515 > Sent from the Misterhouse - User mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > ________________________________________________________ > To unsubscribe from this list, go to: > http://sourceforge.net/mail/?group_id=1365 > > |