Sign up on the Revelation Software website to have access to the most current content, and to be able to ask questions and get answers from the Revelation community

At 14 JUL 2002 09:13:55AM dale walker wrote:

I would like to be able to send an ESC command to the printer from a rbasic program (graphics mode) and then send a string of information that was compiled (postnet code from zipcode).

I searched the search feature of this web site as well as the R/Basic manual 3.12 and the help screens. Obviously, I did not look in the right place so I come to you.

TIA

Dale


At 14 JUL 2002 10:36AM Richard Hunt wrote:

Dale,

This logic is from quite a few years ago, and it was for a dot matrix printer, Epson if I remember correctly.

1) To put the printer in graphics mode the code is CHAR(27):CHAR(75)

2) Then the low value of the two byte "postnet code" length.

3) Then the hi value of the two byte "postnet code" length.

4) Then the actual ASCII character postnet code.

I am not sure what you mean by "postnet code". If the code is ASCII character code, then the above will work perfectly.

To calculate the two byte (low hi) length you could use this formula…

LENGTH=LEN(POSTNET_CODE)

HI=INT(LENGTH / 256)

LOW=LENGTH - (HI * 256)

Then the print string would go as follows…

PRINT_STRING=CHAR(27):CHAR(75):CHAR(LOW):CHAR(HI):POSTNET_CODE

PRINT PRINT_STRING


At 14 JUL 2002 05:04PM [url=http://www.sprezzatura.com]The Sprezzatura Group[/url] wrote:

In addition to Richard's comments, review the use of the seq() function as the reverse of the char() function.

Here is a site that may assist with postnet fonts and codes

http://www.postnetfonts.com/

You may have problems getting these fonts to print on a dot matrix, depending on the sophistication. An LQ series Epson will usually be able to print using the ESC-P2 codes.

Basically, the printer escape codes can be imbedded in the print string. So your program will usually look something like this:

* direct print output to printer

PRINTER ON

* print form feed

PRINT CHAR(12)

* print desired character strings to obtain printer-specific font

PRINT CHAR(27):CHAR(x):CHAR(y):CHAR(z):

* print desired text

PRINT "This is my test text"

* turn printer off

PRINTER OFF

You may also use PDISK to redirect output to a file for review.

The Sprezzatura Group

World Leaders in all things RevSoft


At 15 JUL 2002 11:30AM dale walker wrote:

Gentlemen,

I appreciate the information. My question centers around the ability to send pin firing information via a string after the ESC sequence is sent to the printer via the print command.

By way of explanation, the postnet code is the barcode at the bottom of a mailing address.

Since there is no ascii character that will meet the requirements, I have to do it graphically, so to speak.

There is an ESC 'Char(27)' sequence that I can send to the printer. What I need to do next is be able to send the pin firing command to print the short and tall characters on my Epson LQ-1010 printer. For example the short character string would be 0,0,128 and the tall would be 0,64,255 while a space would be 0,0,0. I need to be able to send this information to the printer.

My question therefore is "After I send the ESC command via the PRINT command, will PRINT POSTNET accomplish what I want, Assuming that POSTNET is the is the name of the string that contains the data?

Dale


At 15 JUL 2002 01:27PM Richard Hunt wrote:

Dale,

Check this out. It might explain all.

http://files.support.epson.com/pdf/lq1010/lq1010u1.pdf

Otherwise, I could snip some code so you can get an idea.

See, Each pin in the print head is controlled by a graphics code. code 1 prints the bottom pin. Code 2 prints the next to bottom pin. All the way to 128 printing the top pin. Adding numbers together prints pins accordingly. so a short vertical bar would be like 7. and a tall vertical bar would be like 255. and no bar would be like 0.


At 15 JUL 2002 01:54PM dale walker wrote:

Right!

Now what would be the next AREV command to have the printer respond with the appropriate graphic (Tall bar, space, or short bar)? If I send a print command, I get 0,64,255,0,0,0….. rather than the tall bar, space, short bar….

I need the data sent to the printer so that the pins on the head respond appropriately,

Thanks

Dale


At 15 JUL 2002 02:51PM dale walker wrote:

Richard,

thanks for the link. I have that info in my Epson manual. Now How do I get the pin codes from AREV to my printer?

Thanks,

Dale


At 15 JUL 2002 03:40PM [url=http://www.sprezzatura.com]The Sprezzatura Group[/url] wrote:

Using your printer manual, page 4-15. Look for the trailing colons in the following example.

PRINTER ON

PRINT CHAR(27):"*":CHAR(32):CHAR(40):CHAR(0):

FOR X=1 TO 70

 PRINT CHAR(170)

NEXT X

PRINTER OFF

* the following bit isn't in your manual, but might produce

* some patterns which resemble barcodes. See page 4-18 in

* your printer manual for further details. At line 80 of

* that program it would be like PRINT CHAR(0):CHAR(0):CHAR(63): etc.

There is an ESC 'Char(27)' sequence that I can send to the printer. What I need to do next is be able to send the pin firing command to print the short and tall characters on my Epson LQ-1010 printer. For example the short character string would be 0,0,128 and the tall would be 0,64,255 while a space would be 0,0,0. I need to be able to send this information to the printer.

EXPENDABLE SUBROUTINE PRINT.LQ.BARCODE()

PRINTER ON

GOSUB INITIALIZEGRAPHICS

* the following sequence is completely arbitrary

GOSUB PRINTLONG

GOSUB PRINTSPACE

GOSUB PRINTSHORT

GOSUB PRINTLONG

GOSUB PRINTLONG

GOSUB PRINTSHORT

PRINTER OFF

RETURN

INITIALIZEGRAPHICS:

* as per page 4-18 of the manual

PRINT CHAR(27):"*":CHAR(32):CHAR(42):CHAR(0):

RETURN

PRINTLONG:

* NB trailing colon character is included

PRINT CHAR(0):CHAR(64):CHAR(255):

RETURN

PRINTSHORT:

PRINT CHAR(0):CHAR(0):CHAR(128):

RETURN

PRINTSPACE:

PRINT CHAR(0):CHAR(0):CHAR(0):

RETURN

We don't have an LQ-1010 handy to test on, we're afraid, but try entering this program into AREV and run it to see. Then experiment with changes to the above program to generate your desired barcodes.

The Sprezzatura Group

World Leaders in all things RevSoft


At 15 JUL 2002 04:08PM dale walker wrote:

Sprezz,

I saw this in the manual as a basic program. I will try this when I get home. I have two concerns though, First, each number requires five bars resulting in a total of 52 bars and 51 spaces for each 9 digit code. I also have a potential of 2 to 4000 addresses to run. I can work around the coding to handle the quantity.

I like the idea of printing char(x). This may be the answer to my question. I will post the results tonight.

Dale


At 15 JUL 2002 07:09PM dale walker wrote:

Folks,

The result is 111111111 which is the zipcode that I input. Also, I had it present on screen the information showing a cocantenated string Below is the routine. All I got was 3 ?'s. The first one is the character of the input statement. The other two are freebees.

The routine is as follows:

/* this is a subroutine that converts the zipcode info into a postnet code for

an epson printer. Updates will have to come as differnt printers are made

available.*/

* * get zipcode info *

print @(-1)

print @(10,4):"Input zipcode":

input zipcode,12

* * define variables and pin assignments *

* pin assignments

tall =char(0):char(15):char(255)

short=char(0):char(0):char(63)

space=char(0):char(0):char(0)

* number assignments

begin= tall:space

zero=tall:space:tall:space:short:space:short:space:short:space

one =short:space:short:space:short:space:tall:space:tall:space

two =short:space:short:space:tall:space:short:space:tall:space

three= short:space:short:space:tall:space:tall:space:short:space

four=short:space:tall:space:short:space:short:space:tall:space

five=short:space:tall:space:short:space:tall:space:short:space

six =short:space:tall:space:tall:space:short:space:short:space

seven= tall:space:short:space:short:space:short:space:tall:space

eight= tall:space:short:space:short:space:tall:space:short:space

nine=tall:space:short:space:tall:space:short:space:short:space

fini=tall

* * convert zipcode to postnet code *

postnet.code=zipcode

convert "-" to '' in postnet.code

len.postnet=len(postnet.code)

if len.postnet=9 then

  postnet.code=postnet.code:postnet.code7,7
  len.postnet+=1

end

*need to build the postnet.code using for..next

new.postnet='

for i=1 to len.postnet

  begin case
  case postnet.codei,i=0"
       if new.postnet=' then new.postnet=zero else new.postnet:=space:zero
  case postnet.codei,i=1
       if new.postnet=' then new.postnet=one else new.postnet:=space:one
  case postnet.codei,i=2
       if new.postnet=' then new.postnet=two else new.postnet:=space:two
  case postnet.codei,i=3
       if new.postnet=' then new.postnet=three else new.postnet:=space:three
  case postnet.codei,i=4
       if new.postnet=' then new.postnet=four else new.postnet:=space:four
  case postnet.codei,i=5
       if new.postnet=' then new.postnet=five else new.postnet:=space:five
  case postnet.codei,i=6
       if new.postnet=' then new.postnet=six else new.postnet:=space:six
  case postnet.codei,i=7
       if new.postnet=' then new.postnet=seven else new.postnet:=space:seven
  case postnet.codei,i=8
       if new.postnet=' then new.postnet=eight else new.postnet:=space:eight
  case postnet.codei,i=9
       if new.postnet=' then new.postnet=nine else new.postnet:=space:nine
  end case

next i

new.postnet=begin:space:new.postnet:space:fini

print "This is new.postnet: ":new.postnet

print "continue":; input q,2 ; if q=n' or q=N" then stop

* * define printer esc command *

* * print zipcode and postnet code *

printer on

*send the escape sequence - this needs more learning.

print zipcode

print char(27):char(42):char(32):char(103):char(0)

print new.postnet

print char(12)

printer off


At 15 JUL 2002 09:09PM [url=http://www.sprezzatura.com]The Sprezzatura Group[/url] wrote:

Dale,

Please email info@sprezzatura.com for further assistance.

The Sprezzatura Group

World Leaders in all things RevSoft

View this thread on the forum...

  • third_party_content/community/commentary/forums_nonworks/e7b539db857f906185256bf60048af70.txt
  • Last modified: 2023/12/28 07:40
  • by 127.0.0.1