Re: [Gambas-user] Serial Port issues and events.
To read into an array, do something like: Public Sub SerialPort_Read() Dim aData As New Byte[] Dim iLen As Integer iLen = Lof(Last) aData.Resize(iLen) Try aData.Read(Last, 0, iLen) End 2016-06-30 17:44 GMT+02:00 ML <d4t4f...@gmail.com>: > Fernando, > > I know what you mean. In my case I just wanted to show in the examples > which bytes come and go through the port. > I do know 0x02 ( for Gambas) is a single byte with value 2. I'm not > transmitting "0-x-0-2" over the wire as 4 bytes, I'm just transmitting a > string whose first character has ASCII value 0x02. > > I have also been coding for years (started with QB45 in the nineties, > and before that with ZX-81 and ZXSpectrum in BASIC and even Assembler). > I have coded several countries' Fiscal Printer interfaces for my company > (all of them RS232C). But all this I did on Mr Gates' in-operating > systems and IDEs. > > I do not know, though, the basics of RS232 I/O on Gambas3, methinks: > I do not know -for example- what is wrong in my code that makes serial > xxx_READ events not trigger. > I also do not know how to write/read proper binary-as-string (or even > bynary-as-byte[]) to/from RS232. > > My particular issue with the program: > When the .InputBufferSize is not zero, it shows 3, which is correct (I'm > expecting three bytes or chars, with values 0x02-0x15-0x03). > Immediately afterwards, when I READ these bytes into a string (the only > working thing so far), the first byte (0x02) is chopped off and the LEN > of the resulting string is 2. > I wonder: How come? There were three bytes in the buffer and I get a two > byte string! > I think Gambas is treating the 0x02 as a string-lenght indicator, and > fills the string with the rest of the buffer, therefore fetching 2 > characters (this seems backed because the string gets the 0x15 and 0x03 > bytes as its contents). But I need all three bytes. > My not-so-wild-guess (which agrees with your advise) is that I must use > Byte[] and not String to read these blocks. Problem is twofold: > 1- (BAD) Cannot get the _READ event to trigger > 2- (WORSE) Cannot figure out how to make Gambas return a Byte[] with the > buffer contents. > > Any pointers or working examples in those directions WILL help. Hope I > explained myself better now. > > Regards, > zxMarce. > > On 2016-06-30 11:34, nand...@nothingsimple.com wrote: > > I've done extensive work with the serial port for a dozen years > > with 100% success 24 hour operation. > > > > Sometimes people get mixed up with "0x02" thinking it's binary. > > That is 4 characters ascii. > > I prefer to use chr(2) to create a 1 length string binary 2. > > If you're going to use byte[] array > > then byte[0] = 2 is the equivalent. > > Using escape (like HTML encoding) is the incorrect thinking > > -Fernando > > > > -- > > Open WebMail Project (http://openwebmail.org) > > > > > > -- Original Message --- > > From: ML <d4t4f...@gmail.com> > > To: gambas-user@lists.sourceforge.net > > Sent: Thu, 30 Jun 2016 10:51:41 -0300 > > Subject: Re: [Gambas-user] Serial Port issues and events. > > > >> Alexie, > >> > >> Not really. This is my first attempt at a binary-exchange over serial in > >> Gambas. Can't also find out the old G3 examples that might have existed > >> about this and my web searches were unsuccessful. > >> So, if you could point me to some example code to read a Byte[], I'll be > >> grateful. My attempts to read to a Byte[] failed with SEGFAULT, or > >> errors with no text. > >> > >> On the other hand, I just realized -again, happened to me in the past > >> and I forgot it did- that the list does not send text inside RAW tags... > >> The code can be seen only on Nabble's site, so I'm reinserting it here. > >> Please excuse my notation; I know it's not Gambas standard. It's what I > >> used for eons on QB45, VB3, VB4, VB5 VB6 and even .Net for my day to day > >> work; (really) old habits die hard. > >> > >> Declarations: > >> > >> Private Const TEST_TX As String = " ø1 " '0x02-0xF8-0x31-0x03 - > >> Nabble's RAW TEXT tags removed some data from the string > >> Private Const TEST_RX As String = " " '0x02-0x15-0x03 - Nabble's RAW > >> TEXT tags removed some data from the string > >> Private m_tty As SerialPort > >> Private m_rxBuff As String = Null > >> > >> Instancing and setting the port up: > >> > >> 'Instance serial port and set properties > >> m_tty =
Re: [Gambas-user] Serial Port issues and events.
Fernando, I know what you mean. In my case I just wanted to show in the examples which bytes come and go through the port. I do know 0x02 ( for Gambas) is a single byte with value 2. I'm not transmitting "0-x-0-2" over the wire as 4 bytes, I'm just transmitting a string whose first character has ASCII value 0x02. I have also been coding for years (started with QB45 in the nineties, and before that with ZX-81 and ZXSpectrum in BASIC and even Assembler). I have coded several countries' Fiscal Printer interfaces for my company (all of them RS232C). But all this I did on Mr Gates' in-operating systems and IDEs. I do not know, though, the basics of RS232 I/O on Gambas3, methinks: I do not know -for example- what is wrong in my code that makes serial xxx_READ events not trigger. I also do not know how to write/read proper binary-as-string (or even bynary-as-byte[]) to/from RS232. My particular issue with the program: When the .InputBufferSize is not zero, it shows 3, which is correct (I'm expecting three bytes or chars, with values 0x02-0x15-0x03). Immediately afterwards, when I READ these bytes into a string (the only working thing so far), the first byte (0x02) is chopped off and the LEN of the resulting string is 2. I wonder: How come? There were three bytes in the buffer and I get a two byte string! I think Gambas is treating the 0x02 as a string-lenght indicator, and fills the string with the rest of the buffer, therefore fetching 2 characters (this seems backed because the string gets the 0x15 and 0x03 bytes as its contents). But I need all three bytes. My not-so-wild-guess (which agrees with your advise) is that I must use Byte[] and not String to read these blocks. Problem is twofold: 1- (BAD) Cannot get the _READ event to trigger 2- (WORSE) Cannot figure out how to make Gambas return a Byte[] with the buffer contents. Any pointers or working examples in those directions WILL help. Hope I explained myself better now. Regards, zxMarce. On 2016-06-30 11:34, nand...@nothingsimple.com wrote: > I've done extensive work with the serial port for a dozen years > with 100% success 24 hour operation. > > Sometimes people get mixed up with "0x02" thinking it's binary. > That is 4 characters ascii. > I prefer to use chr(2) to create a 1 length string binary 2. > If you're going to use byte[] array > then byte[0] = 2 is the equivalent. > Using escape (like HTML encoding) is the incorrect thinking > -Fernando > > -- > Open WebMail Project (http://openwebmail.org) > > > -- Original Message --- > From: ML <d4t4f...@gmail.com> > To: gambas-user@lists.sourceforge.net > Sent: Thu, 30 Jun 2016 10:51:41 -0300 > Subject: Re: [Gambas-user] Serial Port issues and events. > >> Alexie, >> >> Not really. This is my first attempt at a binary-exchange over serial in >> Gambas. Can't also find out the old G3 examples that might have existed >> about this and my web searches were unsuccessful. >> So, if you could point me to some example code to read a Byte[], I'll be >> grateful. My attempts to read to a Byte[] failed with SEGFAULT, or >> errors with no text. >> >> On the other hand, I just realized -again, happened to me in the past >> and I forgot it did- that the list does not send text inside RAW tags... >> The code can be seen only on Nabble's site, so I'm reinserting it here. >> Please excuse my notation; I know it's not Gambas standard. It's what I >> used for eons on QB45, VB3, VB4, VB5 VB6 and even .Net for my day to day >> work; (really) old habits die hard. >> >> Declarations: >> >> Private Const TEST_TX As String = "ø1" '0x02-0xF8-0x31-0x03 - >> Nabble's RAW TEXT tags removed some data from the string >> Private Const TEST_RX As String = "" '0x02-0x15-0x03 - Nabble's RAW >> TEXT tags removed some data from the string >> Private m_tty As SerialPort >> Private m_rxBuff As String = Null >> >> Instancing and setting the port up: >> >> 'Instance serial port and set properties >> m_tty = New SerialPort As "myTty" 'This should call myTty_Read() >> when there is data to read from the port, but it does not seem to >> trigger. Wonder why. >> m_tty.PortName = "/dev/" & m_port >> m_tty.Speed = m_speed >> Select Case m_parity >> Case "No/Space" >> m_tty.Parity = SerialPort.None >> Case "Even" >> m_tty.Parity = SerialPort.Even >> Case "Odd" >> m_tty.Parity = SerialPort.Odd >> End Select >> m_tty.DataBits = m_bits >> m_tty.StopBits = m_stop >> >> 'Encoder use hardware handshake (RTS/CTS) &g
Re: [Gambas-user] Serial Port issues and events.
I've done extensive work with the serial port for a dozen years with 100% success 24 hour operation. Sometimes people get mixed up with "0x02" thinking it's binary. That is 4 characters ascii. I prefer to use chr(2) to create a 1 length string binary 2. If you're going to use byte[] array then byte[0] = 2 is the equivalent. Using escape (like HTML encoding) is the incorrect thinking -Fernando -- Open WebMail Project (http://openwebmail.org) -- Original Message --- From: ML <d4t4f...@gmail.com> To: gambas-user@lists.sourceforge.net Sent: Thu, 30 Jun 2016 10:51:41 -0300 Subject: Re: [Gambas-user] Serial Port issues and events. > Alexie, > > Not really. This is my first attempt at a binary-exchange over serial in > Gambas. Can't also find out the old G3 examples that might have existed > about this and my web searches were unsuccessful. > So, if you could point me to some example code to read a Byte[], I'll be > grateful. My attempts to read to a Byte[] failed with SEGFAULT, or > errors with no text. > > On the other hand, I just realized -again, happened to me in the past > and I forgot it did- that the list does not send text inside RAW tags... > The code can be seen only on Nabble's site, so I'm reinserting it here. > Please excuse my notation; I know it's not Gambas standard. It's what I > used for eons on QB45, VB3, VB4, VB5 VB6 and even .Net for my day to day > work; (really) old habits die hard. > > Declarations: > > Private Const TEST_TX As String = "ø1" '0x02-0xF8-0x31-0x03 - > Nabble's RAW TEXT tags removed some data from the string > Private Const TEST_RX As String = "" '0x02-0x15-0x03 - Nabble's RAW > TEXT tags removed some data from the string > Private m_tty As SerialPort > Private m_rxBuff As String = Null > > Instancing and setting the port up: > > 'Instance serial port and set properties > m_tty = New SerialPort As "myTty" 'This should call myTty_Read() > when there is data to read from the port, but it does not seem to > trigger. Wonder why. > m_tty.PortName = "/dev/" & m_port > m_tty.Speed = m_speed > Select Case m_parity > Case "No/Space" > m_tty.Parity = SerialPort.None > Case "Even" > m_tty.Parity = SerialPort.Even > Case "Odd" > m_tty.Parity = SerialPort.Odd > End Select > m_tty.DataBits = m_bits > m_tty.StopBits = m_stop > > 'Encoder use hardware handshake (RTS/CTS) > m_tty.FlowControl = SerialPort.Hardware > > 'Try opening the port > m_tty.Open() > m_tty.Blocking = False > m_tty.DTR = True > > Then, I send TEST_TX and expect for either TEST_RX or a timeout: > > Public Function Test() As Boolean > > Dim tOut As Date = DateAdd(Now, gb.Second, 2) > > 'Reset RX Buffer, send test command and check for timeout/response > m_tty.Drop 'Kill remaining send data > m_tty.Begin() 'Start buffering > Write #m_tty, TEST_TX 'Add to send buffer > m_rxBuff = Null 'Kill RX buffer > m_tty.Send()'Send buffer > > While (Now < tOut) And (m_rxBuff <> TEST_RX) > Sleep 0.1 > 'This IF below should not be needed, but myTty_Read() never fires > otherwise! > If m_tty.InputBufferSize > 0 Then > myTty_Read() > Endif > Wend > > Finally > Return (m_rxBuff = TEST_RX) > > Catch > Message.Error("Error '" & Error.Text & "' occurred in " & Error.Where) > > End > > Finally, this next is the problem code. It does not fire as expected > when data arrives, and when I call it by hand in the IF above, if I try > to READ #m_tty As String it chops off the leading 0x02 byte, and I could > not figure out how to READ #m_tty As Byte[] or As Object (I get a null > error; nothing on the message.error text, and no OK button on it either): > > Public Sub myTty_Read() > > Dim dLen As Integer = m_tty.InputBufferSize > Dim sgmnt As Byte[] 'String = Null 'This here is my desperate > attempt to read As String or As Object... > > 'Data should be available in the serial port buffer > 'sgmnt = Read #m_tty As String > 'm_rxBuff &= sgmnt > sgmnt = Read #m_tty As Object > m_rxBuff &= sgmnt.ToString > Debug "Rx: (" & CStr(dLen) & ") " & sgmnt > > Catch > 'This is triggered when reading As Object or As Byte[]. But the > text is NULL and has no OK button! > Message.Error("Error '" & Error.Text & "' occurred in &q
Re: [Gambas-user] Serial Port issues and events.
Alexie, Not really. This is my first attempt at a binary-exchange over serial in Gambas. Can't also find out the old G3 examples that might have existed about this and my web searches were unsuccessful. So, if you could point me to some example code to read a Byte[], I'll be grateful. My attempts to read to a Byte[] failed with SEGFAULT, or errors with no text. On the other hand, I just realized -again, happened to me in the past and I forgot it did- that the list does not send text inside RAW tags... The code can be seen only on Nabble's site, so I'm reinserting it here. Please excuse my notation; I know it's not Gambas standard. It's what I used for eons on QB45, VB3, VB4, VB5 VB6 and even .Net for my day to day work; (really) old habits die hard. Declarations: Private Const TEST_TX As String = "ø1" '0x02-0xF8-0x31-0x03 - Nabble's RAW TEXT tags removed some data from the string Private Const TEST_RX As String = "" '0x02-0x15-0x03 - Nabble's RAW TEXT tags removed some data from the string Private m_tty As SerialPort Private m_rxBuff As String = Null Instancing and setting the port up: 'Instance serial port and set properties m_tty = New SerialPort As "myTty" 'This should call myTty_Read() when there is data to read from the port, but it does not seem to trigger. Wonder why. m_tty.PortName = "/dev/" & m_port m_tty.Speed = m_speed Select Case m_parity Case "No/Space" m_tty.Parity = SerialPort.None Case "Even" m_tty.Parity = SerialPort.Even Case "Odd" m_tty.Parity = SerialPort.Odd End Select m_tty.DataBits = m_bits m_tty.StopBits = m_stop 'Encoder use hardware handshake (RTS/CTS) m_tty.FlowControl = SerialPort.Hardware 'Try opening the port m_tty.Open() m_tty.Blocking = False m_tty.DTR = True Then, I send TEST_TX and expect for either TEST_RX or a timeout: Public Function Test() As Boolean Dim tOut As Date = DateAdd(Now, gb.Second, 2) 'Reset RX Buffer, send test command and check for timeout/response m_tty.Drop 'Kill remaining send data m_tty.Begin() 'Start buffering Write #m_tty, TEST_TX 'Add to send buffer m_rxBuff = Null 'Kill RX buffer m_tty.Send()'Send buffer While (Now < tOut) And (m_rxBuff <> TEST_RX) Sleep 0.1 'This IF below should not be needed, but myTty_Read() never fires otherwise! If m_tty.InputBufferSize > 0 Then myTty_Read() Endif Wend Finally Return (m_rxBuff = TEST_RX) Catch Message.Error("Error '" & Error.Text & "' occurred in " & Error.Where) End Finally, this next is the problem code. It does not fire as expected when data arrives, and when I call it by hand in the IF above, if I try to READ #m_tty As String it chops off the leading 0x02 byte, and I could not figure out how to READ #m_tty As Byte[] or As Object (I get a null error; nothing on the message.error text, and no OK button on it either): Public Sub myTty_Read() Dim dLen As Integer = m_tty.InputBufferSize Dim sgmnt As Byte[] 'String = Null 'This here is my desperate attempt to read As String or As Object... 'Data should be available in the serial port buffer 'sgmnt = Read #m_tty As String 'm_rxBuff &= sgmnt sgmnt = Read #m_tty As Object m_rxBuff &= sgmnt.ToString Debug "Rx: (" & CStr(dLen) & ") " & sgmnt Catch 'This is triggered when reading As Object or As Byte[]. But the text is NULL and has no OK button! Message.Error("Error '" & Error.Text & "' occurred in " & Error.Where) End A breakpoint in the "sgmnt = Read #m_tty As ..." line show that the value of "dLen" is three, which is OK. But when I try to READ As String, the leading 0x02 is missing from the string, leaving only 0x15-0x03 (quick tooltip shows the string to be "\x15\x03"). When this is later compared to TEST_RX in Test(), the comparison obviously fails. TIA, zxMarce. -- Attend Shape: An AT Tech Expo July 15-16. Meet us at AT Park in San Francisco, CA to explore cutting-edge tech and listen to tech luminaries present their vision of the future. This family event has something for everyone, including kids. Get more information and register today. http://sdm.link/attshape ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial Port issues and events.
Do you have a better/working example? Using multiple serialport works fine in Gambas (we use it in DomotiGa). You can read byte for byte, or read it into an array (latter one i recommend). Then you just loop through the array until you find STX/ETX characters ;-) 2016-06-30 12:17 GMT+02:00 zxMarce: > Hi there. Using Gambas 3.8.4 from PPA on Ubuntu 14.04 x64. > > I'm having issues with serial ports. I have a USB to 4 RS232C hub adapter. > It is working on a virtual Windows machine, reading and writing as it is > supposed to do. The connected device (using one port only) is a Magnetic > Card Encoder that uses binary data (i.e: not always printable ASCII) to be > told what to do. Using the mobo's built-in RS232 port as well as a PCIe > 4xRS232 card yield the same results, so the ports do not seem to be at > fault > here. > > My program tries to guess if the encoder is present at the specified port > by > sending the byte sequence 0x02-0xF8-0x31-0x03, which is an invalid command > for the device. The device should respond with 0x02-0x15-0x03. > > All data comm blocks are surrounded by STX (0x02) and ETX (0x03) bytes. > > The problems I am having are two: > > 1- I can't have Gambas trigger the READ event for the port, thus I call it > by hand. > 2- I can't figure out how to get the data from the encoder into a string > without missing bytes. > > My code is encapsulated in a class. Declarations: > > > > Instancing and setting the port up: > > > > Then, I send TEST_TX and expect for either TEST_RX or a timeout: > > > > Finally, this next is the problem code. It does not fire as expected when > data arrives, and when I call it by hand in the IF above, if I try to READ > #m_tty As String it chops off the leading 0x02 byte, and I could not figure > out how to READ #m_tty As Byte[] or As Object (I get a null error; nothing > on the message.error text, and no OK button on it either): > > > > A breakpoint in the "sgmnt = Read #m_tty As Object" line show that the > value > of "dLen" is three, which is OK. But when I try to READ As String, the > leading 0x02 is missing from the string, leaving only 0x15-0x03. When this > is later compared to TEST_RX in Test(), the comparison obviously fails. > > Hope someone can help me out. I guess my heavy VB6 background is > interfering > but can't really see how. > > TIA, > zxMarce. > > > > -- > View this message in context: > http://gambas.8142.n7.nabble.com/Serial-Port-issues-and-events-tp56614.html > Sent from the gambas-user mailing list archive at Nabble.com. > > > -- > Attend Shape: An AT Tech Expo July 15-16. Meet us at AT Park in San > Francisco, CA to explore cutting-edge tech and listen to tech luminaries > present their vision of the future. This family event has something for > everyone, including kids. Get more information and register today. > http://sdm.link/attshape > ___ > Gambas-user mailing list > Gambas-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > -- Attend Shape: An AT Tech Expo July 15-16. Meet us at AT Park in San Francisco, CA to explore cutting-edge tech and listen to tech luminaries present their vision of the future. This family event has something for everyone, including kids. Get more information and register today. http://sdm.link/attshape ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
[Gambas-user] Serial Port issues and events.
Hi there. Using Gambas 3.8.4 from PPA on Ubuntu 14.04 x64. I'm having issues with serial ports. I have a USB to 4 RS232C hub adapter. It is working on a virtual Windows machine, reading and writing as it is supposed to do. The connected device (using one port only) is a Magnetic Card Encoder that uses binary data (i.e: not always printable ASCII) to be told what to do. Using the mobo's built-in RS232 port as well as a PCIe 4xRS232 card yield the same results, so the ports do not seem to be at fault here. My program tries to guess if the encoder is present at the specified port by sending the byte sequence 0x02-0xF8-0x31-0x03, which is an invalid command for the device. The device should respond with 0x02-0x15-0x03. All data comm blocks are surrounded by STX (0x02) and ETX (0x03) bytes. The problems I am having are two: 1- I can't have Gambas trigger the READ event for the port, thus I call it by hand. 2- I can't figure out how to get the data from the encoder into a string without missing bytes. My code is encapsulated in a class. Declarations: Instancing and setting the port up: Then, I send TEST_TX and expect for either TEST_RX or a timeout: Finally, this next is the problem code. It does not fire as expected when data arrives, and when I call it by hand in the IF above, if I try to READ #m_tty As String it chops off the leading 0x02 byte, and I could not figure out how to READ #m_tty As Byte[] or As Object (I get a null error; nothing on the message.error text, and no OK button on it either): A breakpoint in the "sgmnt = Read #m_tty As Object" line show that the value of "dLen" is three, which is OK. But when I try to READ As String, the leading 0x02 is missing from the string, leaving only 0x15-0x03. When this is later compared to TEST_RX in Test(), the comparison obviously fails. Hope someone can help me out. I guess my heavy VB6 background is interfering but can't really see how. TIA, zxMarce. -- View this message in context: http://gambas.8142.n7.nabble.com/Serial-Port-issues-and-events-tp56614.html Sent from the gambas-user mailing list archive at Nabble.com. -- Attend Shape: An AT Tech Expo July 15-16. Meet us at AT Park in San Francisco, CA to explore cutting-edge tech and listen to tech luminaries present their vision of the future. This family event has something for everyone, including kids. Get more information and register today. http://sdm.link/attshape ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial port control
I have used the serial port for 5+ years with Accelerometer and GPS without fault nor failure on the serial port control. Some use RTS/CTS, some done. My suggestion is not to think it needs to mimick what MSComm does and how you have used MSComm in the past. Learn what it does and how you can use it for your devices. I assure you it can certainly do it without fail. -Nando -- Original Message --- From: Randall Morgan rmorga...@gmail.com To: mailing list for gambas users gambas-user@lists.sourceforge.net Sent: Sun, 22 Dec 2013 23:35:33 -0800 Subject: Re: [Gambas-user] Serial port control I think the RTheshold of VB simply sets the byte count that must accumulate in the receive buffer before a comm event is triggered. It doesn't do anything else. In the background VB is still polling the buffer and looking at the byte count. You can do this in GB but you will have to write it yourself. You would need to simply use the read event on the comm object to test the byte count. I believe it triggers at 1 byte. Then use that to trigger your own custom event when your 124 bytes have arrived. You might also be able to talk Benoit into adding an RThreshold property. Seems like it might be handy At the very least 4Hz is very very slow for most computers. And setting up a 4Hz polling of the port wouldn't be hard at all. On Sun, Dec 22, 2013 at 8:10 PM, Carl Nilsson nils...@iinet.net.au wrote: Thanks Randall. I guess it's time to try it and play around a little, which I can't do for a few days. At the moment I'm trying to look ahead and see where problems might lie. When push comes to shove, I don't know how these things really work! I follow recipes! Don't really want to close the port as the data come in continuously as fast as the device can send them and I don't want to miss any. (It's attitude sensor data from an inertial management unit in a light aircraft). Same in principle with another continuous stream of binary GPS data with packets of 124 bytes coming in at a slower rate of, say, 4 Hz. How continuous it is would depend on the baud rate at which the port is operating. The RThreashold property of MScomm handles this issue very well. Doesn't trigger an event until the specified number of bytes is in the serial buffer. Carl At 02:47 PM 23/12/2013, you wrote: It has been a long while since I have used the serial component of GB but I have a project starting in which I will need to re-acquaint myself with it. The stream can be setup as blocking or non-blocking. The PC uses either polling or interrupt when the port is opened. So trying to manage the serial port at the same level you would in on uC is pointless in most cases. Just set up the stream and read the bytes you need from there. If you're concerned about buffer overflow then you may want to close the port once you have read the bytes you need. Perhaps someone with more recent experience can help you more. On Sun, Dec 22, 2013 at 7:15 PM, Carl Nilsson nils...@iinet.net.au wrote: Randall: Thanks for responding. OK, I have looked at the stream functions: My question was, basically, how do I specify how many bytes I want to take in from a given serial port at each instance? For example, on one input I expect a continuous stream of 31 byte packets and I want to take them in for processing 25 (say) packets at a time, i.e. 775 bytes at a time. Now I don't much mind if I get a few bytes more or less because I can check for a remainder part-packet and put it on the front of the next nominal 775 byte intake - that's part of the processing software - but I don't want the CPU tied up with that port or stream between intakes of (about) 775 bytes. There are other input streams and data processing to attend to. I don't see how to do that with the stream functions - but maybe I'm not understanding how the stream works? I can see that I could (I think!) read a given number of bytes from a stream, but does that relieve the CPU from being tied up with that stream until I read another 775 bytes? Is a stream of indefinite length or does it have some buffer limit? Carl At 01:09 PM 23/12/2013, you wrote: As I recall gb serial is steam based and so you would handle buffers via the stream not the serial object. On Sun, Dec 22, 2013 at 3:01 PM, Carl Nilsson nils...@iinet.net.au wrote: G'day all: Now with Gambas 3 installed, I want to get on with porting my running software from VB6/Windows. It requires processing multiple streams of binary serial data from attached devices. The serial control in gambas 3 does not seem up to the job, in so far as the available properties lack the elements I use under VB MScomm. ...(snip) Carl Carl S Nilsson 137 Gordons Hill Road
Re: [Gambas-user] Serial port control
My suggestion to reading 124 bytes from a serial stream I use this technique mostly because I want to empty the buffer provided by the control as much as possible. I would have one function which is the _read of the serial port. The only thing it does is accumulate bytes in an array. I have another function which will ask for 124 bytes from the accumlating array. If there are not enough, it can block, or return an array of zero long which would mean not enough came in. In this case you could also do a small time delay (ie. WAIT 0.1) just to prevent the CPU from running 100% testing for 124 bytes. Both of these can be a Gambas Class and the second function is the public function. You can use _new to instantiate the serial port control. You don't need to create it at design time. I used techniques like this and it works like a charm. -Nando -- Original Message --- From: Randall Morgan rmorga...@gmail.com To: mailing list for gambas users gambas-user@lists.sourceforge.net Sent: Sun, 22 Dec 2013 23:35:33 -0800 Subject: Re: [Gambas-user] Serial port control I think the RTheshold of VB simply sets the byte count that must accumulate in the receive buffer before a comm event is triggered. It doesn't do anything else. In the background VB is still polling the buffer and looking at the byte count. You can do this in GB but you will have to write it yourself. You would need to simply use the read event on the comm object to test the byte count. I believe it triggers at 1 byte. Then use that to trigger your own custom event when your 124 bytes have arrived. You might also be able to talk Benoit into adding an RThreshold property. Seems like it might be handy At the very least 4Hz is very very slow for most computers. And setting up a 4Hz polling of the port wouldn't be hard at all. On Sun, Dec 22, 2013 at 8:10 PM, Carl Nilsson nils...@iinet.net.au wrote: Thanks Randall. I guess it's time to try it and play around a little, which I can't do for a few days. At the moment I'm trying to look ahead and see where problems might lie. When push comes to shove, I don't know how these things really work! I follow recipes! Don't really want to close the port as the data come in continuously as fast as the device can send them and I don't want to miss any. (It's attitude sensor data from an inertial management unit in a light aircraft). Same in principle with another continuous stream of binary GPS data with packets of 124 bytes coming in at a slower rate of, say, 4 Hz. How continuous it is would depend on the baud rate at which the port is operating. The RThreashold property of MScomm handles this issue very well. Doesn't trigger an event until the specified number of bytes is in the serial buffer. Carl At 02:47 PM 23/12/2013, you wrote: It has been a long while since I have used the serial component of GB but I have a project starting in which I will need to re-acquaint myself with it. The stream can be setup as blocking or non-blocking. The PC uses either polling or interrupt when the port is opened. So trying to manage the serial port at the same level you would in on uC is pointless in most cases. Just set up the stream and read the bytes you need from there. If you're concerned about buffer overflow then you may want to close the port once you have read the bytes you need. Perhaps someone with more recent experience can help you more. On Sun, Dec 22, 2013 at 7:15 PM, Carl Nilsson nils...@iinet.net.au wrote: Randall: Thanks for responding. OK, I have looked at the stream functions: My question was, basically, how do I specify how many bytes I want to take in from a given serial port at each instance? For example, on one input I expect a continuous stream of 31 byte packets and I want to take them in for processing 25 (say) packets at a time, i.e. 775 bytes at a time. Now I don't much mind if I get a few bytes more or less because I can check for a remainder part-packet and put it on the front of the next nominal 775 byte intake - that's part of the processing software - but I don't want the CPU tied up with that port or stream between intakes of (about) 775 bytes. There are other input streams and data processing to attend to. I don't see how to do that with the stream functions - but maybe I'm not understanding how the stream works? I can see that I could (I think!) read a given number of bytes from a stream, but does that relieve the CPU from being tied up with that stream until I read another 775 bytes? Is a stream of indefinite length or does it have some buffer limit? Carl At 01:09 PM 23/12/2013, you wrote: As I recall gb serial is steam based and so you would handle buffers via the stream not the serial object. On Sun, Dec 22, 2013 at 3:01 PM, Carl Nilsson nils
Re: [Gambas-user] Serial port control
Carl, will you be using the PC end and gambas code as the master or slave, if master then just use the sport read interupt function. Remember you will have to use chr and asc if using binary data streems. The Gambas3 serial example is very good. If any data is in the input buffer it will trigger the Sport_Read sub and exit leeving the system free to carry on. Just use the PC as master to request data from the slave of slaves. Private Sport As SerialPort Const None As Integer = 0 Private RxLen As Integer Private Rx As String Public Sub Form_Open() Sport = New SerialPort As Sport Sport.PortName = /dev/ttyACM0 'Setup for Arduino you may have to change to ttyUSB0 Sport.Speed = 57600 Sport.Parity = 0 Sport.DataBits = 8 Sport.StopBits = 1 Sport.FlowControl = 0 Sport.Open() End Public Sub Sport_Read() Try Read #Sport, Rx, Lof(Sport) If Error Then Goto NoRx Endif RxLen = InStr(Rx, Chr(13)) LabelRxlen.Text = RxLen ListBox1.Add(Rx) NoRx: Rx = End Best Regards Mike Very Merry Christmas to all On Monday, 23 December 2013 5:03 PM, nando nand...@nothingsimple.com wrote: My suggestion to reading 124 bytes from a serial stream I use this technique mostly because I want to empty the buffer provided by the control as much as possible. I would have one function which is the _read of the serial port. The only thing it does is accumulate bytes in an array. I have another function which will ask for 124 bytes from the accumlating array. If there are not enough, it can block, or return an array of zero long which would mean not enough came in. In this case you could also do a small time delay (ie. WAIT 0.1) just to prevent the CPU from running 100% testing for 124 bytes. Both of these can be a Gambas Class and the second function is the public function. You can use _new to instantiate the serial port control. You don't need to create it at design time. I used techniques like this and it works like a charm. -Nando -- Original Message --- From: Randall Morgan rmorga...@gmail.com To: mailing list for gambas users gambas-user@lists.sourceforge.net Sent: Sun, 22 Dec 2013 23:35:33 -0800 Subject: Re: [Gambas-user] Serial port control I think the RTheshold of VB simply sets the byte count that must accumulate in the receive buffer before a comm event is triggered. It doesn't do anything else. In the background VB is still polling the buffer and looking at the byte count. You can do this in GB but you will have to write it yourself. You would need to simply use the read event on the comm object to test the byte count. I believe it triggers at 1 byte. Then use that to trigger your own custom event when your 124 bytes have arrived. You might also be able to talk Benoit into adding an RThreshold property. Seems like it might be handy At the very least 4Hz is very very slow for most computers. And setting up a 4Hz polling of the port wouldn't be hard at all. On Sun, Dec 22, 2013 at 8:10 PM, Carl Nilsson nils...@iinet.net.au wrote: Thanks Randall. I guess it's time to try it and play around a little, which I can't do for a few days. At the moment I'm trying to look ahead and see where problems might lie. When push comes to shove, I don't know how these things really work! I follow recipes! Don't really want to close the port as the data come in continuously as fast as the device can send them and I don't want to miss any. (It's attitude sensor data from an inertial management unit in a light aircraft). Same in principle with another continuous stream of binary GPS data with packets of 124 bytes coming in at a slower rate of, say, 4 Hz. How continuous it is would depend on the baud rate at which the port is operating. The RThreashold property of MScomm handles this issue very well. Doesn't trigger an event until the specified number of bytes is in the serial buffer. Carl At 02:47 PM 23/12/2013, you wrote: It has been a long while since I have used the serial component of GB but I have a project starting in which I will need to re-acquaint myself with it. The stream can be setup as blocking or non-blocking. The PC uses either polling or interrupt when the port is opened. So trying to manage the serial port at the same level you would in on uC is pointless in most cases. Just set up the stream and read the bytes you need from there. If you're concerned about buffer overflow then you may want to close the port once you have read the bytes you need. Perhaps someone with more recent experience can help you more. On Sun, Dec 22, 2013 at 7:15 PM, Carl Nilsson nils...@iinet.net.au wrote: Randall: Thanks for responding. OK, I have looked at the stream functions: My question was, basically, how do I specify how many bytes I want to take in from a given serial port at each instance? For example, on one input I
Re: [Gambas-user] Serial port control
G'day Guys (Nando, Randall and Mike): Thanks for your helpful replies. It's 5 am here and I woke up an hour ago with this matter running through my head, so your replies are welcome! All good advice. I realized that, first of all, I needed to get a handle on using the stream functions, which are quite new to me. Secondly, as usual, there are many ways to skin a cat. You are right, I need not be dependent on an RThreshold property. I have been using this for years most successfully with MScomm in VB6. It does exert efficient control, but sometimes my incoming packets vary in byte count.. So, early in the piece, I wrote code that would look for any remainder bytes or shortfall on the end of the designated input stream and put them onto the start of the next byte block to get back into synch. The Windows kernel has a very efficient function called MoveMemory that can be called from VB6. (I presume Linux has something similar). It's very much faster than shifting bytes in Do loops. Anyway, not being dependent on an totally accurate byte count prior to triggering an event suggested an alternate approach: My principal data device is a decade-old Microstrain Inertial Management Unit (IMU).that sends remorselessly at around 2356 bytes (sometimes plus a packet or two) per sec. At the moment I'm doing all my processing on an old Advantech 9576F single board computer running Win 2K. With about 8 serial ports in action and heaps of other processing to do, I wanted to ease things with some preprocessing of some data streams on one of these little new ARM boards like the Raspberry Pi or Beaglebone Black - the latter with at least 4 UARTS and running at 1 GHz seems very attractive. They can run fully embedded under Linux with gambas for initial data processing. I have an RPi now with gambas3 and wiring Pi installed to experiment with. Sometimes the IMU traffic is duplex when I change parameters in flight and additional data packets come back in addition to the normal data flow. So I adjust the RThreshold value dynamically, but that's not vital. All this adds up to the fact that another approach might be to trigger processing events simply with a timer - read the full stream each time and get the byte count approximately right. With a MoveMemory function I can easily handle some unevenness in byte count. As I said, I'm looking for the least drain on CPU load. I don't really need the system tied up waiting and testing for an exact count. Anyway, I thank you for all your comments. I now know that what I need can be done and the next step is for me to experiment. Yesterday I was having some doubts about choosing gambas. Nice to talk with you guys. I'll get back to you when I have something more useful to say or ask. Merry Christmas, Carl At 08:03 PM 23/12/2013, you wrote: My suggestion to reading 124 bytes from a serial stream I use this technique mostly because I want to empty the buffer provided by the control as much as possible. I would have one function which is the _read of the serial port. The only thing it does is accumulate bytes in an array. I have another function which will ask for 124 bytes from the accumlating array. If there are not enough, it can block, or return an array of zero long which would mean not enough came in. In this case you could also do a small time delay (ie. WAIT 0.1) just to prevent the CPU from running 100% testing for 124 bytes. Both of these can be a Gambas Class and the second function is the public function. You can use _new to instantiate the serial port control. You don't need to create it at design time. I used techniques like this and it works like a charm. -Nando -- Original Message --- From: Randall Morgan rmorga...@gmail.com To: mailing list for gambas users gambas-user@lists.sourceforge.net Sent: Sun, 22 Dec 2013 23:35:33 -0800 Subject: Re: [Gambas-user] Serial port control I think the RTheshold of VB simply sets the byte count that must accumulate in the receive buffer before a comm event is triggered. It doesn't do anything else. In the background VB is still polling the buffer and looking at the byte count. You can do this in GB but you will have to write it yourself. You would need to simply use the read event on the comm object to test the byte count. I believe it triggers at 1 byte. Then use that to trigger your own custom event when your 124 bytes have arrived. You might also be able to talk Benoit into adding an RThreshold property. Seems like it might be handy At the very least 4Hz is very very slow for most computers. And setting up a 4Hz polling of the port wouldn't be hard at all. On Sun, Dec 22, 2013 at 8:10 PM, Carl Nilsson nils...@iinet.net.au wrote: Thanks Randall. I guess it's time to try it and play around a little, which I can't do for a few days. At the moment I'm trying to look ahead and see where problems might
Re: [Gambas-user] Serial port control
to commercial solutions. I would say I have had best results using an interrupt driven serial routine to empty the uart buffers and handle the data. VB6 using OnComm() function and Gambas using Sport_Read() function. Variable buffer sizes can be dealt with by checking the length of the input string using CR as the end of line indicator (chr13) as used in most protocols (modbus ASCII RTU). Try something like, Try Print #Sport, Tx; Chr$(13) in a timer function or from terminal input to send data through the uart. If needed I have the Gambas modbus test program and a Koyo Click PLC (under $100 au PLC software is free) to test and see if the code is still OK, the modbus protocol uses binary data over the comms link. Hope this is of some help. Best Regards Mike Merry Christmas to all. On Tuesday, 24 December 2013 2:38 AM, Carl Nilsson nils...@iinet.net.au wrote: G'day Guys (Nando, Randall and Mike): Thanks for your helpful replies. It's 5 am here and I woke up an hour ago with this matter running through my head, so your replies are welcome! All good advice. I realized that, first of all, I needed to get a handle on using the stream functions, which are quite new to me. Secondly, as usual, there are many ways to skin a cat. You are right, I need not be dependent on an RThreshold property. I have been using this for years most successfully with MScomm in VB6. It does exert efficient control, but sometimes my incoming packets vary in byte count.. So, early in the piece, I wrote code that would look for any remainder bytes or shortfall on the end of the designated input stream and put them onto the start of the next byte block to get back into synch. The Windows kernel has a very efficient function called MoveMemory that can be called from VB6. (I presume Linux has something similar). It's very much faster than shifting bytes in Do loops. Anyway, not being dependent on an totally accurate byte count prior to triggering an event suggested an alternate approach: My principal data device is a decade-old Microstrain Inertial Management Unit (IMU).that sends remorselessly at around 2356 bytes (sometimes plus a packet or two) per sec. At the moment I'm doing all my processing on an old Advantech 9576F single board computer running Win 2K. With about 8 serial ports in action and heaps of other processing to do, I wanted to ease things with some preprocessing of some data streams on one of these little new ARM boards like the Raspberry Pi or Beaglebone Black - the latter with at least 4 UARTS and running at 1 GHz seems very attractive. They can run fully embedded under Linux with gambas for initial data processing. I have an RPi now with gambas3 and wiring Pi installed to experiment with. Sometimes the IMU traffic is duplex when I change parameters in flight and additional data packets come back in addition to the normal data flow. So I adjust the RThreshold value dynamically, but that's not vital. All this adds up to the fact that another approach might be to trigger processing events simply with a timer - read the full stream each time and get the byte count approximately right. With a MoveMemory function I can easily handle some unevenness in byte count. As I said, I'm looking for the least drain on CPU load. I don't really need the system tied up waiting and testing for an exact count. Anyway, I thank you for all your comments. I now know that what I need can be done and the next step is for me to experiment. Yesterday I was having some doubts about choosing gambas. Nice to talk with you guys. I'll get back to you when I have something more useful to say or ask. Merry Christmas, Carl At 08:03 PM 23/12/2013, you wrote: My suggestion to reading 124 bytes from a serial stream I use this technique mostly because I want to empty the buffer provided by the control as much as possible. I would have one function which is the _read of the serial port. The only thing it does is accumulate bytes in an array. I have another function which will ask for 124 bytes from the accumlating array. If there are not enough, it can block, or return an array of zero long which would mean not enough came in. In this case you could also do a small time delay (ie. WAIT 0.1) just to prevent the CPU from running 100% testing for 124 bytes. Both of these can be a Gambas Class and the second function is the public function. You can use _new to instantiate the serial port control. You don't need to create it at design time. I used techniques like this and it works like a charm. -Nando -- Original Message --- From: Randall Morgan rmorga...@gmail.com To: mailing list for gambas users gambas-user@lists.sourceforge.net Sent: Sun, 22 Dec 2013 23:35:33 -0800 Subject: Re: [Gambas-user] Serial port control I think the RTheshold of VB simply sets the byte count that must accumulate in the receive buffer before a comm event is triggered. It doesn't
[Gambas-user] Serial port control
G'day all: Now with Gambas 3 installed, I want to get on with porting my running software from VB6/Windows. It requires processing multiple streams of binary serial data from attached devices. The serial control in gambas 3 does not seem up to the job, in so far as the available properties lack the elements I use under VB MScomm. In addition to the basic ones, these are inbuffer.size, outbuffer.size, inbuffer.count, inputMode, input Len(gth), PortOpen and, in particular, R Threshold and S Threshold. The latter R/S Thresholds are very useful in allowing the software to get on with other processing while the buffers are filling - at least that is my understanding. I ask if whoever wrote the gambas serial control has any plans to expand it's functionality to the MScomm level in the foreseeable future or can someone point me to another more comprehensive control I could use with gambas? Carl Carl S Nilsson 137 Gordons Hill Road Lindisfarne, Tas. Australia 7015 -- Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831iu=/4140/ostg.clktrk ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial port control
As I recall gb serial is steam based and so you would handle buffers via the stream not the serial object. On Sun, Dec 22, 2013 at 3:01 PM, Carl Nilsson nils...@iinet.net.au wrote: G'day all: Now with Gambas 3 installed, I want to get on with porting my running software from VB6/Windows. It requires processing multiple streams of binary serial data from attached devices. The serial control in gambas 3 does not seem up to the job, in so far as the available properties lack the elements I use under VB MScomm. In addition to the basic ones, these are inbuffer.size, outbuffer.size, inbuffer.count, inputMode, input Len(gth), PortOpen and, in particular, R Threshold and S Threshold. The latter R/S Thresholds are very useful in allowing the software to get on with other processing while the buffers are filling - at least that is my understanding. I ask if whoever wrote the gambas serial control has any plans to expand it's functionality to the MScomm level in the foreseeable future or can someone point me to another more comprehensive control I could use with gambas? Carl Carl S Nilsson 137 Gordons Hill Road Lindisfarne, Tas. Australia 7015 -- Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831iu=/4140/ostg.clktrk ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- If you ask me if it can be done. The answer is YES, it can always be done. The correct questions however are... What will it cost, and how long will it take? -- Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831iu=/4140/ostg.clktrk ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial port control
Randall: Thanks for responding. OK, I have looked at the stream functions: My question was, basically, how do I specify how many bytes I want to take in from a given serial port at each instance? For example, on one input I expect a continuous stream of 31 byte packets and I want to take them in for processing 25 (say) packets at a time, i.e. 775 bytes at a time. Now I don't much mind if I get a few bytes more or less because I can check for a remainder part-packet and put it on the front of the next nominal 775 byte intake - that's part of the processing software - but I don't want the CPU tied up with that port or stream between intakes of (about) 775 bytes. There are other input streams and data processing to attend to. I don't see how to do that with the stream functions - but maybe I'm not understanding how the stream works? I can see that I could (I think!) read a given number of bytes from a stream, but does that relieve the CPU from being tied up with that stream until I read another 775 bytes? Is a stream of indefinite length or does it have some buffer limit? Carl At 01:09 PM 23/12/2013, you wrote: As I recall gb serial is steam based and so you would handle buffers via the stream not the serial object. On Sun, Dec 22, 2013 at 3:01 PM, Carl Nilsson nils...@iinet.net.au wrote: G'day all: Now with Gambas 3 installed, I want to get on with porting my running software from VB6/Windows. It requires processing multiple streams of binary serial data from attached devices. The serial control in gambas 3 does not seem up to the job, in so far as the available properties lack the elements I use under VB MScomm. ...(snip) Carl Carl S Nilsson 137 Gordons Hill Road Lindisfarne, Tas. Australia 7015 -- Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831iu=/4140/ostg.clktrk ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- If you ask me if it can be done. The answer is YES, it can always be done. The correct questions however are... What will it cost, and how long will it take? -- Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831iu=/4140/ostg.clktrk ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user Carl S Nilsson 137 Gordons Hill Road Lindisfarne, Tas. Australia 7015 -- Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831iu=/4140/ostg.clktrk ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial port control
It has been a long while since I have used the serial component of GB but I have a project starting in which I will need to re-acquaint myself with it. The stream can be setup as blocking or non-blocking. The PC uses either polling or interrupt when the port is opened. So trying to manage the serial port at the same level you would in on uC is pointless in most cases. Just set up the stream and read the bytes you need from there. If you're concerned about buffer overflow then you may want to close the port once you have read the bytes you need. Perhaps someone with more recent experience can help you more. On Sun, Dec 22, 2013 at 7:15 PM, Carl Nilsson nils...@iinet.net.au wrote: Randall: Thanks for responding. OK, I have looked at the stream functions: My question was, basically, how do I specify how many bytes I want to take in from a given serial port at each instance? For example, on one input I expect a continuous stream of 31 byte packets and I want to take them in for processing 25 (say) packets at a time, i.e. 775 bytes at a time. Now I don't much mind if I get a few bytes more or less because I can check for a remainder part-packet and put it on the front of the next nominal 775 byte intake - that's part of the processing software - but I don't want the CPU tied up with that port or stream between intakes of (about) 775 bytes. There are other input streams and data processing to attend to. I don't see how to do that with the stream functions - but maybe I'm not understanding how the stream works? I can see that I could (I think!) read a given number of bytes from a stream, but does that relieve the CPU from being tied up with that stream until I read another 775 bytes? Is a stream of indefinite length or does it have some buffer limit? Carl At 01:09 PM 23/12/2013, you wrote: As I recall gb serial is steam based and so you would handle buffers via the stream not the serial object. On Sun, Dec 22, 2013 at 3:01 PM, Carl Nilsson nils...@iinet.net.au wrote: G'day all: Now with Gambas 3 installed, I want to get on with porting my running software from VB6/Windows. It requires processing multiple streams of binary serial data from attached devices. The serial control in gambas 3 does not seem up to the job, in so far as the available properties lack the elements I use under VB MScomm. ...(snip) Carl Carl S Nilsson 137 Gordons Hill Road Lindisfarne, Tas. Australia 7015 -- Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831iu=/4140/ostg.clktrk ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- If you ask me if it can be done. The answer is YES, it can always be done. The correct questions however are... What will it cost, and how long will it take? -- Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831iu=/4140/ostg.clktrk ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user Carl S Nilsson 137 Gordons Hill Road Lindisfarne, Tas. Australia 7015 -- Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831iu=/4140/ostg.clktrk ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- If you ask me if it can be done. The answer is YES, it can always be done. The correct questions however are... What will it cost, and how long will it take? -- Rapidly troubleshoot problems before they affect your business. Most IT organizations
Re: [Gambas-user] Serial port control
Thanks Randall. I guess it's time to try it and play around a little, which I can't do for a few days. At the moment I'm trying to look ahead and see where problems might lie. When push comes to shove, I don't know how these things really work! I follow recipes! Don't really want to close the port as the data come in continuously as fast as the device can send them and I don't want to miss any. (It's attitude sensor data from an inertial management unit in a light aircraft). Same in principle with another continuous stream of binary GPS data with packets of 124 bytes coming in at a slower rate of, say, 4 Hz. How continuous it is would depend on the baud rate at which the port is operating. The RThreashold property of MScomm handles this issue very well. Doesn't trigger an event until the specified number of bytes is in the serial buffer. Carl At 02:47 PM 23/12/2013, you wrote: It has been a long while since I have used the serial component of GB but I have a project starting in which I will need to re-acquaint myself with it. The stream can be setup as blocking or non-blocking. The PC uses either polling or interrupt when the port is opened. So trying to manage the serial port at the same level you would in on uC is pointless in most cases. Just set up the stream and read the bytes you need from there. If you're concerned about buffer overflow then you may want to close the port once you have read the bytes you need. Perhaps someone with more recent experience can help you more. On Sun, Dec 22, 2013 at 7:15 PM, Carl Nilsson nils...@iinet.net.au wrote: Randall: Thanks for responding. OK, I have looked at the stream functions: My question was, basically, how do I specify how many bytes I want to take in from a given serial port at each instance? For example, on one input I expect a continuous stream of 31 byte packets and I want to take them in for processing 25 (say) packets at a time, i.e. 775 bytes at a time. Now I don't much mind if I get a few bytes more or less because I can check for a remainder part-packet and put it on the front of the next nominal 775 byte intake - that's part of the processing software - but I don't want the CPU tied up with that port or stream between intakes of (about) 775 bytes. There are other input streams and data processing to attend to. I don't see how to do that with the stream functions - but maybe I'm not understanding how the stream works? I can see that I could (I think!) read a given number of bytes from a stream, but does that relieve the CPU from being tied up with that stream until I read another 775 bytes? Is a stream of indefinite length or does it have some buffer limit? Carl At 01:09 PM 23/12/2013, you wrote: As I recall gb serial is steam based and so you would handle buffers via the stream not the serial object. On Sun, Dec 22, 2013 at 3:01 PM, Carl Nilsson nils...@iinet.net.au wrote: G'day all: Now with Gambas 3 installed, I want to get on with porting my running software from VB6/Windows. It requires processing multiple streams of binary serial data from attached devices. The serial control in gambas 3 does not seem up to the job, in so far as the available properties lack the elements I use under VB MScomm. ...(snip) Carl Carl S Nilsson 137 Gordons Hill Road Lindisfarne, Tas. Australia 7015 -- Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831iu=/4140/ostg.clktrk ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- If you ask me if it can be done. The answer is YES, it can always be done. The correct questions however are... What will it cost, and how long will it take? - - Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831iu=/4140/ostg.clktrk ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user Carl S Nilsson 137 Gordons Hill
Re: [Gambas-user] Serial port control
I think the RTheshold of VB simply sets the byte count that must accumulate in the receive buffer before a comm event is triggered. It doesn't do anything else. In the background VB is still polling the buffer and looking at the byte count. You can do this in GB but you will have to write it yourself. You would need to simply use the read event on the comm object to test the byte count. I believe it triggers at 1 byte. Then use that to trigger your own custom event when your 124 bytes have arrived. You might also be able to talk Benoit into adding an RThreshold property. Seems like it might be handy At the very least 4Hz is very very slow for most computers. And setting up a 4Hz polling of the port wouldn't be hard at all. On Sun, Dec 22, 2013 at 8:10 PM, Carl Nilsson nils...@iinet.net.au wrote: Thanks Randall. I guess it's time to try it and play around a little, which I can't do for a few days. At the moment I'm trying to look ahead and see where problems might lie. When push comes to shove, I don't know how these things really work! I follow recipes! Don't really want to close the port as the data come in continuously as fast as the device can send them and I don't want to miss any. (It's attitude sensor data from an inertial management unit in a light aircraft). Same in principle with another continuous stream of binary GPS data with packets of 124 bytes coming in at a slower rate of, say, 4 Hz. How continuous it is would depend on the baud rate at which the port is operating. The RThreashold property of MScomm handles this issue very well. Doesn't trigger an event until the specified number of bytes is in the serial buffer. Carl At 02:47 PM 23/12/2013, you wrote: It has been a long while since I have used the serial component of GB but I have a project starting in which I will need to re-acquaint myself with it. The stream can be setup as blocking or non-blocking. The PC uses either polling or interrupt when the port is opened. So trying to manage the serial port at the same level you would in on uC is pointless in most cases. Just set up the stream and read the bytes you need from there. If you're concerned about buffer overflow then you may want to close the port once you have read the bytes you need. Perhaps someone with more recent experience can help you more. On Sun, Dec 22, 2013 at 7:15 PM, Carl Nilsson nils...@iinet.net.au wrote: Randall: Thanks for responding. OK, I have looked at the stream functions: My question was, basically, how do I specify how many bytes I want to take in from a given serial port at each instance? For example, on one input I expect a continuous stream of 31 byte packets and I want to take them in for processing 25 (say) packets at a time, i.e. 775 bytes at a time. Now I don't much mind if I get a few bytes more or less because I can check for a remainder part-packet and put it on the front of the next nominal 775 byte intake - that's part of the processing software - but I don't want the CPU tied up with that port or stream between intakes of (about) 775 bytes. There are other input streams and data processing to attend to. I don't see how to do that with the stream functions - but maybe I'm not understanding how the stream works? I can see that I could (I think!) read a given number of bytes from a stream, but does that relieve the CPU from being tied up with that stream until I read another 775 bytes? Is a stream of indefinite length or does it have some buffer limit? Carl At 01:09 PM 23/12/2013, you wrote: As I recall gb serial is steam based and so you would handle buffers via the stream not the serial object. On Sun, Dec 22, 2013 at 3:01 PM, Carl Nilsson nils...@iinet.net.au wrote: G'day all: Now with Gambas 3 installed, I want to get on with porting my running software from VB6/Windows. It requires processing multiple streams of binary serial data from attached devices. The serial control in gambas 3 does not seem up to the job, in so far as the available properties lack the elements I use under VB MScomm. ...(snip) Carl Carl S Nilsson 137 Gordons Hill Road Lindisfarne, Tas. Australia 7015 -- Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349831iu=/4140/ostg.clktrk ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net
[Gambas-user] serial port issue
Hello List, This may not be a fully gambas question just I don't know who to ask for help - sorry for posting it here. I try to switch my measurement from windows XP (VB) to Ubuntu 9.10. This program takes several (3, for the moment) equipments connected to a PC through serial ports. It works correctly under XP and I succeeded to make (an even nicer :-) program in gambas for ubuntu. It also works well... as long as I use the serial ports integrated on the motherboard. I have some serial port cards we added later for having enough interface. From the gtkterm they seems working with short commands so I was optimistic. But when I send more data from my program they seems not arriving correctly. Is there anybody who works with serial ports under ubuntu (with gambas)? A little help would be highly appreciated. Robi -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] serial port issue
Maybe try to see if there are any differences between the ports with the setserial command. $ setserial -a /dev/ttyS1 /dev/ttyS1, Line 1, UART: unknown, Port: 0x02f8, IRQ: 3 Baud_base: 115200, close_delay: 50, divisor: 0 closing_wait: 3000 Flags: spd_normal skip_test $ setserial -a /dev/ttyUSB1 /dev/ttyUSB1, Line 0, UART: unknown, Port: 0x, IRQ: 0 Baud_base: 2400, close_delay: 0, divisor: 0 closing_wait: infinite Flags: spd_normal low_latency Hello List, This may not be a fully gambas question just I don't know who to ask for help - sorry for posting it here. I try to switch my measurement from windows XP (VB) to Ubuntu 9.10. This program takes several (3, for the moment) equipments connected to a PC through serial ports. It works correctly under XP and I succeeded to make (an even nicer :-) program in gambas for ubuntu. It also works well... as long as I use the serial ports integrated on the motherboard. I have some serial port cards we added later for having enough interface. From the gtkterm they seems working with short commands so I was optimistic. But when I send more data from my program they seems not arriving correctly. Is there anybody who works with serial ports under ubuntu (with gambas)? A little help would be highly appreciated. Robi -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] serial port issue
All the parameters are the same obtained by autoconfig, except the UART which was undefined for the added ports. I set this parameter to the same value as for the working one: 16550A (in fact I tried all the possible UART parameters and where the port was working it behaves always the same: short test messages pass but in the real work environment it crashes). :-( Robi 2010/4/21 Ron r...@cyberjunky.nl Maybe try to see if there are any differences between the ports with the setserial command. $ setserial -a /dev/ttyS1 /dev/ttyS1, Line 1, UART: unknown, Port: 0x02f8, IRQ: 3 Baud_base: 115200, close_delay: 50, divisor: 0 closing_wait: 3000 Flags: spd_normal skip_test $ setserial -a /dev/ttyUSB1 /dev/ttyUSB1, Line 0, UART: unknown, Port: 0x, IRQ: 0 Baud_base: 2400, close_delay: 0, divisor: 0 closing_wait: infinite Flags: spd_normal low_latency Hello List, This may not be a fully gambas question just I don't know who to ask for help - sorry for posting it here. I try to switch my measurement from windows XP (VB) to Ubuntu 9.10. This program takes several (3, for the moment) equipments connected to a PC through serial ports. It works correctly under XP and I succeeded to make (an even nicer :-) program in gambas for ubuntu. It also works well... as long as I use the serial ports integrated on the motherboard. I have some serial port cards we added later for having enough interface. From the gtkterm they seems working with short commands so I was optimistic. But when I send more data from my program they seems not arriving correctly. Is there anybody who works with serial ports under ubuntu (with gambas)? A little help would be highly appreciated. Robi -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] serial port issue
Robert JUHASZ ha scritto: All the parameters are the same obtained by autoconfig, except the UART which was undefined for the added ports. I set this parameter to the same value as for the working one: 16550A (in fact I tried all the possible UART parameters and where the port was working it behaves always the same: short test messages pass but in the real work environment it crashes). Do you have some sort of handshaking? -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] serial port issue
The communication parameters are 9600, 8, n, 1, Xon/Xoff. 2010/4/21 Doriano Blengino doriano.bleng...@fastwebnet.it Robert JUHASZ ha scritto: All the parameters are the same obtained by autoconfig, except the UART which was undefined for the added ports. I set this parameter to the same value as for the working one: 16550A (in fact I tried all the possible UART parameters and where the port was working it behaves always the same: short test messages pass but in the real work environment it crashes). Do you have some sort of handshaking? -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] serial port issue
Robert JUHASZ ha scritto: The communication parameters are 9600, 8, n, 1, Xon/Xoff. Do you have some sort of handshaking? Then it /could/ happen that the device sends an Xoff, but the software does not see it at the correct time. There has been a similar issue when the new UARTs with fifo came out - some application recommended to disable the fifo, because instead of a single char to test for an Xoff, the software sometimes received a bunch of bytes. The USB is not really bidirectional like a true serial port, and buffers data. So the situation looks similar. Not an easy question. You could try hardware flow control, if possible (perhaps you hate it like me). Or you can read all the pending incoming data before sending. You can also try to break outgoing data in small pieces, to let the driver peek at incoming Xoffs. Or you can disable flow control entirely, and implement it in your own code. If you have a serial scope (data tester?) try to see what happens. If you don't have one, a PC with two (real!) serial ports can do. If you describe or send parts of the code, may be that someone can see some caveat in it. Regards, Doriano -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] serial port issue
Thanks for the info! I may need to find some reliable hardware, this can be an issue (the one installed by my Chinese informatics colleague doesn't give me too much confidence :-) Did you have to install any driver to get it working? Robi 2010/4/21 Ron r...@cyberjunky.nl I use a ten ports usb hub and seperate usb to serial cables. I have written some udev rules to lock the serial device names to the physical ports.. otherwise they change after a reboot. To bad I just found these guys afterwards: http://www.picco.nl/product_info.php?products_id=2338 Regards, Ron. Ron, I mean that the app doesn't do what I wish him to do :-) Unfortunately it works as expected with the serial port on the motherboard (ttyS0, same equipment connected, same data sent and should have been received) so it should not be a bug in my code. The connection parameters (including Xon/Xoff) are required by the equipment I use. Physically, how did you connect 10 serial ports to your machine? With a card or do you use virtual ports with USB connector? Robi 2010/4/21 Ron r...@cyberjunky.nl You mean crashing like in signal #11 core dump or the application doesn't do what's wanted? Which version of Gambas? There where a few serial port related bug fixes. http://gambas.sourceforge.net/en/changelog2.html I use a lot (10) serial ports in my gambas app. 24/7 but I do not use xon/off. Regards, Ron. The communication parameters are 9600, 8, n, 1, Xon/Xoff. 2010/4/21 Doriano Blengino doriano.bleng...@fastwebnet.it Robert JUHASZ ha scritto: All the parameters are the same obtained by autoconfig, except the UART which was undefined for the added ports. I set this parameter to the same value as for the working one: 16550A (in fact I tried all the possible UART parameters and where the port was working it behaves always the same: short test messages pass but in the real work environment it crashes). Do you have some sort of handshaking? -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] serial port issue
I have no experience with the cable in my link, I just found it yesterday, but make sure your usb to serial converters have a FTDI chip inside. Not (like most of mine) an Prolific PL2303 chip since they all have the same device id and serial number, so you have a small problem identifing them. I have not installed any drivers, but I had to lock them like this: http://www.domotiga.nl/wiki/Linux/InstallOpt#Lockserialdevicenames Here is an old photo of my test server showing some of them: http://www.domotiga.nl/wiki/Domotiga/SetupPics Using Ubuntu 9.10 Regards, Ron. Thanks for the info! I may need to find some reliable hardware, this can be an issue (the one installed by my Chinese informatics colleague doesn't give me too much confidence :-) Did you have to install any driver to get it working? Robi 2010/4/21 Ron r...@cyberjunky.nl I use a ten ports usb hub and seperate usb to serial cables. I have written some udev rules to lock the serial device names to the physical ports.. otherwise they change after a reboot. To bad I just found these guys afterwards: http://www.picco.nl/product_info.php?products_id=2338 Regards, Ron. Ron, I mean that the app doesn't do what I wish him to do :-) Unfortunately it works as expected with the serial port on the motherboard (ttyS0, same equipment connected, same data sent and should have been received) so it should not be a bug in my code. The connection parameters (including Xon/Xoff) are required by the equipment I use. Physically, how did you connect 10 serial ports to your machine? With a card or do you use virtual ports with USB connector? Robi 2010/4/21 Ron r...@cyberjunky.nl You mean crashing like in signal #11 core dump or the application doesn't do what's wanted? Which version of Gambas? There where a few serial port related bug fixes. http://gambas.sourceforge.net/en/changelog2.html I use a lot (10) serial ports in my gambas app. 24/7 but I do not use xon/off. Regards, Ron. The communication parameters are 9600, 8, n, 1, Xon/Xoff. 2010/4/21 Doriano Blengino doriano.bleng...@fastwebnet.it Robert JUHASZ ha scritto: All the parameters are the same obtained by autoconfig, except the UART which was undefined for the added ports. I set this parameter to the same value as for the working one: 16550A (in fact I tried all the possible UART parameters and where the port was working it behaves always the same: short test messages pass but in the real work environment it crashes). Do you have some sort of handshaking? -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] serial port issue
I use 6 serial ports, sometimes usb mixed in, No problem in Gambas whatsoever -Fernando -- Original Message --- From: Ron r...@cyberjunky.nl To: mailing list for gambas users gambas-user@lists.sourceforge.net Sent: Wed, 21 Apr 2010 15:29:37 +0200 Subject: Re: [Gambas-user] serial port issue I have no experience with the cable in my link, I just found it yesterday, but make sure your usb to serial converters have a FTDI chip inside. Not (like most of mine) an Prolific PL2303 chip since they all have the same device id and serial number, so you have a small problem identifing them. I have not installed any drivers, but I had to lock them like this: http://www.domotiga.nl/wiki/Linux/InstallOpt#Lockserialdevicenames Here is an old photo of my test server showing some of them: http://www.domotiga.nl/wiki/Domotiga/SetupPics Using Ubuntu 9.10 Regards, Ron. Thanks for the info! I may need to find some reliable hardware, this can be an issue (the one installed by my Chinese informatics colleague doesn't give me too much confidence :-) Did you have to install any driver to get it working? Robi 2010/4/21 Ron r...@cyberjunky.nl I use a ten ports usb hub and seperate usb to serial cables. I have written some udev rules to lock the serial device names to the physical ports.. otherwise they change after a reboot. To bad I just found these guys afterwards: http://www.picco.nl/product_info.php?products_id=2338 Regards, Ron. Ron, I mean that the app doesn't do what I wish him to do :-) Unfortunately it works as expected with the serial port on the motherboard (ttyS0, same equipment connected, same data sent and should have been received) so it should not be a bug in my code. The connection parameters (including Xon/Xoff) are required by the equipment I use. Physically, how did you connect 10 serial ports to your machine? With a card or do you use virtual ports with USB connector? Robi 2010/4/21 Ron r...@cyberjunky.nl You mean crashing like in signal #11 core dump or the application doesn't do what's wanted? Which version of Gambas? There where a few serial port related bug fixes. http://gambas.sourceforge.net/en/changelog2.html I use a lot (10) serial ports in my gambas app. 24/7 but I do not use xon/off. Regards, Ron. The communication parameters are 9600, 8, n, 1, Xon/Xoff. 2010/4/21 Doriano Blengino doriano.bleng...@fastwebnet.it Robert JUHASZ ha scritto: All the parameters are the same obtained by autoconfig, except the UART which was undefined for the added ports. I set this parameter to the same value as for the working one: 16550A (in fact I tried all the possible UART parameters and where the port was working it behaves always the same: short test messages pass but in the real work environment it crashes). Do you have some sort of handshaking? -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] serial port issue (Robert JUHASZ)
Hi, Have you looked at device/terminal servers such as 'nport server' from MOXA http://www.moxa.com/product/NPort_5410.htm These devices facilitate RS232 serial comms with devices using TCP/IP sockets. Very useful where application does not have serial drivers Not cheap , but very flexible expandable. However if you have existing hardware ... Chris -- ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial port (gb.net) curious error - reading byte value incorrectly.
On 13/01/10 11:00, Anthony Ivan wrote: Hello to All, [Gambas 2.19.0-1 on Fedora 12, Intel X86_64] I am currently working on a little project that communicates with a VHF radio via the MAP27 instruction set. All is working perfectly except for one small error... as detailed below... When the radio communicates with the PC the serialport_read() triggers perfectly and takes the byte's of data provided and places them into a queue for processing ... a typical translated incoming hex string may look something like: 16 10 02 04 01 00 00 10 03 The next message will increment the 5th byte value by one thus giving: 16 10 02 04 02 00 00 10 03 Oddly enough if the value coming to the serial port from the radio is 1D (binary value 00011101), Gambas seems to see that value as 1A (binary value 00011010). Every other input is working perfectly... and there is absolute certainty that the incoming byte value is indeed 1D. Also, the outbound side is ok... if I reply to the radio as if it had sent a 1D with the appropriate CRC16 checksum everything is happy. Could this be a small error in the serial code (gb.Net) that someone has encountered or rather a known issue elsewhere which I have not yet found in my searches? Thanks, Anthony We've discussed that about one month ago. It is about a flag that must be set/cleared. The thread can be found in the archive. Regards Werner Yes. I forgot that problem. I fixed it in revision #2610. Now the CR/NL input conversion flags are cleared when opening a serial port. Regards, -- Benoît Minisini -- This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
[Gambas-user] Serial port (gb.net) curious error - reading byte value incorrectly.
Hello to All, [Gambas 2.19.0-1 on Fedora 12, Intel X86_64] I am currently working on a little project that communicates with a VHF radio via the MAP27 instruction set. All is working perfectly except for one small error... as detailed below... When the radio communicates with the PC the serialport_read() triggers perfectly and takes the byte's of data provided and places them into a queue for processing ... a typical translated incoming hex string may look something like: 16 10 02 04 01 00 00 10 03 The next message will increment the 5th byte value by one thus giving: 16 10 02 04 02 00 00 10 03 Oddly enough if the value coming to the serial port from the radio is 1D (binary value 00011101), Gambas seems to see that value as 1A (binary value 00011010). Every other input is working perfectly... and there is absolute certainty that the incoming byte value is indeed 1D. Also, the outbound side is ok... if I reply to the radio as if it had sent a 1D with the appropriate CRC16 checksum everything is happy. Could this be a small error in the serial code (gb.Net) that someone has encountered or rather a known issue elsewhere which I have not yet found in my searches? Thanks, Anthony -- This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial port (gb.net) curious error - reading byte value incorrectly.
On 13/01/10 11:00, Anthony Ivan wrote: Hello to All, [Gambas 2.19.0-1 on Fedora 12, Intel X86_64] I am currently working on a little project that communicates with a VHF radio via the MAP27 instruction set. All is working perfectly except for one small error... as detailed below... When the radio communicates with the PC the serialport_read() triggers perfectly and takes the byte's of data provided and places them into a queue for processing ... a typical translated incoming hex string may look something like: 16 10 02 04 01 00 00 10 03 The next message will increment the 5th byte value by one thus giving: 16 10 02 04 02 00 00 10 03 Oddly enough if the value coming to the serial port from the radio is 1D (binary value 00011101), Gambas seems to see that value as 1A (binary value 00011010). Every other input is working perfectly... and there is absolute certainty that the incoming byte value is indeed 1D. Also, the outbound side is ok... if I reply to the radio as if it had sent a 1D with the appropriate CRC16 checksum everything is happy. Could this be a small error in the serial code (gb.Net) that someone has encountered or rather a known issue elsewhere which I have not yet found in my searches? Thanks, Anthony We've discussed that about one month ago. It is about a flag that must be set/cleared. The thread can be found in the archive. Regards Werner -- This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers http://p.sf.net/sfu/verizon-dev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] serial port
Hello, I'm very happy with the serial port communication, just I have some more question. When I start the application, I don't know what ports will be used and how many. So I have an object array where I add new serial ports depending on the hardware configuration. From this object array, I'm able to send and receive data. I just don't know how to access to the serial port events (read). Can someone help me in this matter? Thanks, Robi yuhej wrote: Useful info, I'll do like that. Thanks, Robi 2009/9/19 nando nand...@nothingsimple.com In my Linux serial port experience, serial port devices are named: /dev/ttyS0..9 and upwards /dev/ttyUSB0..9 and upwards depending on what is plugged in USB. I have done a lot of serial port stuff with Gambas. I know that trying to open then with the serial port control will fail is non-exising port. This error can be detected. It can be possible to open a port as a test to see if it exists, but you may be changing parameters and stealing chars from an existing connection. I've had this happen tooreally messes things up. -Fernando -- Original Message --- From: yuhej robert1juh...@gmail.com To: gambas-user@lists.sourceforge.net Sent: Fri, 18 Sep 2009 21:08:04 -0700 (PDT) Subject: [Gambas-user] serial port Hello, I can see that Gambas can handle the serial ports which is a very good news for me. Can someone tell me how can I get the list of the serial ports of my computer? I wish to make an autodetect function and only allow to select from the working serial ports. Robi -- View this message in context: http://www.nabble.com/serial-port-tp25518421p25518421.html Sent from the gambas-user mailing list archive at Nabble.com. -- Come build with us! The BlackBerryreg; Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9#45;12, 2009. Register now#33; http://p.sf.net/sfu/devconf ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user --- End of Original Message --- -- Come build with us! The BlackBerryreg; Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9#45;12, 2009. Register now#33; http://p.sf.net/sfu/devconf ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- Come build with us! The BlackBerryreg; Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9#45;12, 2009. Register now#33; http://p.sf.net/sfu/devconf ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- View this message in context: http://old.nabble.com/serial-port-tp25518421p26708752.html Sent from the gambas-user mailing list archive at Nabble.com. -- Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial port data being changed ????
Benoît Minisini wrote: I'm not a serial port user at all, and I find that behaviour a bit strange. Would it be useful to make a property for that? Or maybe it does already exist in the SerialPort class, and I didn't see it. Nothing strange really. Its been like that as long as I can remember. It is not possible to tranfer binary data correctly without setting the icrnl and ocrnl flags off. Its been a long time since I was near C, but I'm fairly sure they are included in termios.h, and are the c_iflag and c_oflag. (sent this twice. mail is bouncing back) -- Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial port data being changed ????
mike wrote: I'm having trouble with Gambas and the serial ports. Something is changing binary h0d to h0a when received from a serial port. I noticed it in a program that I've been working on that receives packets of binary data from a microprocessor. I wrote a little test program to demonstrate the problem and have included it below. I also reprogrammed the micro to simply send h0d as long a pushbutton is held depressed. I have verified that the correct data is indeed being sent using CuteCom to display the binary data. An interesting thing that I noticed when I ran CuteCom to test the data being received is that if I close CuteCom without closing the serial port first then run my Gambas program, it works fine until I restart the system. If I close the port before closing CuteCom then my Gambas program fails. This is the code for the test program. ' Gambas class file ' Using Gambas 2.18 on a system running ' Fedora Kernel (26.30.9-102.fc11.x86_64) ' It also fails running Gambas 2.11 ' on my laptop running ' Fedora Kernel (2.6.27.25-78.2.56.fc9.i686) PUBLIC SUB Form_Open() ME.Center ' Setup the serial port - 9600,8,N,1 ' SerPort1.PortName = /dev/ttyS0 ' Both ports fail SerPort1.PortName = /dev/ttyUSB0' This the port I'll eventually use SerPort1.Speed = 9600 ' because the laptop has no serial port. SerPort1.DataBits = 8 SerPort1.Parity = 0 SerPort1.StopBits = 1 SerPort1.Open TextArea1.Text = SerPort1.PortName Chr$(10) END PUBLIC SUB SerPort1_Read() ' A microprocessor is connected to the serial port and ' continuously sends h0d (CR) as long a push button is held down. DIM InByte AS Byte READ #SerPort1, InByte TextArea1.Insert(Hex$(InByte) ) ' The textarea displays a series of A (LF) instead of D (CR) END PUBLIC SUB ExitBtn_Click() SerPort1.Close QUIT END PUBLIC SUB ClearBtn_Click() TextArea1.Clear END This is a Linux thing. Not Gambas. The icrnl flaf is set as standard. Easiest way is to use stty to change it. SHELL stty -F SerPort1.PortName -icrnl -- Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial port data being changed ????
2009/12/8 Les Hardy l...@webmayo.com: This is a Linux thing. Not Gambas. Linux has a lot of things. I learned the hard way that localhost TCP/IP ports below 1024 are protected. Sheesh. I lost a full day to that. Today I lost several hours to Gambas behaviour that is expained by bugs in Qt3. Nevertheless your point is valuable. I'm going to mark your Linux thing for inclusion in the documentation. Of course, I first have to figure out if icrnl flaf is a typo or an esoteric command line :) -- Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial port data being changed ????
Kadaitcha Man wrote: I first have to figure out if icrnl flaf is a typo or an esoteric command line :) Yes, esoteric, makes me feel special. Only a few know about flafs. Then again, it could just be flag. -- Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial port data being changed ???? -- Solved
Ahh, Thank you. Now I can move on to finish my project. snip This is a Linux thing. Not Gambas. The icrnl flaf is set as standard. Easiest way is to use stty to change it. SHELL stty -F SerPort1.PortName -icrnl -- Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial port data being changed ????
mike wrote: I'm having trouble with Gambas and the serial ports. Something is changing binary h0d to h0a when received from a serial port. I noticed it in a program that I've been working on that receives packets of binary data from a microprocessor. I wrote a little test program to demonstrate the problem and have included it below. I also reprogrammed the micro to simply send h0d as long a pushbutton is held depressed. I have verified that the correct data is indeed being sent using CuteCom to display the binary data. An interesting thing that I noticed when I ran CuteCom to test the data being received is that if I close CuteCom without closing the serial port first then run my Gambas program, it works fine until I restart the system. If I close the port before closing CuteCom then my Gambas program fails. This is the code for the test program. ' Gambas class file ' Using Gambas 2.18 on a system running ' Fedora Kernel (26.30.9-102.fc11.x86_64) ' It also fails running Gambas 2.11 ' on my laptop running ' Fedora Kernel (2.6.27.25-78.2.56.fc9.i686) PUBLIC SUB Form_Open() ME.Center ' Setup the serial port - 9600,8,N,1 ' SerPort1.PortName = /dev/ttyS0 ' Both ports fail SerPort1.PortName = /dev/ttyUSB0' This the port I'll eventually use SerPort1.Speed = 9600 ' because the laptop has no serial port. SerPort1.DataBits = 8 SerPort1.Parity = 0 SerPort1.StopBits = 1 SerPort1.Open TextArea1.Text = SerPort1.PortName Chr$(10) END PUBLIC SUB SerPort1_Read() ' A microprocessor is connected to the serial port and ' continuously sends h0d (CR) as long a push button is held down. DIM InByte AS Byte READ #SerPort1, InByte TextArea1.Insert(Hex$(InByte) ) ' The textarea displays a series of A (LF) instead of D (CR) END PUBLIC SUB ExitBtn_Click() SerPort1.Close QUIT END PUBLIC SUB ClearBtn_Click() TextArea1.Clear END This is a Linux thing. Not Gambas. The icrnl flaf is set as standard. Easiest way is to use stty to change it. SHELL stty -F SerPort1.PortName -icrnl I'm not a serial port user at all, and I find that behaviour a bit strange. Would it be useful to make a property for that? Or maybe it does already exist in the SerialPort class, and I didn't see it. -- Benoît Minisini -- Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial port data being changed ????
Benoît Minisini schreef: mike wrote: I'm having trouble with Gambas and the serial ports. Something is changing binary h0d to h0a when received from a serial port. I noticed it in a program that I've been working on that receives packets of binary data from a microprocessor. I wrote a little test program to demonstrate the problem and have included it below. I also reprogrammed the micro to simply send h0d as long a pushbutton is held depressed. I have verified that the correct data is indeed being sent using CuteCom to display the binary data. An interesting thing that I noticed when I ran CuteCom to test the data being received is that if I close CuteCom without closing the serial port first then run my Gambas program, it works fine until I restart the system. If I close the port before closing CuteCom then my Gambas program fails. This is the code for the test program. ' Gambas class file ' Using Gambas 2.18 on a system running ' Fedora Kernel (26.30.9-102.fc11.x86_64) ' It also fails running Gambas 2.11 ' on my laptop running ' Fedora Kernel (2.6.27.25-78.2.56.fc9.i686) PUBLIC SUB Form_Open() ME.Center ' Setup the serial port - 9600,8,N,1 ' SerPort1.PortName = /dev/ttyS0 ' Both ports fail SerPort1.PortName = /dev/ttyUSB0' This the port I'll eventually use SerPort1.Speed = 9600 ' because the laptop has no serial port. SerPort1.DataBits = 8 SerPort1.Parity = 0 SerPort1.StopBits = 1 SerPort1.Open TextArea1.Text = SerPort1.PortName Chr$(10) END PUBLIC SUB SerPort1_Read() ' A microprocessor is connected to the serial port and ' continuously sends h0d (CR) as long a push button is held down. DIM InByte AS Byte READ #SerPort1, InByte TextArea1.Insert(Hex$(InByte) ) ' The textarea displays a series of A (LF) instead of D (CR) END PUBLIC SUB ExitBtn_Click() SerPort1.Close QUIT END PUBLIC SUB ClearBtn_Click() TextArea1.Clear END This is a Linux thing. Not Gambas. The icrnl flaf is set as standard. Easiest way is to use stty to change it. SHELL stty -F SerPort1.PortName -icrnl I'm not a serial port user at all, and I find that behaviour a bit strange. Me too. I have build serial support for about 10 different hardware devices in my Gambas project both binary and ASCII and didn't stumble upon this strange behavior (yet?) Regards, Ron_2nd. -- Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial port data being changed ????
Ron ha scritto: Benoît Minisini schreef: mike wrote: I'm having trouble with Gambas and the serial ports. Something is changing binary h0d to h0a when received from a serial port. I noticed it in a program that I've been working on that receives packets of binary data from a microprocessor. I wrote a little test program to demonstrate the problem and have included it below. I also reprogrammed the micro to simply send h0d as long a pushbutton is held depressed. I have verified that the correct data is indeed being sent using CuteCom to display the binary data. An interesting thing that I noticed when I ran CuteCom to test the data being received is that if I close CuteCom without closing the serial port first then run my Gambas program, it works fine until I restart the system. If I close the port before closing CuteCom then my Gambas program fails. This is the code for the test program. ' Gambas class file ' Using Gambas 2.18 on a system running ' Fedora Kernel (26.30.9-102.fc11.x86_64) ' It also fails running Gambas 2.11 ' on my laptop running ' Fedora Kernel (2.6.27.25-78.2.56.fc9.i686) PUBLIC SUB Form_Open() ME.Center ' Setup the serial port - 9600,8,N,1 ' SerPort1.PortName = /dev/ttyS0 ' Both ports fail SerPort1.PortName = /dev/ttyUSB0' This the port I'll eventually use SerPort1.Speed = 9600 ' because the laptop has no serial port. SerPort1.DataBits = 8 SerPort1.Parity = 0 SerPort1.StopBits = 1 SerPort1.Open TextArea1.Text = SerPort1.PortName Chr$(10) END PUBLIC SUB SerPort1_Read() ' A microprocessor is connected to the serial port and ' continuously sends h0d (CR) as long a push button is held down. DIM InByte AS Byte READ #SerPort1, InByte TextArea1.Insert(Hex$(InByte) ) ' The textarea displays a series of A (LF) instead of D (CR) END PUBLIC SUB ExitBtn_Click() SerPort1.Close QUIT END PUBLIC SUB ClearBtn_Click() TextArea1.Clear END This is a Linux thing. Not Gambas. The icrnl flaf is set as standard. Easiest way is to use stty to change it. SHELL stty -F SerPort1.PortName -icrnl I'm not a serial port user at all, and I find that behaviour a bit strange. Me too. I have build serial support for about 10 different hardware devices in my Gambas project both binary and ASCII and didn't stumble upon this strange behavior (yet?) Could it be that some other process is using the port (getty, mgetty)? And that that process programs the serial driver? Because those stty things should be related, I think, to terminal devices, not general serial drivers as used by pppd, for example. Just put this way - I really don't know. Regards, -- Doriano Blengino Listen twice before you speak. This is why we have two ears, but only one mouth. -- Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial port data being changed ????
Les Hardy wrote: Kadaitcha Man wrote: I first have to figure out if icrnl flaf is a typo or an esoteric command line :) Yes, esoteric, makes me feel special. Only a few know about flafs. lol Then again, it could just be flag. Nah. That'd ruin the whole effect. -- Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial port data being changed ????
Benoît Minisini wrote: snip This is a Linux thing. Not Gambas. The icrnl flaf is set as standard. Easiest way is to use stty to change it. SHELL stty -F SerPort1.PortName -icrnl I'm not a serial port user at all, and I find that behaviour a bit strange. Would it be useful to make a property for that? Or maybe it does already exist in the SerialPort class, and I didn't see it. If not property setting then at least a reference in the docs to the stty thing would have been very helpful. -- Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
[Gambas-user] Serial port data being changed ????
I'm having trouble with Gambas and the serial ports. Something is changing binary h0d to h0a when received from a serial port. I noticed it in a program that I've been working on that receives packets of binary data from a microprocessor. I wrote a little test program to demonstrate the problem and have included it below. I also reprogrammed the micro to simply send h0d as long a pushbutton is held depressed. I have verified that the correct data is indeed being sent using CuteCom to display the binary data. An interesting thing that I noticed when I ran CuteCom to test the data being received is that if I close CuteCom without closing the serial port first then run my Gambas program, it works fine until I restart the system. If I close the port before closing CuteCom then my Gambas program fails. This is the code for the test program. ' Gambas class file ' Using Gambas 2.18 on a system running ' Fedora Kernel (26.30.9-102.fc11.x86_64) ' It also fails running Gambas 2.11 ' on my laptop running ' Fedora Kernel (2.6.27.25-78.2.56.fc9.i686) PUBLIC SUB Form_Open() ME.Center ' Setup the serial port - 9600,8,N,1 ' SerPort1.PortName = /dev/ttyS0 ' Both ports fail SerPort1.PortName = /dev/ttyUSB0' This the port I'll eventually use SerPort1.Speed = 9600 ' because the laptop has no serial port. SerPort1.DataBits = 8 SerPort1.Parity = 0 SerPort1.StopBits = 1 SerPort1.Open TextArea1.Text = SerPort1.PortName Chr$(10) END PUBLIC SUB SerPort1_Read() ' A microprocessor is connected to the serial port and ' continuously sends h0d (CR) as long a push button is held down. DIM InByte AS Byte READ #SerPort1, InByte TextArea1.Insert(Hex$(InByte) ) ' The textarea displays a series of A (LF) instead of D (CR) END PUBLIC SUB ExitBtn_Click() SerPort1.Close QUIT END PUBLIC SUB ClearBtn_Click() TextArea1.Clear END -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial Port Change Events Not Working after Upgrade to Karmic
I found out that reading one by one is a slow process, I found out that reading all Lof will in a rare instance _READ will not fire when only 1 byte arrives immediately after. I find it works correctly 100% when I read Lof()-1 and rely on _Read to fire again. for the one remaining and the new one arriving immediately after. Uh... Very strange! It would be cool if you could try your program with the latest Gambas 2 or Gambas 3 and see if you have to do the same trick. Regards, -- Benoît Minisini -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial Port Change Events Not Working after Upgrade to Karmic
Benoît Minisini wrote: I found out that reading one by one is a slow process, I found out that reading all Lof will in a rare instance _READ will not fire when only 1 byte arrives immediately after. I find it works correctly 100% when I read Lof()-1 and rely on _Read to fire again. for the one remaining and the new one arriving immediately after. Uh... Very strange! It would be cool if you could try your program with the latest Gambas 2 or Gambas 3 and see if you have to do the same trick. Regards, Hi all, I'd just like to report that with revision 2459, the change events have been restored for my application. I tried flowcontrol none/hardware/software/both and couldn't pick any appreciable difference in CPU utilisation. The funny thing is that the anomoly reported in a previous email - The application also uses the UDPsocket to communicate remotely and what I have noticed is that if the serial port does not open correctly e.g. /dev/tty wrong and the UDPsocket is open, then there is a large amount of CPU used. Both open correctly and CPU normal - appears to be fixed. Whilst I don't understand why this has been fixed, it would seem to be another plus. Regards, Tony. -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial Port Change Events Not Working after Upgrade to Karmic
Benoît Minisini schreef: Benoit, Here is the output of valgrind as requested. I hope it helps. Regards, Tony.. $ valgrind --tool=memcheck --num-callers=50 gbx2 ==2404== Memcheck, a memory error detector ==2404== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al. ==2404== Using Valgrind-3.5.0-Debian and LibVEX; rerun with -h for copyright info ==2404== Command: gbx2 ==2404== /dev/ttyUSB0 19200 0 8 1 1 1 ==2404== Invalid read of size 4 ==2404==at 0x535C586: CSerialPort_CallBack (CSerialPort.c:120) ==2404==by 0x4663A21: CWatch::write(int) (CWatch.cpp:143) ==2404== by0x4663885:CWatch::qt_invoke(int, QUObject*) (CWatch_moc.cpp:91) ... Is it better with revision #2455? (Ron, you can try too!) I guess not... Program received signal SIGSEGV, Segmentation fault. GB_Raise (object=0xd, event_id=0, nparam=0) at gbx_api.c:528 528OBJECT_REF(object, GB_Raise); (gdb) bt #0 GB_Raise (object=0xd, event_id=0, nparam=0) at gbx_api.c:528 #1 0x00334cd5 in CSerialPort_ReadCallBack (_object=0xd) at CSerialPort.c:175 #2 0x08060997 in raise_callback (wait=value optimized out) at gbx_watch.c:425 #3 do_loop (wait=value optimized out) at gbx_watch.c:498 #4 0x08060b04 in WATCH_loop () at gbx_watch.c:530 #5 0x08061b72 in main (argc=134739040, argv=0xb4f4) at gbx.c:358 (gdb) ==5235== Memcheck, a memory error detector ==5235== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al. ==5235== Using Valgrind-3.5.0-Debian and LibVEX; rerun with -h for copyright info ==5235== Command: gbx2 -p ==5235== Parent PID: 16998 ==5235== ==5235== Invalid read of size 4 ==5235==at 0x805D8DA: GB_Raise (gbx_api.c:528) ==5235==by 0x460CCD4: CSerialPort_ReadCallBack (CSerialPort.c:175) ==5235==by 0x8060996: do_loop (gbx_watch.c:425) ==5235==by 0x8060B03: WATCH_loop (gbx_watch.c:530) ==5235==by 0x8061B71: main (gbx.c:358) ==5235== Address 0x10 is not stack'd, malloc'd or (recently) free'd ==5235== ==5235== ==5235== Process terminating with default action of signal 11 (SIGSEGV): dumping core ==5235== Access not within mapped region at address 0x10 ==5235==at 0x805D8DA: GB_Raise (gbx_api.c:528) ==5235==by 0x460CCD4: CSerialPort_ReadCallBack (CSerialPort.c:175) ==5235==by 0x8060996: do_loop (gbx_watch.c:425) ==5235==by 0x8060B03: WATCH_loop (gbx_watch.c:530) ==5235==by 0x8061B71: main (gbx.c:358) ==5235== If you believe this happened as a result of a stack ==5235== overflow in your program's main thread (unlikely but ==5235== possible), you can try to increase the size of the ==5235== main thread stack using the --main-stacksize= flag. ==5235== The main thread stack size used in this run was 8388608. Regards, Ron_2nd. -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial Port Change Events Not Working after Upgrade to Karmic
It should be ok with revision #2456! If it really works, can you check that changing the flow control between None and something else actually has an effect on CPU consumption? -- Benoît Minisini -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial Port Change Events Not Working after Upgrade to Karmic
Benoît Minisini schreef: It should be ok with revision #2456! If it really works, can you check that changing the flow control between None and something else actually has an effect on CPU consumption? Benoît, no segfaults, but the system load when running my project with the patch is alot higher than before. Before it was 0.2-0.3 Now it's 1.0-1.10 I'm not using flowcontrol. $ grep FlowControl * CCTX35.class:.FlowControl = 0 CGPS.class:.FlowControl = 0 CPlugwise.class:.FlowControl = 0 CRFXComRX.class:.FlowControl = 0 CRFXComTX.class:.FlowControl = 0 CSMS.class:.FlowControl = 0 CVISCA.class:.FlowControl = 0 CWeeder.class:.FlowControl = 0 CZWave.class:.FlowControl = 0 Six of these serialports are active. And I presume 0 is the same as None. Regards, Ron_2nd. -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial Port Change Events Not Working after Upgrade to Karmic
Benoît Minisini schreef: It should be ok with revision #2456! If it really works, can you check that changing the flow control between None and something else actually has an effect on CPU consumption? Benoît, no segfaults, but the system load when running my project with the patch is alot higher than before. Before it was 0.2-0.3 Now it's 1.0-1.10 I'm not using flowcontrol. $ grep FlowControl * CCTX35.class:.FlowControl = 0 CGPS.class:.FlowControl = 0 CPlugwise.class:.FlowControl = 0 CRFXComRX.class:.FlowControl = 0 CRFXComTX.class:.FlowControl = 0 CSMS.class:.FlowControl = 0 CVISCA.class:.FlowControl = 0 CWeeder.class:.FlowControl = 0 CZWave.class:.FlowControl = 0 Six of these serialports are active. And I presume 0 is the same as None. Regards, Ron_2nd. That would mean that the Read callback is called endlessly, as if there are always bytes to read on the serial port. Do you use the read event? Can you check that by implementing a Read event handler, check how much time it is called, and check what can be read on the serial port? If there is something to read on the serial port, if there are data to read, and if you don't read it, the Read callback will be called again and again. Regards, -- Benoît Minisini -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial Port Change Events Not Working after Upgrade to Karmic
Benoît Minisini schreef: Benoît Minisini schreef: It should be ok with revision #2456! If it really works, can you check that changing the flow control between None and something else actually has an effect on CPU consumption? Benoît, no segfaults, but the system load when running my project with the patch is alot higher than before. Before it was 0.2-0.3 Now it's 1.0-1.10 I'm not using flowcontrol. $ grep FlowControl * CCTX35.class:.FlowControl = 0 CGPS.class:.FlowControl = 0 CPlugwise.class:.FlowControl = 0 CRFXComRX.class:.FlowControl = 0 CRFXComTX.class:.FlowControl = 0 CSMS.class:.FlowControl = 0 CVISCA.class:.FlowControl = 0 CWeeder.class:.FlowControl = 0 CZWave.class:.FlowControl = 0 Six of these serialports are active. And I presume 0 is the same as None. Regards, Ron_2nd. That would mean that the Read callback is called endlessly, as if there are always bytes to read on the serial port. Do you use the read event? Can you check that by implementing a Read event handler, check how much time it is called, and check what can be read on the serial port? If there is something to read on the serial port, if there are data to read, and if you don't read it, the Read callback will be called again and again. Regards, Almost all of them use a Read event handler. CRFXComRX receives the most number of bytes, as it receives data from all of my temp/energy sensors. I have this defined: PUBLIC SUB RFXComRXSer_Read() DIM sData AS Byte READ #hRFXComRXSer, sData ProcessReceivedChar(sData) END So it reads data byte by byte and process them. Sure a continues flow of data, but before the latest rev. everything works with very low cpuload (with even higher serial loads) . I don't want to loose that! My guess is that now the Read event is called even when there is no data, otherwise I couldn't have a much lower load without changes to my code. I remember having reported the same issue of high loads of serialport code, you fixed it here: Revision: 1796 http://gambas.svn.sourceforge.net/gambas/?rev=1796view=rev Author: gambas Date: 2009-01-12 21:24:47 + (Mon, 12 Jan 2009) Log Message: --- [GB.NET] * BUG: Serial port devices are now watched for reading, not for writing. So the callback will not be called permanently. Modified Paths: -- gambas/branches/2.0/gb.net/src/CSerialPort.c Is this related to the fix you have put in now? If you want I can run valgrind/kcachegrind, but I have to make some free time first. Regards, Ron_2nd. -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial Port Change Events Not Working after Upgrade to Karmic
Ron a écrit : ... runned valgrind tool for a while. And I got a rather strange winner, I got 3 milion calls of _add_char in gb_error.c Some debug code hanging around or something like that? See attached valgrind file. May be that's a source for what I noticed (Debian sid, XP2600+, 1.5GB RAM): if I start a GB project while there a CPU (or I/O) hungry process running, half the time GB says its running, but no window shows on screen. JY -- In which level of metalanguage are you now speaking? -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial Port Change Events Not Working after Upgrade to Karmic
Benoît Minisini schreef: Benoît Minisini schreef: It should be ok with revision #2456! If it really works, can you check that changing the flow control between None and something else actually has an effect on CPU consumption? Benoît, no segfaults, but the system load when running my project with the patch is alot higher than before. Before it was 0.2-0.3 Now it's 1.0-1.10 I'm not using flowcontrol. $ grep FlowControl * CCTX35.class:.FlowControl = 0 CGPS.class:.FlowControl = 0 CPlugwise.class:.FlowControl = 0 CRFXComRX.class:.FlowControl = 0 CRFXComTX.class:.FlowControl = 0 CSMS.class:.FlowControl = 0 CVISCA.class:.FlowControl = 0 CWeeder.class:.FlowControl = 0 CZWave.class:.FlowControl = 0 Six of these serialports are active. And I presume 0 is the same as None. Regards, Ron_2nd. That would mean that the Read callback is called endlessly, as if there are always bytes to read on the serial port. Do you use the read event? Can you check that by implementing a Read event handler, check how much time it is called, and check what can be read on the serial port? If there is something to read on the serial port, if there are data to read, and if you don't read it, the Read callback will be called again and again. Regards, Benoit, runned valgrind tool for a while. And I got a rather strange winner, I got 3 milion calls of _add_char in gb_error.c Some debug code hanging around or something like that? See attached valgrind file. Regards, Ron_2nd. The reason is a lot of one-byte reading that raises the EOF error. This should be logical if the read event handler is called whereas there is nothing to read, and then you read one byte. But why Linux tells me (the interpreter actually) that there is something to read on the serial port file descriptor, whereas there is nothing? Regards, -- Benoît Minisini -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial Port Change Events Not Working after Upgrade to Karmic
I found out that reading one by one is a slow process, I found out that reading all Lof will in a rare instance _READ will not fire when only 1 byte arrives immediately after. I find it works correctly 100% when I read Lof()-1 and rely on _Read to fire again. for the one remaining and the new one arriving immediately after. -- Original Message --- From: Benoît Minisini gam...@users.sourceforge.net To: nand...@nothingsimple.com, mailing list for gambas users gambas-user@lists.sourceforge.net Sent: Sat, 5 Dec 2009 21:56:41 +0100 Subject: Re: [Gambas-user] Serial Port Change Events Not Working after Upgrade to Karmic Benoit, Just to let you know, for your information only. My serial port applicationS that have been running 24 hours for 4 years on over 150 computers works much better when pull out All less 1 byte each _Read event as opposed to. I didn't understand the last sentence. Do you read bytes one by one or all at once? You should read all available bytes at once, by using the Lof() function. Regards, -- Benoît Minisini -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user --- End of Original Message --- -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial Port Change Events Not Working after Upgrade to Karmic
Hi Benoit, I have muddled my way through the subversion bit, hopefully correctly and compiled the 2454 version. When opening my application I get the error message The program has stopped unexpectedly raising signal #11 with the CPU at 100%. If I try to open the wrong ttyUSBx, the application flags this error and behaves correctly, so I would assume that if the ttyUSBx opens OK then the most recent Gambas2 changes have induced the signal #11 problem. Can you please let me know how to debug further and assist you with your efforts. Thanks and regards, Tony.. Benoît Minisini wrote: Thanks Benoit and all for your speedy replies.. I'm using the serial port in a timing application with 3 laser through beam sensors feeding into the CTS, RI and DSR lines of the serial port. In this mode I don't pass any data, don't really care about flow control and am only interested in the raw status change events. Working this way I haven't noticed gross CPU utilisation after opening the port. The application also uses the UDPsocket to communicate remotely and what I have noticed is that if the serial port does not open correctly e.g. /dev/tty wrong and the UDPsocket is open, then there is a large amount of CPU used. Both open correctly and CPU normal. Can you tell me the polling frequency in Gambas2 2.8 ? I would assume that there ore other users of Gambas2 who are using the serial port as a convenient way of passing external events to the application, so maybe some input from them would also be in order. As long as there is a mechanism to replicate the Gambas2 2.8 functionality that I currently use, I'll leave the implementation up to those who know a lot more than myself. If going back to polling, a property to define the frequency would be nice. Thanks again, Tony. Can you try the revision #2454? I think I have found and fix another possible bug, and I'd like to be sure I didn't break anything. Regards, -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial Port Change Events Not Working after Upgrade to Karmic
Am Mittwoch, den 02.12.2009, 20:25 +1100 schrieb Tony: Hi Benoit, I have muddled my way through the subversion bit, hopefully correctly and compiled the 2454 version. When opening my application I get the error message The program has stopped unexpectedly raising signal #11 with the CPU at 100%. If I try to open the wrong ttyUSBx, the application flags this error and behaves correctly, so I would assume that if the ttyUSBx opens OK then the most recent Gambas2 changes have induced the signal #11 problem. Can you please let me know how to debug further and assist you with your efforts. Thanks and regards, Tony.. Benoît Minisini wrote: Thanks Benoit and all for your speedy replies.. I'm using the serial port in a timing application with 3 laser through beam sensors feeding into the CTS, RI and DSR lines of the serial port. In this mode I don't pass any data, don't really care about flow control and am only interested in the raw status change events. Working this way I haven't noticed gross CPU utilisation after opening the port. The application also uses the UDPsocket to communicate remotely and what I have noticed is that if the serial port does not open correctly e.g. /dev/tty wrong and the UDPsocket is open, then there is a large amount of CPU used. Both open correctly and CPU normal. Can you tell me the polling frequency in Gambas2 2.8 ? I would assume that there ore other users of Gambas2 who are using the serial port as a convenient way of passing external events to the application, so maybe some input from them would also be in order. As long as there is a mechanism to replicate the Gambas2 2.8 functionality that I currently use, I'll leave the implementation up to those who know a lot more than myself. If going back to polling, a property to define the frequency would be nice. Thanks again, Tony. Can you try the revision #2454? I think I have found and fix another possible bug, and I'd like to be sure I didn't break anything. Regards, Salut Tony, you will find how to work with gdb there : go to http://gambas.sourceforge.net/en/main.html click: Reporting a problem read : 3. Reporting a crash (a segmentation fault, or a signal #11) -- Amicalement Charlie -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial Port Change Events Not Working after Upgrade to Karmic
Benoît Minisini wrote: Am Mittwoch, den 02.12.2009, 20:25 +1100 schrieb Tony: Hi Benoit, I have muddled my way through the subversion bit, hopefully correctly and compiled the 2454 version. When opening my application I get the error message The program has stopped unexpectedly raising signal #11 with the CPU at 100%. If I try to open the wrong ttyUSBx, the application flags this error and behaves correctly, so I would assume that if the ttyUSBx opens OK then the most recent Gambas2 changes have induced the signal #11 problem. Can you please let me know how to debug further and assist you with your efforts. Thanks and regards, Tony.. Benoît Minisini wrote: Thanks Benoit and all for your speedy replies.. I'm using the serial port in a timing application with 3 laser through beam sensors feeding into the CTS, RI and DSR lines of the serial port. In this mode I don't pass any data, don't really care about flow control and am only interested in the raw status change events. Working this way I haven't noticed gross CPU utilisation after opening the port. The application also uses the UDPsocket to communicate remotely and what I have noticed is that if the serial port does not open correctly e.g. /dev/tty wrong and the UDPsocket is open, then there is a large amount of CPU used. Both open correctly and CPU normal. Can you tell me the polling frequency in Gambas2 2.8 ? I would assume that there ore other users of Gambas2 who are using the serial port as a convenient way of passing external events to the application, so maybe some input from them would also be in order. As long as there is a mechanism to replicate the Gambas2 2.8 functionality that I currently use, I'll leave the implementation up to those who know a lot more than myself. If going back to polling, a property to define the frequency would be nice. Thanks again, Tony. Can you try the revision #2454? I think I have found and fix another possible bug, and I'd like to be sure I didn't break anything. Regards, Salut Tony, you will find how to work with gdb there : go to http://gambas.sourceforge.net/en/main.html click: Reporting a problem read : 3. Reporting a crash (a segmentation fault, or a signal #11) And another often more interesting way of debugging is using 'valgrind': $ cd /path/to/my/project $ valgrind --tool=memcheck --num-callers=50 gbx2 ... And then you send me the output written by valgrind. Regards, Benoît, I updated to 2454 and have signal 11's too, right away while starting my program. This is the bt: Program received signal SIGSEGV, Segmentation fault. GB_Raise (object=0x11, event_id=0, nparam=0) at gbx_api.c:528 528OBJECT_REF(object, GB_Raise); (gdb) bt #0 GB_Raise (object=0x11, event_id=0, nparam=0) at gbx_api.c:528 #1 0x00b99cd5 in CSerialPort_ReadCallBack (_object=0x11) at CSerialPort.c:175 #2 0x08060997 in raise_callback (wait=value optimized out) at gbx_watch.c:425 #3 do_loop (wait=value optimized out) at gbx_watch.c:498 #4 0x08060b04 in WATCH_loop () at gbx_watch.c:530 #5 0x08061b72 in main (argc=134739040, argv=0xb4e4) at gbx.c:358 (gdb) I'm recompiling without optimizations at this moment, so better backtrace is coming... I only have Flowcontrol = 0 in all of my serial port code. Gambas 2.18.x gb.qt Ubuntu 9.10 Kind Regards, Ron_2nd. -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial Port Change Events Not Working after Upgrade to Karmic
Ron wrote: Benoît Minisini wrote: Am Mittwoch, den 02.12.2009, 20:25 +1100 schrieb Tony: Hi Benoit, I have muddled my way through the subversion bit, hopefully correctly and compiled the 2454 version. When opening my application I get the error message The program has stopped unexpectedly raising signal #11 with the CPU at 100%. If I try to open the wrong ttyUSBx, the application flags this error and behaves correctly, so I would assume that if the ttyUSBx opens OK then the most recent Gambas2 changes have induced the signal #11 problem. Can you please let me know how to debug further and assist you with your efforts. Thanks and regards, Tony.. Benoît Minisini wrote: Thanks Benoit and all for your speedy replies.. I'm using the serial port in a timing application with 3 laser through beam sensors feeding into the CTS, RI and DSR lines of the serial port. In this mode I don't pass any data, don't really care about flow control and am only interested in the raw status change events. Working this way I haven't noticed gross CPU utilisation after opening the port. The application also uses the UDPsocket to communicate remotely and what I have noticed is that if the serial port does not open correctly e.g. /dev/tty wrong and the UDPsocket is open, then there is a large amount of CPU used. Both open correctly and CPU normal. Can you tell me the polling frequency in Gambas2 2.8 ? I would assume that there ore other users of Gambas2 who are using the serial port as a convenient way of passing external events to the application, so maybe some input from them would also be in order. As long as there is a mechanism to replicate the Gambas2 2.8 functionality that I currently use, I'll leave the implementation up to those who know a lot more than myself. If going back to polling, a property to define the frequency would be nice. Thanks again, Tony. Can you try the revision #2454? I think I have found and fix another possible bug, and I'd like to be sure I didn't break anything. Regards, Salut Tony, you will find how to work with gdb there : go to http://gambas.sourceforge.net/en/main.html click: Reporting a problem read : 3. Reporting a crash (a segmentation fault, or a signal #11) And another often more interesting way of debugging is using 'valgrind': $ cd /path/to/my/project $ valgrind --tool=memcheck --num-callers=50 gbx2 ... And then you send me the output written by valgrind. Regards, Benoît, I updated to 2454 and have signal 11's too, right away while starting my program. This is the bt: Program received signal SIGSEGV, Segmentation fault. GB_Raise (object=0x11, event_id=0, nparam=0) at gbx_api.c:528 528OBJECT_REF(object, GB_Raise); (gdb) bt #0 GB_Raise (object=0x11, event_id=0, nparam=0) at gbx_api.c:528 #1 0x00b99cd5 in CSerialPort_ReadCallBack (_object=0x11) at CSerialPort.c:175 #2 0x08060997 in raise_callback (wait=value optimized out) at gbx_watch.c:425 #3 do_loop (wait=value optimized out) at gbx_watch.c:498 #4 0x08060b04 in WATCH_loop () at gbx_watch.c:530 #5 0x08061b72 in main (argc=134739040, argv=0xb4e4) at gbx.c:358 (gdb) I'm recompiling without optimizations at this moment, so better backtrace is coming... I only have Flowcontrol = 0 in all of my serial port code. Gambas 2.18.x gb.qt Ubuntu 9.10 Kind Regards, Ron_2nd. Hmm... recompiling complete Gambas source without optimization flag didn't result in a more verbose output, and I don't want to recompile libqt or things like that. Regards, Ron_2nd. -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial Port Change Events Not Working after Upgrade to Karmic
Benoit, Here is the output of valgrind as requested. I hope it helps. Regards, Tony.. $ valgrind --tool=memcheck --num-callers=50 gbx2 ==2404== Memcheck, a memory error detector ==2404== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al. ==2404== Using Valgrind-3.5.0-Debian and LibVEX; rerun with -h for copyright info ==2404== Command: gbx2 ==2404== /dev/ttyUSB0 19200 0 8 1 1 1 ==2404== Invalid read of size 4 ==2404==at 0x535C586: CSerialPort_CallBack (CSerialPort.c:120) ==2404==by 0x4663A21: CWatch::write(int) (CWatch.cpp:143) ==2404== by0x4663885:CWatch::qt_invoke(int, QUObject*) (CWatch_moc.cpp:91) ==2404== by 0x493C359: QObject::activate_signal(QConnectionList*, QUObject*) (in /usr/lib/libqt-mt.so.3.3.8) ==2404== by 0x493E1E3: QObject::activate_signal(int, int) (in /usr/lib/libqt-mt.so.3.3.8) ==2404== by 0x4C9BBFF: QSocketNotifier::activated(int) (in /usr/lib/libqt-mt.so.3.3.8) ==2404== by 0x495B166: QSocketNotifier::event(QEvent*) (in /usr/lib/libqt-mt.so.3.3.8) ==2404==by 0x48D74B6: QApplication::internalNotify(QObject*, QEvent*) (in /usr/lib/libqt-mt.so.3.3.8) ==2404== by 0x48D842A: QApplication::notify(QObject*, QEvent*) (in /usr/lib/libqt-mt.so.3.3.8) ==2404== by 0x463A5E2: MyApplication::notify(QObject*, QEvent*) (main.cpp:354) ==2404== by 0x48CC1E3: QEventLoop::activateSocketNotifiers() (in /usr/lib/libqt-mt.so.3.3.8) ==2404== by 0x488207D: QEventLoop::processEvents(unsigned int) (in /usr/lib/libqt-mt.so.3.3.8) ==2404== by 0x463A70B: MyEventLoop::processEvents(unsigned int) (main.cpp:247) ==2404== by 0x48F04AF: QEventLoop::enterLoop() (in /usr/lib/libqt-mt.so.3.3.8) ==2404==by 0x48F0355: QEventLoop::exec() (in /usr/lib/libqt-mt.so.3.3.8) ==2404== by 0x48D7B0E: QApplication::exec() (in /usr/lib/libqt-mt.so.3.3.8) ==2404==by 0x4639D57: hook_loop() (main.cpp:542) ==2404==by 0x8061B71: main (gbx.c:358) ==2404== Address 0x31 is not stack'd, malloc'd or (recently) free'd ==2404== ==2404== ==2404== Process terminating with default action of signal 11 (SIGSEGV) ==2404== Access not within mapped region at address 0x31 ==2404==at 0x535C586: CSerialPort_CallBack (CSerialPort.c:120) ==2404==by 0x4663A21: CWatch::write(int) (CWatch.cpp:143) ==2404== by0x4663885:CWatch::qt_invoke(int, QUObject*) (CWatch_moc.cpp:91) ==2404== by 0x493C359: QObject::activate_signal(QConnectionList*, QUObject*) (in /usr/lib/libqt-mt.so.3.3.8) ==2404== by 0x493E1E3: QObject::activate_signal(int, int) (in /usr/lib/libqt-mt.so.3.3.8) ==2404== by 0x4C9BBFF: QSocketNotifier::activated(int) (in /usr/lib/libqt-mt.so.3.3.8) ==2404== by 0x495B166: QSocketNotifier::event(QEvent*) (in /usr/lib/libqt-mt.so.3.3.8) ==2404==by 0x48D74B6: QApplication::internalNotify(QObject*, QEvent*) (in /usr/lib/libqt-mt.so.3.3.8) ==2404== by 0x48D842A: QApplication::notify(QObject*, QEvent*) (in /usr/lib/libqt-mt.so.3.3.8) ==2404== by 0x463A5E2: MyApplication::notify(QObject*, QEvent*) (main.cpp:354) ==2404== by 0x48CC1E3: QEventLoop::activateSocketNotifiers() (in /usr/lib/libqt-mt.so.3.3.8) ==2404== by 0x488207D: QEventLoop::processEvents(unsigned int) (in /usr/lib/libqt-mt.so.3.3.8) ==2404== by 0x463A70B: MyEventLoop::processEvents(unsigned int) (main.cpp:247) ==2404== by 0x48F04AF: QEventLoop::enterLoop() (in /usr/lib/libqt-mt.so.3.3.8) ==2404==by 0x48F0355: QEventLoop::exec() (in /usr/lib/libqt-mt.so.3.3.8) ==2404== by 0x48D7B0E: QApplication::exec() (in /usr/lib/libqt-mt.so.3.3.8) ==2404==by 0x4639D57: hook_loop() (main.cpp:542) ==2404==by 0x8061B71: main (gbx.c:358) ==2404== If you believe this happened as a result of a stack ==2404== overflow in your program's main thread (unlikely but ==2404== possible), you can try to increase the size of the ==2404== main thread stack using the --main-stacksize= flag. ==2404== The main thread stack size used in this run was 8388608. ==2404== ==2404== HEAP SUMMARY: ==2404== in use at exit: 1,958,423 bytes in 15,402 blocks ==2404== total heap usage: 102,525 allocs, 87,123 frees, 7,712,919 bytes allocated ==2404== ==2404== LEAK SUMMARY: ==2404==definitely lost: 6,916 bytes in 28 blocks ==2404==indirectly lost: 12,892 bytes in 633 blocks ==2404== possibly lost: 175,810 bytes in 721 blocks ==2404==still reachable: 1,762,805 bytes in 14,020 blocks ==2404== suppressed: 0 bytes in 0 blocks ==2404== Rerun with --leak-check=full to see details of leaked memory ==2404==
[Gambas-user] Serial Port Change Events Not Working after Upgrade to Karmic
Hi, I have a Gambas2 application (gb.qt) checking for status change events on the CTS, RI and DSR signals (SerialPort-gb.net class) of a USB to serial converter (Prolific pl2303) which works fine on Ubuntu 9.04 (Gambas2 2.8 and kernel 2.6.28-16-generic 32bit). After upgrade to Ubuntu 9.10 (Gambas2 2.13 and kernel 2.6.31-15-generic 32bit) the status changes are no longer working. The serial port opens without error but no status change events are flagged. The problem is also evident in the serial port example on Ubuntu 9.10. I have compiled Gambas2 2.18 onto Ubuntu 9.04 but it still fails so my guess is that somewhere between Gambas2 2.8 and 2.13 this functionality stopped working. Any assistance would be appreciated, thanks.. -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial Port Change Events Not Working after Upgrade to Karmic
Tony, Try to compile gambas2 again. I got similar problem with apps after upgrade ubuntu from 9.04 yo 9.10 and it was necessary to do this: sudo apt-get install build-essential autoconf libbz2-dev libfbclient2 libmysqlclient15-dev unixodbc-dev libpq-dev libsqlite0-dev libsqlite3-dev libgtk2.0-dev libldap2-dev libcurl4-gnutls-dev libgtkglext1-dev libpcre3-dev libsdl-sound1.2-dev libsdl-mixer1.2-dev libsdl-image1.2-dev libsage-dev libxml2-dev libxslt1-dev libbonobo2-dev libcos4-dev libomniorb4-dev librsvg2-dev libpoppler-dev libpoppler-glib-dev libasound2-dev libesd0-dev libesd-alsa0 libdirectfb-dev libaa1-dev libxtst-dev libffi-dev kdelibs4-dev firebird2.1-dev libqt4-dev and after I downloaded gambas from source and compile again. Hope this works for you. Regards, Ricardo Díaz 2009/12/1 Tony ajw...@optusnet.com.au Hi, I have a Gambas2 application (gb.qt) checking for status change events on the CTS, RI and DSR signals (SerialPort-gb.net class) of a USB to serial converter (Prolific pl2303) which works fine on Ubuntu 9.04 (Gambas2 2.8 and kernel 2.6.28-16-generic 32bit). After upgrade to Ubuntu 9.10 (Gambas2 2.13 and kernel 2.6.31-15-generic 32bit) the status changes are no longer working. The serial port opens without error but no status change events are flagged. The problem is also evident in the serial port example on Ubuntu 9.10. I have compiled Gambas2 2.18 onto Ubuntu 9.04 but it still fails so my guess is that somewhere between Gambas2 2.8 and 2.13 this functionality stopped working. Any assistance would be appreciated, thanks.. -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial Port Change Events Not Working after Upgrade to Karmic
Thanks for the suggestion Ricardo. I have already compiled G2.18 from source onto Ubuntu 9.04. The application was working fine on Ubuntu 9.04 with G2.8 but fails with G2.18, so this makes me think that there is a problem which may have been introduced between G2.8 and G2.13 (the binary on Ubuntu 9.10 which doesn't work). Regards, Tony.. Ricardo DÃaz MartÃn wrote: Tony, Try to compile gambas2 again. I got similar problem with apps after upgrade ubuntu from 9.04 yo 9.10 and it was necessary to do this: sudo apt-get install build-essential autoconf libbz2-dev libfbclient2 libmysqlclient15-dev unixodbc-dev libpq-dev libsqlite0-dev libsqlite3-dev libgtk2.0-dev libldap2-dev libcurl4-gnutls-dev libgtkglext1-dev libpcre3-dev libsdl-sound1.2-dev libsdl-mixer1.2-dev libsdl-image1.2-dev libsage-dev libxml2-dev libxslt1-dev libbonobo2-dev libcos4-dev libomniorb4-dev librsvg2-dev libpoppler-dev libpoppler-glib-dev libasound2-dev libesd0-dev libesd-alsa0 libdirectfb-dev libaa1-dev libxtst-dev libffi-dev kdelibs4-dev firebird2.1-dev libqt4-dev and after I downloaded gambas from source and compile again. Hope this works for you. Regards, Ricardo DÃaz 2009/12/1 Tony [1]ajw...@optusnet.com.au Hi, I have a Gambas2 application (gb.qt) checking for status change events on the CTS, RI and DSR signals (SerialPort-gb.net class) of a USB to serial converter (Prolific pl2303) which works fine on Ubuntu 9.04 (Gambas2 2.8 and kernel 2.6.28-16-generic 32bit). After upgrade to Ubuntu 9.10 (Gambas2 2.13 and kernel 2.6.31-15-generic 32bit) the status changes are no longer working. The serial port opens without error but no status change events are flagged. The problem is also evident in the serial port example on Ubuntu 9.10. I have compiled Gambas2 2.18 onto Ubuntu 9.04 but it still fails so my guess is that somewhere between Gambas2 2.8 and 2.13 this functionality stopped working. Any assistance would be appreciated, thanks.. -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. [2]http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list [3]gambas-u...@lists.sourceforge.net [4]https://lists.sourceforge.net/lists/listinfo/gambas-user -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. [5]http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list [6]gambas-u...@lists.sourceforge.net [7]https://lists.sourceforge.net/lists/listinfo/gambas-user References 1. mailto:ajw...@optusnet.com.au 2. http://p.sf.net/sfu/redhat-sfdev2dev 3. mailto:Gambas-user@lists.sourceforge.net 4. https://lists.sourceforge.net/lists/listinfo/gambas-user 5. http://p.sf.net/sfu/redhat-sfdev2dev 6. mailto:Gambas-user@lists.sourceforge.net 7. https://lists.sourceforge.net/lists/listinfo/gambas-user -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial Port Change Events Not Working aft er Upgrade to Karmic
Thanks for the suggestion Ricardo. I have already compiled G2.18 from source onto Ubuntu 9.04. The application was working fine on Ubuntu 9.04 with G2.8 but fails with G2.18, so this makes me think that there is a problem which may have been introduced between G2.8 and G2.13 (the binary on Ubuntu 9.10 which doesn't work). Regards, Tony.. You are right, and I think I understand what happens: I have noticed that SerialPort callback took too much CPU, because it was using polling on the serial port file descriptor. So I fixed it by awaken it only when there is some data to read... Mistake! I didn't understand that all DTRChange, DSRChange... events are not detected by the kernel. So Daniel (who wrote the code) had to use polling to be able to detect the changes. By removing the polling, I was able to raise the Read event without burning CPU, but all *Change events were not raised anymore! Now I have to find a good fix, but I have never used a serial port, so I need some enlightenment (no, I won't run E17...) - Why do you need detecting DTR,DSR... changes? - How are these events related to flow control and the FlowControl property? The last question is not innocent. the FlowControl property takes three different values: Hardware, Software, Both. I'm thinking adding a fourth value, None, that means the user does not care. In that specific case, I will not poll, and *Change events won't be raised. So you will be able to decide: - Setting FlowControl to None. You will get the Read event only, but you won't burn CPU power. - Setting FlowControl to any other value. You will get all events, but you will have to poll. This change would be compatible with the current SerialPort interface. Otherwise, for Gambas 3, maybe I will add a new property to define how much polling is needed. What do serial port people think about that? -- Benoît Minisini -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial Port Change Events Not Working after Upgrade to Karmic
Thanks Benoit and all for your speedy replies.. I'm using the serial port in a timing application with 3 laser through beam sensors feeding into the CTS, RI and DSR lines of the serial port. In this mode I don't pass any data, don't really care about flow control and am only interested in the raw status change events. Working this way I haven't noticed gross CPU utilisation after opening the port. The application also uses the UDPsocket to communicate remotely and what I have noticed is that if the serial port does not open correctly e.g. /dev/tty wrong and the UDPsocket is open, then there is a large amount of CPU used. Both open correctly and CPU normal. Can you tell me the polling frequency in Gambas2 2.8 ? I would assume that there ore other users of Gambas2 who are using the serial port as a convenient way of passing external events to the application, so maybe some input from them would also be in order. As long as there is a mechanism to replicate the Gambas2 2.8 functionality that I currently use, I'll leave the implementation up to those who know a lot more than myself. If going back to polling, a property to define the frequency would be nice. Thanks again, Tony. Benoît Minisini wrote: Thanks for the suggestion Ricardo. I have already compiled G2.18 from source onto Ubuntu 9.04. The application was working fine on Ubuntu 9.04 with G2.8 but fails with G2.18, so this makes me think that there is a problem which may have been introduced between G2.8 and G2.13 (the binary on Ubuntu 9.10 which doesn't work). Regards, Tony.. You are right, and I think I understand what happens: I have noticed that SerialPort callback took too much CPU, because it was using polling on the serial port file descriptor. So I fixed it by awaken it only when there is some data to read... Mistake! I didn't understand that all DTRChange, DSRChange... events are not detected by the kernel. So Daniel (who wrote the code) had to use polling to be able to detect the changes. By removing the polling, I was able to raise the Read event without burning CPU, but all *Change events were not raised anymore! Now I have to find a good fix, but I have never used a serial port, so I need some enlightenment (no, I won't run E17...) - Why do you need detecting DTR,DSR... changes? - How are these events related to flow control and the FlowControl property? The last question is not innocent. the FlowControl property takes three different values: Hardware, Software, Both. I'm thinking adding a fourth value, None, that means the user does not care. In that specific case, I will not poll, and *Change events won't be raised. So you will be able to decide: - Setting FlowControl to None. You will get the Read event only, but you won't burn CPU power. - Setting FlowControl to any other value. You will get all events, but you will have to poll. This change would be compatible with the current SerialPort interface. Otherwise, for Gambas 3, maybe I will add a new property to define how much polling is needed. What do serial port people think about that? -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] Serial Port Change Events Not Working after Upgrade to Karmic
Thanks Benoit and all for your speedy replies.. I'm using the serial port in a timing application with 3 laser through beam sensors feeding into the CTS, RI and DSR lines of the serial port. In this mode I don't pass any data, don't really care about flow control and am only interested in the raw status change events. Working this way I haven't noticed gross CPU utilisation after opening the port. The application also uses the UDPsocket to communicate remotely and what I have noticed is that if the serial port does not open correctly e.g. /dev/tty wrong and the UDPsocket is open, then there is a large amount of CPU used. Both open correctly and CPU normal. Can you tell me the polling frequency in Gambas2 2.8 ? I would assume that there ore other users of Gambas2 who are using the serial port as a convenient way of passing external events to the application, so maybe some input from them would also be in order. As long as there is a mechanism to replicate the Gambas2 2.8 functionality that I currently use, I'll leave the implementation up to those who know a lot more than myself. If going back to polling, a property to define the frequency would be nice. Thanks again, Tony. Can you try the revision #2454? I think I have found and fix another possible bug, and I'd like to be sure I didn't break anything. Regards, -- Benoît Minisini -- Join us December 9, 2009 for the Red Hat Virtual Experience, a free event focused on virtualization and cloud computing. Attend in-depth sessions from your desk. Your couch. Anywhere. http://p.sf.net/sfu/redhat-sfdev2dev ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] serial port.
Thanks. --- 19/10/09 Pzt tarihinde nando nand...@nothingsimple.com şöyle yazıyor: Kimden: nando nand...@nothingsimple.com Konu: Re: [Gambas-user] serial port. Kime: mailing list for gambas users gambas-user@lists.sourceforge.net Tarihi: 19 Ekim 2009 Pazartesi, 18:23 If you want to send a binary 37 to serial port Sport, then you can do any of these: 1. Print #Sport, %; 2. Print #Sport, Chr$(37); 3. S=Chr$(37) Write #Sport, S, 1 You do not have to 'convert' to binary. -Fernando -- Original Message --- From: abdurrahman ulusoy uluso...@yahoo.com To: mailing list for gambas users gambas-user@lists.sourceforge.net Sent: Sun, 18 Oct 2009 09:57:25 -0700 (PDT) Subject: [Gambas-user] serial port. hi i want to send data to serial port. when i send a number (for exam: 37) , what is writing gambas to seri port (100101 or 37) ? if gambas write (37) how can i convert decimaltobinary. (are there any module or command ? ___ [UTF-8?] Yahoo! Türkiye açıldı! http://yahoo.com.tr [UTF-8?] Ä°nternet üzerindeki en iyi içeriÄŸi Yahoo! Türkiye sizlere sunuyor! -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user --- End of Original Message --- -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user ___ Yahoo! Türkiye açıldı! http://yahoo.com.tr İnternet üzerindeki en iyi içeriği Yahoo! Türkiye sizlere sunuyor! -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
[Gambas-user] serial port.
hi i want to send data to serial port. when i send a number (for exam: 37) , what is writing gambas to seri port (100101 or 37) ? if gambas write (37) how can i convert decimaltobinary. (are there any module or command ? ___ Yahoo! Türkiye açıldı! http://yahoo.com.tr İnternet üzerindeki en iyi içeriği Yahoo! Türkiye sizlere sunuyor! -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] serial port
Salut, I tried to follow what you wrote, here you are the result. From the other side when working on it and waiting for a little longer time, I recognised that the program is not permanently frozen, after several 10 seconds it came back to normal. So at the end it's not so serious as expected. Regards, Robi So the 10 seconds freeze is during the close() system call. But I don't know how Linux handle serial ports well enough to understand why there is such a freeze. Maybe a deep google search could bring up some information about that? -- Benoît Minisini -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] serial port
Hello, At the end it works almost fine to try to open the serial port and if no error I suppose that it works. Now I try to use it. I do the same for ttyS0..S9. On the ttyS0 it finds the serial port correctly, on the S1, S3-S9 it finds out that there is no serial port. On the ttyS2 it finds something (no error when I open). I don't know what it is and no idea how to find out. For those where I found the port, I ask for the equipment ID to identify if it's there or not. OK for the S0, but the ttyS2 completely freeze and when I try to close the port there is no reaction. In such a case (TRY mySerialPort.close --- no response, no error message but the program frozen) is there any way to stop the process with a timeout or does anyone has an ide ho to handle it? Any help would be appreciated. Robi 2009/9/28 Robert JUHASZ robert1juh...@gmail.com thanks a lot !!! 2009/9/28 Werner wd...@netfront.net Robert JUHASZ wrote: Hello, One more question to the same project. It is a measurement program where the user can give equations for calculated quantities. Is there an easy way in Gambas to execute them? For example if I have a string (formula) of 2*3+6*(4-1) how can I calculate the result? Thanks, Robi with Eval Regards Werner PS: It is better to start a new thread for a new question. -- Come build with us! The BlackBerryreg; Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9#45;12, 2009. Register now#33; http://p.sf.net/sfu/devconf ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] serial port
Hello, At the end it works almost fine to try to open the serial port and if no error I suppose that it works. Now I try to use it. I do the same for ttyS0..S9. On the ttyS0 it finds the serial port correctly, on the S1, S3-S9 it finds out that there is no serial port. On the ttyS2 it finds something (no error when I open). I don't know what it is and no idea how to find out. For those where I found the port, I ask for the equipment ID to identify if it's there or not. OK for the S0, but the ttyS2 completely freeze and when I try to close the port there is no reaction. In such a case (TRY mySerialPort.close --- no response, no error message but the program frozen) is there any way to stop the process with a timeout or does anyone has an ide ho to handle it? Any help would be appreciated. Robi Apparently when closing a serial port, the gb.net component does not just call the close() system call. Can you break the frozen program with gdb and see where it is locked? $ gdb /usr/bin/gbx2 pid of frozen program ... (gdb) bt ... Send me the result of the 'bt' command. Regards, -- Benoît Minisini -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] serial port
Salut, I tried to follow what you wrote, here you are the result. From the other side when working on it and waiting for a little longer time, I recognised that the program is not permanently frozen, after several 10 seconds it came back to normal. So at the end it's not so serious as expected. Regards, Robi -- (gdb) bt #0 0xb7fe8430 in __kernel_vsyscall () #1 0xb786514c in __close_nocancel () from /lib/tls/i686/cmov/libpthread.so.0 #2 0xb691de2e in CloseSerialPort (fd=18, oldtio=0xa3037b8) at tools.c:353 #3 0xb6922850 in CSerialPort_stream_close (stream=0xa303718) at CSerialPort.c:261 #4 0x0805529d in STREAM_close (stream=0xa303718) at gbx_stream.c:180 #5 0x0804e8b0 in EXEC_call_native (exec=0x8065c73 CSTREAM_close, object=0xa303710, type=0, param=0x9f1d338) at gbx_exec.c:844 #6 0x0804f179 in EXEC_native () at gbx_exec.c:962 #7 0x0806bc90 in EXEC_loop () at gbx_exec_loop.c:1042 #8 0x0804f487 in EXEC_function_loop () at gbx_exec.c:703 #9 0x0804f75d in EXEC_function_real () at gbx_exec.c:690 #10 0x0805d5ef in raise_event (observer=value optimized out, object=0xa274c10, func_id=value optimized out, nparam=0) at gbx_api.c:490 #11 0x0805db45 in GB_Raise (object=0xa274c10, event_id=16, nparam=0) at gbx_api.c:594 #12 0xb726fa38 in gb_raise_button_Click (sender=0xa289ed8) at CButton.cpp:44 #13 0xb724e15e in gControl::emit (this=0x0, signal=0xb6924ff4) at gcontrol.cpp:1482 #14 0xb72535af in bt_click (object=0xa259c88, data=0xa289ed8) at gbutton.cpp:58 #15 0xb6c193a4 in g_cclosure_marshal_VOID__VOID () from /usr/lib/libgobject-2.0.so.0 #16 0xb6c0bc7b in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0 ---Type return to continue, or q return to quit--- #17 0xb6c21e57 in ?? () from /usr/lib/libgobject-2.0.so.0 #18 0xb6c234b9 in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0 #19 0xb6c23936 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0 #20 0xb6edcbda in gtk_button_clicked () from /usr/lib/libgtk-x11-2.0.so.0 #21 0xb6ede1f8 in ?? () from /usr/lib/libgtk-x11-2.0.so.0 #22 0xb6c193a4 in g_cclosure_marshal_VOID__VOID () from /usr/lib/libgobject-2.0.so.0 #23 0xb6c0a3d9 in ?? () from /usr/lib/libgobject-2.0.so.0 #24 0xb6c0bc7b in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0 #25 0xb6c216c0 in ?? () from /usr/lib/libgobject-2.0.so.0 #26 0xb6c234b9 in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0 #27 0xb6c23936 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0 #28 0xb6edcc7a in gtk_button_released () from /usr/lib/libgtk-x11-2.0.so.0 #29 0xb6edccb3 in ?? () from /usr/lib/libgtk-x11-2.0.so.0 #30 0xb6f97526 in ?? () from /usr/lib/libgtk-x11-2.0.so.0 #31 0xb6c0a3d9 in ?? () from /usr/lib/libgobject-2.0.so.0 #32 0xb6c0bc7b in g_closure_invoke () from /usr/lib/libgobject-2.0.so.0 #33 0xb6c21aff in ?? () from /usr/lib/libgobject-2.0.so.0 #34 0xb6c2334f in g_signal_emit_valist () from /usr/lib/libgobject-2.0.so.0 #35 0xb6c23936 in g_signal_emit () from /usr/lib/libgobject-2.0.so.0 #36 0xb70b22ae in ?? () from /usr/lib/libgtk-x11-2.0.so.0 #37 0xb6f8ff7c in gtk_propagate_event () from /usr/lib/libgtk-x11-2.0.so.0 #38 0xb6f91327 in gtk_main_do_event () from /usr/lib/libgtk-x11-2.0.so.0 - 2009/10/13 Benoît Minisini gam...@users.sourceforge.net Hello, At the end it works almost fine to try to open the serial port and if no error I suppose that it works. Now I try to use it. I do the same for ttyS0..S9. On the ttyS0 it finds the serial port correctly, on the S1, S3-S9 it finds out that there is no serial port. On the ttyS2 it finds something (no error when I open). I don't know what it is and no idea how to find out. For those where I found the port, I ask for the equipment ID to identify if it's there or not. OK for the S0, but the ttyS2 completely freeze and when I try to close the port there is no reaction. In such a case (TRY mySerialPort.close --- no response, no error message but the program frozen) is there any way to stop the process with a timeout or does anyone has an ide ho to handle it? Any help would be appreciated. Robi Apparently when closing a serial port, the gb.net component does not just call the close() system call. Can you break the frozen program with gdb and see where it is locked? $ gdb /usr/bin/gbx2 pid of frozen program ... (gdb) bt ... Send me the result of the 'bt' command. Regards, -- Benoît Minisini -- Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12,
Re: [Gambas-user] serial port
Hello, One more question to the same project. It is a measurement program where the user can give equations for calculated quantities. Is there an easy way in Gambas to execute them? For example if I have a string (formula) of 2*3+6*(4-1) how can I calculate the result? Thanks, Robi 2009/9/21 Mike mike.cr...@westnet.com.au Robert JUHASZ wrote: Useful info, I'll do like that. Thanks, Robi 2009/9/19 nando nand...@nothingsimple.com In my Linux serial port experience, serial port devices are named: /dev/ttyS0..9 and upwards /dev/ttyUSB0..9 and upwards depending on what is plugged in USB. I have done a lot of serial port stuff with Gambas. I know that trying to open then with the serial port control will fail is non-exising port. This error can be detected. It can be possible to open a port as a test to see if it exists, but you may be changing parameters and stealing chars from an existing connection. I've had this happen tooreally messes things up. -Fernando -- Original Message --- From: yuhej robert1juh...@gmail.com To: gambas-user@lists.sourceforge.net Sent: Fri, 18 Sep 2009 21:08:04 -0700 (PDT) Subject: [Gambas-user] serial port Hello, I can see that Gambas can handle the serial ports which is a very good news for me. Can someone tell me how can I get the list of the serial ports of my computer? I wish to make an autodetect function and only allow to select from the working serial ports. Robi -- View this message in context: http://www.nabble.com/serial-port-tp25518421p25518421.html Sent from the gambas-user mailing list archive at Nabble.com. -- Come build with us! The BlackBerryreg; Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9#45;12, 2009. Register now#33; http://p.sf.net/sfu/devconf ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user --- End of Original Message --- -- Come build with us! The BlackBerryreg; Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9#45;12, 2009. Register now#33; http://p.sf.net/sfu/devconf ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- Come build with us! The BlackBerryreg; Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9#45;12, 2009. Register now#33; http://p.sf.net/sfu/devconf ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user Is the list up. Mike -- Come build with us! The BlackBerryreg; Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9#45;12, 2009. Register now#33; http://p.sf.net/sfu/devconf ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- Come build with us! The BlackBerryreg; Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9#45;12, 2009. Register now#33; http://p.sf.net/sfu/devconf ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] serial port
Robert JUHASZ wrote: Hello, One more question to the same project. It is a measurement program where the user can give equations for calculated quantities. Is there an easy way in Gambas to execute them? For example if I have a string (formula) of 2*3+6*(4-1) how can I calculate the result? Thanks, Robi with Eval Regards Werner PS: It is better to start a new thread for a new question. -- Come build with us! The BlackBerryreg; Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9#45;12, 2009. Register now#33; http://p.sf.net/sfu/devconf ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] serial port
Robert JUHASZ wrote: Useful info, I'll do like that. Thanks, Robi 2009/9/19 nando nand...@nothingsimple.com In my Linux serial port experience, serial port devices are named: /dev/ttyS0..9 and upwards /dev/ttyUSB0..9 and upwards depending on what is plugged in USB. I have done a lot of serial port stuff with Gambas. I know that trying to open then with the serial port control will fail is non-exising port. This error can be detected. It can be possible to open a port as a test to see if it exists, but you may be changing parameters and stealing chars from an existing connection. I've had this happen tooreally messes things up. -Fernando -- Original Message --- From: yuhej robert1juh...@gmail.com To: gambas-user@lists.sourceforge.net Sent: Fri, 18 Sep 2009 21:08:04 -0700 (PDT) Subject: [Gambas-user] serial port Hello, I can see that Gambas can handle the serial ports which is a very good news for me. Can someone tell me how can I get the list of the serial ports of my computer? I wish to make an autodetect function and only allow to select from the working serial ports. Robi -- View this message in context: http://www.nabble.com/serial-port-tp25518421p25518421.html Sent from the gambas-user mailing list archive at Nabble.com. -- Come build with us! The BlackBerryreg; Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9#45;12, 2009. Register now#33; http://p.sf.net/sfu/devconf ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user --- End of Original Message --- -- Come build with us! The BlackBerryreg; Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9#45;12, 2009. Register now#33; http://p.sf.net/sfu/devconf ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- Come build with us! The BlackBerryreg; Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9#45;12, 2009. Register now#33; http://p.sf.net/sfu/devconf ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user Is the list up. Mike -- Come build with us! The BlackBerryreg; Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9#45;12, 2009. Register now#33; http://p.sf.net/sfu/devconf ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] serial port
Useful info, I'll do like that. Thanks, Robi 2009/9/19 nando nand...@nothingsimple.com In my Linux serial port experience, serial port devices are named: /dev/ttyS0..9 and upwards /dev/ttyUSB0..9 and upwards depending on what is plugged in USB. I have done a lot of serial port stuff with Gambas. I know that trying to open then with the serial port control will fail is non-exising port. This error can be detected. It can be possible to open a port as a test to see if it exists, but you may be changing parameters and stealing chars from an existing connection. I've had this happen tooreally messes things up. -Fernando -- Original Message --- From: yuhej robert1juh...@gmail.com To: gambas-user@lists.sourceforge.net Sent: Fri, 18 Sep 2009 21:08:04 -0700 (PDT) Subject: [Gambas-user] serial port Hello, I can see that Gambas can handle the serial ports which is a very good news for me. Can someone tell me how can I get the list of the serial ports of my computer? I wish to make an autodetect function and only allow to select from the working serial ports. Robi -- View this message in context: http://www.nabble.com/serial-port-tp25518421p25518421.html Sent from the gambas-user mailing list archive at Nabble.com. -- Come build with us! The BlackBerryreg; Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9#45;12, 2009. Register now#33; http://p.sf.net/sfu/devconf ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user --- End of Original Message --- -- Come build with us! The BlackBerryreg; Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9#45;12, 2009. Register now#33; http://p.sf.net/sfu/devconf ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- Come build with us! The BlackBerryreg; Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9#45;12, 2009. Register now#33; http://p.sf.net/sfu/devconf ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] serial port
Robert JUHASZ wrote: Useful info, I'll do like that. Thanks, Robi 2009/9/19 nando nand...@nothingsimple.com In my Linux serial port experience, serial port devices are named: /dev/ttyS0..9 and upwards /dev/ttyUSB0..9 and upwards depending on what is plugged in USB. I have done a lot of serial port stuff with Gambas. I know that trying to open then with the serial port control will fail is non-exising port. This error can be detected. It can be possible to open a port as a test to see if it exists, but you may be changing parameters and stealing chars from an existing connection. I've had this happen tooreally messes things up. -Fernando -- Original Message --- From: yuhej robert1juh...@gmail.com To: gambas-user@lists.sourceforge.net Sent: Fri, 18 Sep 2009 21:08:04 -0700 (PDT) Subject: [Gambas-user] serial port Hello, I can see that Gambas can handle the serial ports which is a very good news for me. Can someone tell me how can I get the list of the serial ports of my computer? I wish to make an autodetect function and only allow to select from the working serial ports. Robi -- View this message in context: http://www.nabble.com/serial-port-tp25518421p25518421.html Sent from the gambas-user mailing list archive at Nabble.com. -- Come build with us! The BlackBerryreg; Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9#45;12, 2009. Register now#33; http://p.sf.net/sfu/devconf ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user --- End of Original Message --- -- Come build with us! The BlackBerryreg; Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9#45;12, 2009. Register now#33; http://p.sf.net/sfu/devconf ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user -- Come build with us! The BlackBerryreg; Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9#45;12, 2009. Register now#33; http://p.sf.net/sfu/devconf ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user Hi, try the code below, I have no problems with the serial port. PRIVATE Sport AS SerialPort CONST None AS Integer = 0 PRIVATE Rx AS String PUBLIC SUB Form_Open() Sport = NEW SerialPort AS Sport Sport.PortName = /dev/ttyUSB0 Sport.Speed = 19200 Sport.Parity = 0 Sport.DataBits = 8 Sport.StopBits = 1 Sport.FlowControl = 0 TRY Sport.Open() IF ERROR THEN TRY Sport.PortName = /dev/ttyS0 Sport.Speed = 19200 Sport.Parity = 0 Sport.DataBits = 8 Sport.StopBits = 1 Sport.FlowControl = 0 Sport.Open() IF ERROR THEN Message( Onboard Uart Comm 1 not found -- PROGRAM TERMINATING) QUIT ENDIF ENDIF END ' Get RS232 data PUBLIC SUB Sport_Read() SLEEP 0.025 TRY READ #Sport, Rx, Lof(Sport) IF ERROR THEN GOTO NoRx ENDIF IF Len(Rx) 8 THEN ListBox1.Add(Rx) END IF NoRx: Rx = END PUBLIC SUB Form_Close() Sport.Close() QUIT END Regards Mike -- Come build with us! The BlackBerryreg; Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9#45;12, 2009. Register now#33; http://p.sf.net/sfu/devconf ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] serial port
In my Linux serial port experience, serial port devices are named: /dev/ttyS0..9 and upwards /dev/ttyUSB0..9 and upwards depending on what is plugged in USB. I have done a lot of serial port stuff with Gambas. I know that trying to open then with the serial port control will fail is non-exising port. This error can be detected. It can be possible to open a port as a test to see if it exists, but you may be changing parameters and stealing chars from an existing connection. I've had this happen tooreally messes things up. -Fernando -- Original Message --- From: yuhej robert1juh...@gmail.com To: gambas-user@lists.sourceforge.net Sent: Fri, 18 Sep 2009 21:08:04 -0700 (PDT) Subject: [Gambas-user] serial port Hello, I can see that Gambas can handle the serial ports which is a very good news for me. Can someone tell me how can I get the list of the serial ports of my computer? I wish to make an autodetect function and only allow to select from the working serial ports. Robi -- View this message in context: http://www.nabble.com/serial-port-tp25518421p25518421.html Sent from the gambas-user mailing list archive at Nabble.com. -- Come build with us! The BlackBerryreg; Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9#45;12, 2009. Register now#33; http://p.sf.net/sfu/devconf ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user --- End of Original Message --- -- Come build with us! The BlackBerryreg; Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9#45;12, 2009. Register now#33; http://p.sf.net/sfu/devconf ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
[Gambas-user] serial port
Hello, I can see that Gambas can handle the serial ports which is a very good news for me. Can someone tell me how can I get the list of the serial ports of my computer? I wish to make an autodetect function and only allow to select from the working serial ports. Robi -- View this message in context: http://www.nabble.com/serial-port-tp25518421p25518421.html Sent from the gambas-user mailing list archive at Nabble.com. -- Come build with us! The BlackBerryreg; Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9#45;12, 2009. Register now#33; http://p.sf.net/sfu/devconf ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user
Re: [Gambas-user] serial port
yuhej wrote: I can see that Gambas can handle the serial ports which is a very good news for me. Can someone tell me how can I get the list of the serial ports of my computer? I wish to make an autodetect function and only allow to select from the working serial ports. Robi I think you want /dev/ttyS0, ttyS1, etc... Also, I don't have a serial port on my laptop, but my USB to serial converter creates a device called /dev/ttyUSB0. All these devices are present on my system (Ubuntu latest), but I have no idea how to check if they are valid. Obviously, sending data to /dev/ttyS0 would do nothing on my laptop. You could setup handshaking routines to check and see if there's a device that can respond on all of those devices. Your device would have to be able to do hardware or software handshaking though. Other than that, it's out of my league. -- Come build with us! The BlackBerryreg; Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9#45;12, 2009. Register now#33; http://p.sf.net/sfu/devconf ___ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user