473,406 Members | 2,439 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Virtual Terminal Interfacing using RS232

I am a Point of Sale Terminal Programmer/Developer and currently assigned to develop a VTI Simulator (Virtual Terminal Interface) than can exchange messages as per Specification through RS232-COM Port.

Using VB MSCOMM ActiveX control, I am managed to receive Data from POS Terminal but when i try to send data (Less than 100 Bytes) to POS terminal, it works but doesn't work for data more than 99 Bytes.

Following is the related coding part:

MSComm1 Design Time Property Setup
' InBufferSize = 1024
' OutBufferSize = 512
' RThreshold = 0
' SThreshold = 0
' InputLen = 0
' ParityReplace = "?"
' RTSEnable = False
' DTREnable = False
' NullDiscard = False
' Handshaking = 0
' InputMode = 0
' EOFEnable = False
' Setting = 9600,n,8,1


'Global Declaration'
Dim SendArray(255) As Variant
Dim SendBuffer As Variant

Private Sub Form_Activate()
MSComm1.CommPort = 1
MSComm1.PortOpen = True

'BalanceInq
'STX
SendArray(0) = CLng(&H2)
'LLLL
SendArray(1) = CLng(&H1)
SendArray(2) = CLng(&H0)
'Message Data
'Transport Header
SendArray(3) = CLng(&H36)
SendArray(4) = CLng(&H30)
'Transport Destination
SendArray(5) = CLng(&H30)
SendArray(6) = CLng(&H30)
SendArray(7) = CLng(&H30)
SendArray(8) = CLng(&H30)
'Transport Source
SendArray(9) = CLng(&H30)
SendArray(10) = CLng(&H30)
SendArray(11) = CLng(&H30)
SendArray(12) = CLng(&H30)
'Presentation Header
'Format Version
SendArray(13) = CLng(&H31)
'Request Indicator
SendArray(14) = CLng(&H30)
'Transaction Code
SendArray(15) = CLng(&H42)
SendArray(16) = CLng(&H31) 'B1-Pre Sale Authorization
'Response Code
SendArray(17) = CLng(&H30)
SendArray(18) = CLng(&H30)
'More Indicator
SendArray(19) = CLng(&H31)
'Field Separator
SendArray(20) = CLng(&H1C)
'Field Data Format
SendArray(21) = CLng(&H58)
SendArray(22) = CLng(&H33)
SendArray(23) = CLng(&H0)
SendArray(24) = CLng(&H8)
SendArray(25) = CLng(&H30)
SendArray(26) = CLng(&H35)
SendArray(27) = CLng(&H31)
SendArray(28) = CLng(&H31)
SendArray(29) = CLng(&H31)
SendArray(30) = CLng(&H31)
SendArray(31) = CLng(&H31)
SendArray(32) = CLng(&H31)
SendArray(33) = CLng(&H1C)

SendArray(34) = CLng(&H30)
SendArray(35) = CLng(&H33)
SendArray(36) = CLng(&H0)
SendArray(37) = CLng(&H6)
SendArray(38) = CLng(&H30)
SendArray(39) = CLng(&H38)
SendArray(40) = CLng(&H30)
SendArray(41) = CLng(&H33)
SendArray(42) = CLng(&H30)
SendArray(43) = CLng(&H35)
SendArray(44) = CLng(&H1C)

SendArray(45) = CLng(&H30)
SendArray(46) = CLng(&H34)
SendArray(47) = CLng(&H0)
SendArray(48) = CLng(&H6)
SendArray(49) = CLng(&H31)
SendArray(50) = CLng(&H32)
SendArray(51) = CLng(&H31)
SendArray(52) = CLng(&H32)
SendArray(53) = CLng(&H31)
SendArray(54) = CLng(&H32)
SendArray(55) = CLng(&H1C)

SendArray(56) = CLng(&H58)
SendArray(57) = CLng(&H30)
SendArray(58) = CLng(&H0)
SendArray(59) = CLng(&H8)
SendArray(60) = CLng(&H31)
SendArray(61) = CLng(&H31)
SendArray(62) = CLng(&H31)
SendArray(63) = CLng(&H31)
SendArray(64) = CLng(&H31)
SendArray(65) = CLng(&H31)
SendArray(66) = CLng(&H31)
SendArray(67) = CLng(&H31)
SendArray(68) = CLng(&H1C)

SendArray(69) = CLng(&H33)
SendArray(70) = CLng(&H30)
SendArray(71) = CLng(&H0)
SendArray(72) = CLng(&H16)
SendArray(73) = CLng(&H37)
SendArray(74) = CLng(&H30)
SendArray(75) = CLng(&H30)
SendArray(76) = CLng(&H30)
SendArray(77) = CLng(&H34)
SendArray(78) = CLng(&H36)
SendArray(79) = CLng(&H39)
SendArray(80) = CLng(&H39)
SendArray(81) = CLng(&H31)
SendArray(82) = CLng(&H30)
SendArray(83) = CLng(&H30)
SendArray(84) = CLng(&H31)
SendArray(85) = CLng(&H33)
SendArray(86) = CLng(&H32)
SendArray(87) = CLng(&H31)
SendArray(88) = CLng(&H30)
SendArray(89) = CLng(&H1C)

SendArray(90) = CLng(&H41)
SendArray(91) = CLng(&H32)
SendArray(92) = CLng(&H0)
SendArray(93) = CLng(&H2)
SendArray(94) = CLng(&H30)
SendArray(95) = CLng(&H31)
SendArray(96) = CLng(&H1C)

SendArray(97) = CLng(&H41)
SendArray(98) = CLng(&H32)
SendArray(99) = CLng(&H0)
SendArray(100) = CLng(&H1)
'SendArray(101) = CLng(&H30)
SendArray(102) = CLng(&H1C)

SendArray(103) = CLng(&H3)
SendArray(104) = CLng(&H0) 'BCD - CStr 'Normal - Val

For Recur = 2 To 102
LRC = LRC Xor SendArray(Recur)
Next

SendArray(103) = LRC
Label1.Caption = "Trasmitting request..."
SendBuffer = vbNullString

For Recur = 0 To 103
SendBuffer = SendBuffer & Chr(SendArray(Recur))
Next

MSComm1.Output = SendBuffer
ReceiveBuffer = MSComm1.Input

End Sub

Concluding: Within 99 Bytes of Data sent to POS Terminal, this code works perfect, Pls anyone help to let me understand, why this doesn't work for more data. (Nothing triggers on POS Terminal) My requirement is to send upto 250 Byte of Data.

Looking forward for the help.
Mar 5 '08 #1
0 1907

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: me | last post by:
I need to write the client part of a virtual channel for terminal services in c#. I have already done the server part and it works just fine in c#. My problem is exporting the function is requires...
15
by: Jim Hubbard | last post by:
Is it possible to emulate a monitor (create a virtual monitor) using vb.net? Any code snippets or pointers to helpful articles would be very much appreciated.
4
by: Dave Harry | last post by:
I found the RS232 class from MS's 101 VB samples. Writing to the port works fine. (I've got hyperterminal on the other comm port and a crossover cable between COM1 and COM2) The port is opened...
23
by: Dave Rahardja | last post by:
Since C++ is missing the "interface" concept present in Java, I've been using the following pattern to simulate its behavior: class Interface0 { public: virtual void fn0() = 0; };
0
by: Kean | last post by:
Hi gurus, I am facing a problem to send a 3 characters from my VB.net to LCD modules. I only able to get 1 character display on the LCD module. Dim sTx As String ...
5
by: itsme321 | last post by:
Hi I am from science background and learnt little bit of programming in C,Matlab,C#. My task in hand is to interface an instrument through RS 232. I am using the serialport class but not able to...
5
by: McGuard | last post by:
I am trying to send an SMS using hyper terminal in windows XP pro. I am connecting my Satellite Phone (Motorola Iridium 9505A) to my notebook via serial cable (RS232) . Below are the sample...
1
by: khizerbasith | last post by:
i need to interface vba in excel to interface it to rs232.need to send the message from the vba throught the rs232 port
0
by: Terry Reedy | last post by:
Devarajulu, Baskar (D.) wrote: asap3lib.py is not part of the stdlib, and the error message is not very informative. Look at line 320 and see what might trigger the error.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.