0

hi guys i am new to this so i want to know about this so plz help me ... i want to know that how can i send commands through hyperterminal to printer to print some text....it will be great help for me ...thank you guys... here i have written all the process ...

1)For sending any command / Data to printer you need to send it as protocol command and that to be sent out from serial or Ethernet port.

2) You need to send ESC ( 1B hex) as start of command and Eot ( 04 H ) as end of command for sending each command

3) In typical application you need to send the data to printer for printing and then monitor the no of prints printer has done. This can be achieved using following steps of commands a) Send message data with command ESC/S/002/ Data to be printed / Eot

b) Assign the message to printing with command ESC/P/1/002/Eot

c) Set print acknowledgement using command Esc/I/1/Z/Eot – With this we are setting “Z” character as flag. Whenever printer will print on product it will send “Z” through port as print acknowledgement. By tracking no of Z received no of products printed can be calculated**

on button click in asp.net web application we have to send this command to printer through hyper terminal..

so plz plz plz help me to get the solution of this.

  • Yes, homework can be tough sometimes. Is this a printer on the Server or on the Client? – H H Jul 21 '14 at 07:00
  • printer is on the Client side.... –  Jul 21 '14 at 07:44
  • And what kind of plugin were you thinking of? Asp.NET/C# can't access client ports. – H H Jul 21 '14 at 08:40
  • but Domino (Printer maker) has only provided a pdf file consist of all query fromat...even they didn't provide any .ddl file or sdk...and whatever they said i have mentioned in my query....so i would like to tell u i have to send command through our web based application to Industrial printers with the help of Hyper terminal till now the application will be installed in client side...so can u suugest me what should i choose because i don't know about the plugins what i have to choose so can u help me with this?? –  Jul 21 '14 at 09:24
  • sorry that's dll file –  Jul 21 '14 at 09:25
  • Can't help you with this, not enough information. What you want is very complicated in a Web app and will always require some preparation of the client PCs. Does it have to be Web? – H H Jul 21 '14 at 09:31
  • nope web app is not required but may i know will it be good to go for any other platform like windows form???? if yes then what should i do?? –  Jul 21 '14 at 09:44
  • Yes, WinForms should be good. Or WPF. Write a small test app to convincwe yourself. – H H Jul 21 '14 at 09:51
  • thank u so much brother...i have also made a windows form based application but my query is same how to send command through our application to Industrial printers with the help of Hyper terminal. –  Jul 21 '14 at 09:54
  • Not clear. Are you sure you need HyperTerminal? – H H Jul 21 '14 at 11:05
  • yep! hyper terminal is required ... –  Jul 22 '14 at 05:05

1 Answers1

0

You could try the following code which should verify that you can 'talk' to the device from VB

    Option Explicit
'
' Requires 2 multi line TextBoxes named txtSent and txtReceived
' one textbox named txtToSend
' CommandButton named cmdSend
'
Private Sub Form_Load()
txtSent.Text = vbNullString
txtReceived.Text = vbNullString
txtToSend.Text = vbNullString
'
' Configure the Port and send an Escape character to the device
'
With MSComm1
    .CommPort = 1
    .RThreshold = 1
    .Settings = "19200,n,8,1"
    .PortOpen = True
    .Output = Chr(27)
    txtSent.Text = "Escape" & vbNewLine
End With
End Sub

Private Sub cmdSend_Click()
'
' Send whatever is in txtToSend to the Device
'
If txtToSend <> vbNullString Then
    MSComm1.Output = txtToSend.Text & vbNewLine
    txtSent.Text = txtSent.Text & txtToSend.Text & vbNewLine
    txtToSend.Text = vbNullString
Else
    MsgBox "Enter a Command to Send to the Device"
End If
End Sub

Private Sub MSComm1_OnComm()
Dim strRx As String
Select Case MSComm1.CommEvent
    Case comEvReceive
        '
        ' Device has sent something. Add it to txtReceived
        '
        strRx = MSComm1.Input
        txtReceived.Text = txtReceived.Text & strRx
End Select
End Sub

Just type a command into txtToSend and click on cmdSend, you should see a response from the device in txtReceived