Programming A Customer Pole Display in Visual Basic
I had come across a post in one of these forums here with codes, which I thought would sove my problem, but I was advised by Rhinobull to open a new thread. I hope I have posted this thread in the right forum.
I am developing an application using Microsoft Access 2000 with VBA codes behind the objects for managing retail sales in supermarkets and grocery stores. I have been searching for VBA codes to transmit data from one of my forms to a Pole Diplay. I have already installed vb 6.0 on my computer and placed MS.COMM Active X Control on the relevant Form for opening the Comm Port. In order to send an output to a Pole Display, I have written the following Code in the On Enter Event of the Text Box named ItemCode:
Dim mySales As String
If isNumeric(Me.TotalSales) then
mySales = Me.TotalSales 'TotalSales is a Visible Text
'box with Enabled Property
'set to No and Locked
'property set to Yes
Else
mySales = 0
End if
MsComm1.Output = Chr $(&H5) 'Scroll
MsComm1.Output = Chr $(&HA) 'Line Feed
MsComm1.Output = Chr $(&H13) 'Cursor on
MsComm1.Output = "TOTAL SALES " + mySales ' Displayed Data
MsComm1.Output = Chr $(&HD) ' Carrige return
As you may be aware, the Pole Display has two rows. when I enter data in my Form, the information is displayed in both lines. I would like the Displayed Data (in the Second Last line Above) to appear in the bottom row of the Pole Display. How Can I accomplish this task?
I shall be grateful to receive advise on a range of Visual Basic Codes I can use to programme the Pole Display to work efficiently. For instance, I need VBA Codes to Clear the Pole Display Screen, to Scroll the information up or left, to show data on the items in the upper row and to show data on total in the Lower Row of the Display
Please help. If possible, give me examples with VBA Codes covering at least the following four aspects:
1. A code for clearing the screen of the Pole Display
2. A code for scrolling data to the left of the Pole Display
3. A code for displaying data on the Upper Line of the Pole Display
4. A code for displaying data on the Lower Line of the Pole Display
The Pole Display has the following specifications:
1. CD5220
2. Serial Port (RS232C) communication
3. Selectable Baud rates 4800 or 9600
4. 40 characters (20 Columns X 2 lines)
The hardware was supplied with a users manual which has only hex codes. However, I am developing my application in Microsoft Access and I would like to place Visual Basic codes in the event procedures of some of the objects (Forms) to send commands to the Pole Display to perform the various functions.
Thanks in advance for your help.
Blessed2bless
Re: Programming A Customer Pole Display in Visual Basic
Hi B2B,
I don't quite understand what is your Pole Display, where and what type of app it is. Is it some kind of DOS application that you want to interact? Can it be substitute it with regular Windows GUI? And what does MS.COMM Active X Control have to with it? Please explain.
Few other things:
- do you have to develop in MS Access or you can "switch" to VB6
- there a VBA forums in case you want to continue in MS Access
- also, your VB code would look much more readable when wrapped with VBCODE tags
Re: Programming A Customer Pole Display in Visual Basic
The Application has been developed in Microsoft Access 2000. Basically it is a database with Tables, Queries, Forms, Reports and Modules written in Visual Basic for Applications (VBA).
Quote:
How does the MS Comm ActiveX Control come in here?
The Pole Display is connected to the computer through the Comm Port and in order for the data to pass through the Comm Port, you have to open it (the Comm Port) using commands, which require adding the ActiveX Comm Control to the Componetnts bar and dragging the Control on the relevant Form. I got this sample code shown here below for sending characters via the COM1 port at 9600 baud from the Logic Control website - http://www.logiccontrols.com/web/prodCustDtech.htm
Quote:
MSComm1.Comport=1 ‘ sets port variable to COM1
MSComm1.PortOpen=True ‘ opens the port for communication
MSComm1.Settings=”9600,N,8,1” ‘ sets the protocol to match the pole display
MSComm1.Output=Chr$(31)+Chr$(17) ' Reset & set normal display model MSComm1.Output=Chr$(67) ‘ sends a sample character to the pole display MSComm1.PortOpen=False ' closes the port
This is where I am stuck. I can open the Comm Port and send some data, but I can not clear the Pole Display screen or scroll the data in a given direction or display the specific data on different rows of the Pole Display.
I hope this clarifies the task I desire to accomplish.
Re: Programming A Customer Pole Display in Visual Basic
Can't you just send two blank lines to clear the display?
Re: Programming A Customer Pole Display in Visual Basic
Moved from COM and ActiveX
Re: Programming A Customer Pole Display in Visual Basic
You need to get the manual for the pole display that outlines the RS232
charactors it recognises.
Having done many rs232 comm projects, these device use special control charactors to get you to the next line or perform some task.
Re: Programming A Customer Pole Display in Visual Basic
As gtilles says, you need to find out if ther are special control characters to accomplish these tasks.
Otherwise, you may be able to simulate things,
e.g. to clear the display send 2 blank lines, or 2 lines of all spaces.
to simulate scrolling, you may be able to sequentially send programatically "scrolled" text.
e.g. I worked with a 2-line, 20 char/line LCD display once, each transmit had to be 2 fixed-length lines, so sending something like
Code:
"ABCDEFGHIJKLMNOPQRST"
" ABCDEFGHIJKLMNOPQRS"
" ABCDEFGHIJKLMNOPQR"
" ABCDEFGHIJKLMNOPQ"
" ABCDEFGHIJKLMNOP"
etc.
with delays between each, might work.
Have fun, DaveBo
Re: Programming A Customer Pole Display in Visual Basic
MSComm1.CommPort = 1 ' set port no
MSComm1.Settings = "9600,n,8,1"
MSComm1.InputLen = 0
On Error Resume Next
MSComm1.PortOpen = True
MSComm1.Output = msg ' set pole message
MSComm1.PortOpen = False