![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | Serial Communications w/ PoSH Hello, I am trying to write and read frm a serial port with Powershell. I found Jeff Snover's post on the Powershell MSDN blog, but Powershell craches whenever I add anything to the DataReceived event. If anyone has any samples of how to open a COM Port, write a few CRLF and read the result, I would appreciate it!. Thanks, Bob |
My System Specs![]() |
| | #2 (permalink) |
| Guest | RE: Serial Communications w/ PoSH async eventsupport is not yet supported natively , you can only "wait" for the event you can use Oisins excelent event library for this http://www.codeplex.com/PSEventing Greetings /\/\o\/\/ http://thePowerShellGuy.com "robsmith" wrote: > Hello, > > I am trying to write and read frm a serial port with Powershell. > > I found Jeff Snover's post on the Powershell MSDN blog, but Powershell > craches whenever I add anything to the DataReceived event. > > If anyone has any samples of how to open a COM Port, write a few CRLF and > read the result, I would appreciate it!. > > Thanks, > > Bob |
My System Specs![]() |
| | #3 (permalink) |
| Guest | RE: Serial Communications w/ PoSH Mow, Thanks for the reply. I tried it and can receive events, but I am having difficulty looking at the actual data returned. Args.Data does not appear to exist ... Any help would be appreciated. Thanks, Bob PS C:\PoSHeventing> get-eventbinding port VariableName EventName TypeName Listening ------------ --------- -------- --------- port DataReceived SerialPort True PS C:\PoSHeventing> $events PS C:\PoSHeventing> $event Occurred Source Name Args -------- ------ ---- ---- 7/20/2007 8:24:13 AM System.Management.Automati... DataReceived System.IO.Ports.SerialData... 7/20/2007 8:24:13 AM System.Management.Automati... DataReceived System.IO.Ports.SerialData... 7/20/2007 8:24:13 AM System.Management.Automati... DataReceived System.IO.Ports.SerialData... 7/20/2007 8:24:13 AM System.Management.Automati... DataReceived System.IO.Ports.SerialData... 7/20/2007 8:24:13 AM System.Management.Automati... DataReceived System.IO.Ports.SerialData... 7/20/2007 8:24:13 AM System.Management.Automati... DataReceived System.IO.Ports.SerialData... "/\/\o\/\/ [MVP]" wrote: > async eventsupport is not yet supported natively , you can only "wait" for > the event > > you can use Oisins excelent event library for this > > http://www.codeplex.com/PSEventing > > Greetings /\/\o\/\/ > http://thePowerShellGuy.com > > "robsmith" wrote: > > > Hello, > > > > I am trying to write and read frm a serial port with Powershell. > > > > I found Jeff Snover's post on the Powershell MSDN blog, but Powershell > > craches whenever I add anything to the DataReceived event. > > > > If anyone has any samples of how to open a COM Port, write a few CRLF and > > read the result, I would appreciate it!. > > > > Thanks, > > > > Bob |
My System Specs![]() |
| | #4 (permalink) |
| Guest | RE: Serial Communications w/ PoSH hio Rob sorry I can't test what is the output of $a = $events[0].args $a $a.psbase greetings /\/\o\/\/ "robsmith" wrote: > Mow, > > Thanks for the reply. I tried it and can receive events, but I am having > difficulty looking at the actual data returned. Args.Data does not appear to > exist ... > > Any help would be appreciated. > > Thanks, > > Bob > > PS C:\PoSHeventing> get-eventbinding port > > VariableName EventName TypeName > Listening > ------------ --------- -------- > --------- > port DataReceived SerialPort > True > > > PS C:\PoSHeventing> $events > PS C:\PoSHeventing> $event > > Occurred Source Name > Args > -------- ------ ---- > ---- > 7/20/2007 8:24:13 AM System.Management.Automati... DataReceived > System.IO.Ports.SerialData... > 7/20/2007 8:24:13 AM System.Management.Automati... DataReceived > System.IO.Ports.SerialData... > 7/20/2007 8:24:13 AM System.Management.Automati... DataReceived > System.IO.Ports.SerialData... > 7/20/2007 8:24:13 AM System.Management.Automati... DataReceived > System.IO.Ports.SerialData... > 7/20/2007 8:24:13 AM System.Management.Automati... DataReceived > System.IO.Ports.SerialData... > 7/20/2007 8:24:13 AM System.Management.Automati... DataReceived > System.IO.Ports.SerialData... > > > > > > > "/\/\o\/\/ [MVP]" wrote: > > > async eventsupport is not yet supported natively , you can only "wait" for > > the event > > > > you can use Oisins excelent event library for this > > > > http://www.codeplex.com/PSEventing > > > > Greetings /\/\o\/\/ > > http://thePowerShellGuy.com > > > > "robsmith" wrote: > > > > > Hello, > > > > > > I am trying to write and read frm a serial port with Powershell. > > > > > > I found Jeff Snover's post on the Powershell MSDN blog, but Powershell > > > craches whenever I add anything to the DataReceived event. > > > > > > If anyone has any samples of how to open a COM Port, write a few CRLF and > > > read the result, I would appreciate it!. > > > > > > Thanks, > > > > > > Bob |
My System Specs![]() |
| | #5 (permalink) |
| Guest | RE: Serial Communications w/ PoSH Mow, Here's the output you requested ... PS C:\Documents and Settings\robsmith> $port BaseStream : System.IO.Ports.SerialStream BaudRate : 1200 BreakState : False BytesToWrite : 0 BytesToRead : 23 CDHolding : False CtsHolding : False DataBits : 8 DiscardNull : False DsrHolding : False DtrEnable : False Encoding : System.Text.ASCIIEncoding Handshake : None IsOpen : True NewLine : Parity : None ParityReplace : 63 PortName : COM1 ReadBufferSize : 4096 ReadTimeout : -1 ReceivedBytesThreshold : 1 RtsEnable : False StopBits : One WriteBufferSize : 2048 WriteTimeout : -1 Site : Container : PS C:\Documents and Settings\robsmith> $e Occurred Source Name Args -------- ------ ---- ---- 7/23/2007 9:45:11 AM System.Management.Automati... DataReceived System.IO.Ports.SerialData... 7/23/2007 9:45:11 AM System.Management.Automati... DataReceived System.IO.Ports.SerialData... 7/23/2007 9:45:11 AM System.Management.Automati... DataReceived System.IO.Ports.SerialData... 7/23/2007 9:45:11 AM System.Management.Automati... DataReceived System.IO.Ports.SerialData... 7/23/2007 9:45:11 AM System.Management.Automati... DataReceived System.IO.Ports.SerialData... 7/23/2007 9:45:11 AM System.Management.Automati... DataReceived System.IO.Ports.SerialData... 7/23/2007 9:45:24 AM System.Management.Automati... DataReceived System.IO.Ports.SerialData... PS C:\Documents and Settings\robsmith> get-eventbinding VariableName EventName TypeName Listening ------------ --------- -------- --------- port DataReceived SerialPort True PS C:\Documents and Settings\robsmith> $e[0].Args EventType --------- Chars PS C:\Documents and Settings\robsmith> $a EventType --------- Chars PS C:\Documents and Settings\robsmith> $a.psbase EventType --------- Chars I also posted to a discussion on Oisin's site, haven't heard back yet. Thanks for the help, Bob "/\/\o\/\/ [MVP]" wrote: > hio Rob sorry I can't test > > what is the output of > $a = $events[0].args > $a > $a.psbase > > greetings /\/\o\/\/ > > "robsmith" wrote: > > > Mow, > > > > Thanks for the reply. I tried it and can receive events, but I am having > > difficulty looking at the actual data returned. Args.Data does not appear to > > exist ... > > > > Any help would be appreciated. > > > > Thanks, > > > > Bob > > > > PS C:\PoSHeventing> get-eventbinding port > > > > VariableName EventName TypeName > > Listening > > ------------ --------- -------- > > --------- > > port DataReceived SerialPort > > True > > > > > > PS C:\PoSHeventing> $events > > PS C:\PoSHeventing> $event > > > > Occurred Source Name > > Args > > -------- ------ ---- > > ---- > > 7/20/2007 8:24:13 AM System.Management.Automati... DataReceived > > System.IO.Ports.SerialData... > > 7/20/2007 8:24:13 AM System.Management.Automati... DataReceived > > System.IO.Ports.SerialData... > > 7/20/2007 8:24:13 AM System.Management.Automati... DataReceived > > System.IO.Ports.SerialData... > > 7/20/2007 8:24:13 AM System.Management.Automati... DataReceived > > System.IO.Ports.SerialData... > > 7/20/2007 8:24:13 AM System.Management.Automati... DataReceived > > System.IO.Ports.SerialData... > > 7/20/2007 8:24:13 AM System.Management.Automati... DataReceived > > System.IO.Ports.SerialData... > > > > > > > > > > > > > > "/\/\o\/\/ [MVP]" wrote: > > > > > async eventsupport is not yet supported natively , you can only "wait" for > > > the event > > > > > > you can use Oisins excelent event library for this > > > > > > http://www.codeplex.com/PSEventing > > > > > > Greetings /\/\o\/\/ > > > http://thePowerShellGuy.com > > > > > > "robsmith" wrote: > > > > > > > Hello, > > > > > > > > I am trying to write and read frm a serial port with Powershell. > > > > > > > > I found Jeff Snover's post on the Powershell MSDN blog, but Powershell > > > > craches whenever I add anything to the DataReceived event. > > > > > > > > If anyone has any samples of how to open a COM Port, write a few CRLF and > > > > read the result, I would appreciate it!. > > > > > > > > Thanks, > > > > > > > > Bob |
My System Specs![]() |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| NewLine in PoSh | greatbarrier86 | PowerShell | 10 | 07-07-2008 02:43 PM |
| Re: Serial Plonkers v. Serial Killers | kurttrail | Vista General | 0 | 04-16-2008 10:20 AM |
| PoSh: Quine | dreeschkind | PowerShell | 12 | 05-30-2007 01:24 PM |
| PoSH Vista !! | /\\/\\o\\/\\/ [MVP] | PowerShell | 4 | 01-30-2007 03:27 PM |
| PoSh quiz | dreeschkind | PowerShell | 7 | 01-30-2007 10:54 AM |