trying to read COM1 port to get data from a cisco switch I cannot seem to get the info in readible format.
COM1 port access
BlitzMax Forums/BlitzMax Programming/COM1 port access this is what I have so far which will display com1 data but it is all distorted I am assuming because I need to some how tell it to use the right baudrate,data bits,and stop bits.
Global ComSteam:TStream Global recvd:String Global data:String Global bytes ComSteam = OpenStream("COM1:") If ComSteam Print "STREAM CONNECTED on COM1" Else Print "STREAM FAILED TO CONNECT on COM1 " Input() End EndIf Repeat 'Print "@Recieving "+data+" byte(s)" bytes = StreamSize(ComSteam) DebugLog bytes + " DEBUG INFO HERE" 'Local send$ = Input("PC> ") WriteByte(ComSteam,2) If bytes Local i SeekStream(ComSteam,0) For i=0 To StreamSize(ComSteam)-1 data = data + Chr(ReadByte(ComSteam)) Next Print "COM1> " + data Clean() Else 'Print "COM1 has timed out." EndIf If KeyHit(ESCAPE) Then End Forever Function wait() Local time = MilliSecs() While StreamPos(ComSteam)=0 If MilliSecs()-time>1000 ' we'll give it a 1 second time out Return 0 EndIf Wend Return StreamSize(ComSteam) End Function Function recv() Local data$,i SeekStream(ComSteam,0) For i=0 To StreamSize(ComSteam)-1 data = data+Chr(ReadByte(ComSteam)) Next End Function Function clean() CloseStream(ComSteam) ComSteam = OpenStream("COM1:") End Function
Would you be wanting the COMM module here:
http://www.nigelibrown.pwp.blueyonder.co.uk/blitz/userlibs/index.htm
http://www.nigelibrown.pwp.blueyonder.co.uk/blitz/userlibs/index.htm
well i tried that module and it doesn't seem to do anything with the above code I actually get something.
any ideas anyone? still working on this and it's driving me insane.
Does anyone have Mr.browns contact info so I can email him it is not on his site or modules.
Does anyone have Mr.browns contact info so I can email him it is not on his site or modules.
any ideas anyone?
Use Linux and the tty for the serial port instead. i would rather use linux but that is not an option right now.
@ckob click on the name and you will get contact info
yeah I knew that but did not know your user name here guess I should of searched your name :P sent you an email.
The above code does work just not in any readable format is there a way to pass the baudrate,data bits,and stop bits once connect?
@ckob
you should check wxCTB now as this morning I had it receiving data on a MAC!
you should check wxCTB now as this morning I had it receiving data on a MAC!
..except it's only had 1 day development, so don't get your hopes up too much. Still lots to do.