RS232 / Serial Support

Post

Posted
Rating:
#1 (In Topic #553)
Enthusiast
AndyGable is in the usergroup ‘Enthusiast’
 Hi all,

Does anyone know of a place i can read up on how to use Serial (Rs232) communication with Gambas?

I as As I have a Serial Barcode Reader and I would like to get the data from this and use it with in my Software (I would also need to get the weight from it as it is a scanner / scale like they use in the supermarkers)

Ideal I would like to have the serial scanner not linked to anything like a keypress (or a Do loop like I had to have in DOS)

any information or example website would be welcomed.
Online now: No Back to the top

Post

Posted
Rating:
#2
Avatar
Enthusiast
PJBlack is in the usergroup ‘Enthusiast’
https://gambas-buch.de…d=k24:k24.1:k24.1.5:start

( i will come back to you tomorrow … :( )
Online now: No Back to the top

Post

Posted
Rating:
#3
Avatar
Regular
sarpomira is in the usergroup ‘Regular’
I found this several months ago when working with Arduino communication.
Not mine.
This may help with your syntax and setup.

Code (gambas)

  1. Const None As Integer = 0
  2.  
  3. Public Sub Form_Open()
  4.   Sport = New SerialPort As "Sport"
  5.   Sport.PortName = "/dev/ttyACM0" 'Linux serial port to ttyUSB0
  6.   Sport.Speed = "9600"
  7.   Sport.Parity = 0
  8.   Sport.DataBits = "8"
  9.   Sport.StopBits = "1"
  10.   Sport.FlowControl = 0
  11.   Sport.Open()
  12.  
  13. Public Sub Sport_Read()
  14.  
  15.   Try Read #Sport, Rx, Lof(Sport)
  16.  
  17.     If Error Then
  18.       Goto NoRx
  19.     Endif
  20.    
  21.     RxLen = InStr(Rx, Chr(13))
  22.     LabelRxlen.Text = RxLen
  23.     ListBox1.Add(Rx)
  24.  
  25. NoRx:
  26.  
  27.   Rx = ""
  28.  

Please post your serial comm code if you get it working. There are not many working examples kicking around.
cheers
Online now: No Back to the top
1 guest and 0 members have just viewed this.