473,666 Members | 2,116 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Virtual Terminal Interfacing using RS232

1 New Member
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.CommPor t = 1
MSComm1.PortOpe n = 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 = "Trasmittin g request..."
SendBuffer = vbNullString

For Recur = 0 To 103
SendBuffer = SendBuffer & Chr(SendArray(R ecur))
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 1936

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

Similar topics

9
5717
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 me to export on the dll, I have no idea how to do that from c#. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/termserv/termserv/virtual_channel_client_dll.asp Thanks,
15
2696
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
5500
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 with: Public switchcom As New Rs232 switchcom.Open(2, 57600, 8, Rs232.DataParity.Parity_None, Rs232.DataStopBit.StopBit_1, 512)
23
4599
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
1034
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 '---------------------- '// Clear Tx/Rx Buffers moRS232.PurgeBuffer(Rs232.PurgeBuffers.TxClear Or Rs232.PurgeBuffers.RXClear) sTx = txtTx.Text
5
8658
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 communicate with the instrument . So kindly help me. Its completely educational purpose (no profit making) so reply soon..... awaitng expert reply.....................
5
21870
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 commands which I use to send an SMS to my email via Motorola 9505A. An error occurred after I press <Ctrl+Z> to execute the SMS. The message that I want to sent is: - "megat@geoid.biz testing from 9505A" Header of the message (pdu format) is: -
1
3158
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
965
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
8356
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8871
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8640
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6198
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5664
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4198
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4369
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2771
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.