Avatar of prem13
prem13

asked on 

Powerbuilder 11.5

Can anybody provide some sample code for communication with serial port in powerbuilder 11.5...  I have to open,  read and close a card reader slot in Maxline Microplate reader

Thanks in advance
Editors IDEsProgramming

Avatar of undefined
Last Comment
Dirk Haest
Avatar of sandeep_patel
sandeep_patel
Flag of United States of America image

Prem,

Most of the card readers comes with their SDK and it should have OCX to communicate with Card Reader. If OCX is available from that card reader provider, you can look at the events and functions of that OCX for communication.

Otherwise you will have use either windows API or FileRead and FileWrite functions from powerbuilder to open, close and read serialport.

Refer to below link for more detail.

http://groups.google.com/group/sybase.public.powerbuilder.general/browse_thread/thread/f415f86060bfdd9e

http://www.topwizprogramming.com/freecode_ftpedit.html

Thanks,
Sandeep
Avatar of prem13
prem13

ASKER

Sandeep

Thanks for the mail.  In this case I don't have OCX to communicate with the reader and more over I have to deal with more than 2 models.

I tried as explained in the links but didn't succeed.  

Do u have any code examples of using these?

Thanks
Prem
Avatar of diasroshan
diasroshan
Flag of Kuwait image

Hi,

I have answered a similar question before. Please check the below link,
https://www.experts-exchange.com/questions/23448847/How-do-I-communicate-with-serial-port-in-PowerBuilder.html

Cheers,
Rosh
Avatar of prem13
prem13

ASKER

Rosh

Thanks for the link.. but I was confused on how to use it.. can u explain it?

Thanks
Prem
ASKER CERTIFIED SOLUTION
Avatar of diasroshan
diasroshan
Flag of Kuwait image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of prem13
prem13

ASKER

Rosh,

Thanks for the tips. It was helpful and appreciate it.
MSCOMM32.OCX is registred
The zip files are imported to my Library.
Before Reading or Writing to the serial port, I have to open/close the tray of the machine connected to the serial port.  For this the command need to pass to the serial port is CLS/OPN.  I tried with Hyper teminal and it is working fine.  But when this command is passed from powerbuilder as
ole_1.object.output=  "CLS" + char (26)  
nothing is happening

Can you put some thoughts on this.  

Thanks
Prem
Avatar of diasroshan
diasroshan
Flag of Kuwait image

Hi,

what tray are u refering to.
where did u get the syntax "CLS" + char (26)  

i could probably check the link and help convert the syntax.

Also, please change the zone of this question to PowerBuilder Programming Language

Cheers,
Rosh
Avatar of diasroshan
diasroshan
Flag of Kuwait image

Also, try one of the below combinations,

ole_1.object.output=  "CLS" + "~H11"+ "~H5A"  
or
ole_1.object.output=  "CLS" + "~H11"+ "Z"
Avatar of prem13
prem13

ASKER

Hi Rosh,

I got those commands from the Micro Plate reader help desk.  I am connecting this device to the serial port.  The operational procedure is ...
The device is having a tray where your can place the plate reader.  
Once the tray is slid into the machine (using the close (CLS) command), the read (RED) commant will read the plate.

On giving the open (OPN) command the tray will come out and the plate can be removed.

This can be done manually, (tried the operation with hyperterminal, it worked fine) but what I am trying to acheive is to get this done from the PB application we are having.

I do have a window to accept the baud, parity etc and once the user selects these from the dropdown and click on a button 'Process', it will trigger a user event thru which I am trying to do this.  Already defined the OCX control and the following code is there.  
-----------------------------------------------------------------------------------------
ole_1.Object.CommPort  = 1
ole_1.Object.Settings        = "9600,N,8,1"
//open the port
ole_1.Object.InputLen       = 0
ole_1.Object.InputMode       = 0
If Not ole_1.object.portopen Then
           ole_1.object.portopen = TRUE
End if      

ole_1.object.RThreshold = 10
ole_1.object.output =  "baud=9600 parity=N data=8 stop=1"

ole_1.object.output=  "CLS" + char (26)
------------------------------------------------------
But it is not closing the tray which is the first step.

I tried the commands you asked me to try and was given an error - "Error C0065: Invalid ~ hex character sequence in string"

Hope you got the scenario.  Appreciate your effort and  the time you are taking to help me out.

Thanks
Prem
Avatar of prem13
prem13

ASKER

Hi Rosh,

I tried the commands you asked me to try and was given an error - "Error C0065: Invalid ~ hex character sequence in string".  I was able to get the error corrected by  changing it to

ole_1.object.output=  "CLS" + "~h11"+ "~h5a"  
or
ole_1.object.output=  "CLS" + "~h11"+ "z"

so the compilation did went thru without errors.  But on run nothing came up (the tray remained open.

Thanks
Prem
Avatar of Dirk Haest
Dirk Haest
Flag of Belgium image

This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
Programming
Programming

Programming includes both the specifics of the language you’re using, like Visual Basic, .NET, Java and others, but also the best practices in user experience and interfaces and the management of projects, version control and development. Other programming topics are related to web and cloud development and system and hardware programming.

55K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo