I'm trying to define custom characters on thermal printer NCR 7199.
I used ESC/POS command
ESC & y c1 c2 x d1...dn
and it works fine. But this command can change only characters in range 32-126, and those characters are latin letters and common symbols.
I'd prefer to replace characters with codes 8E-8F, for example, but cannot do it using this command.
Is it possible? Or is there any other ESC/POS command for user-defined characters?
UPD.
It seems like a firmware update can fix this problem. Firmware version on our printer is v99.21, and I saw this in release notes:
v99.25 "based on v99.24"
1. Allowed User-defined characters defined range from 20H to FFH in 7199 Emulation mode
Another user-defined character setting command for Kanji is for printers that support the MBCS character set, which is not what you want.
FS 2
Define user-defined Kanji characters
However, although it is unclear whether NCR 7199 supports it, ESC/POS has the ability to customize the font of the user-defined code page rather than the individual characters.
Please refer to the contents of the following pages.
GS ( E <Function 7>
Copy the user-defined page
GS ( E <Function 8>
Define the data (column format) for the character code page
GS ( E <Function 9>
Define the data (raster format) for the character code page
GS ( E <Function 10>
Delete the data for the character code page
Problem solved by updating firmware.
After updating "Main Firmware" to v99.27 (it seems that version must be greater or equal v99.25) and changing Emulation mode to "NCR 7199" I was finally able to define characters in all range 20-FF.
Related
I am trying to print to a GT800 Zebra printer thru serial port.
I am using ZPL. I want to control the width which is fine in auto mode. To address that in the >^BC> command I am using Auto mode as no other size setting under ^BY works
Following is the code
^XA
^MMT
^PW831
^LL400
^LS0
^BY2,,76^FT225,141^BCN,76,Y,Y,N,A
^FD:RNIP29200082034^FS
^FO225,157^A#N,18,10,E:CAL002.FNT^FD26030-0892R^FS
^FO383,157^A#N,18,10,E:CAL002.FNT^FD08.01.20 12:00PM^FS
^FO225,187^A#N,18,10,E:CAL002.FNT^FDLAMP-DR RH^FS
^FO453,187^A#N,18,10,E:CAL002.FNT^FDXBA3^FS
^PQ1,0,0,Y
^XZ
There is a funny problem. If the ^BC mode = A then if three zeros come together gives issues for eg ABCD29200082034 it prints ABCD29200 and does not complete the barcode. But the other lines are getting printed. But if the data is ABCD29200182034 , there are no issues.
If BC mode = U then even if the code is ABCD29200182034 it prints 292001820347. Note 7 is added in the end.
I am clueless as to what is this issue. I remember facing this same issue in Honeywell printer too once.
Thanks
NOTE : I replaced the 000 with 111 and the problem persists.
ZPL Manual says the following
A= Automatic Mode :This analyzes the data sent and automatically determines the best packing method. The full ASCII character set can be used in the ^FD
statement — the printer determines when to shift subsets. A string of
four or more numeric digits causes an automatic shift to Subset C.
Note , it says a string of four or more numeric digits causes an automatic shift to subset C, but when the same string is 290010 it has no issues. I am really lost
I need to be able to print Hebrew characters on my Epson TM-T20ii. I am trying to get my printer to switch to character code page 36(PC862) using
ESC t36
for some reason the printer is switching to code page 3 and then printing the number 6.
Is there a way to let the printer know that the 6 is part of my command?
If you know of a different workaround please comment below.
Thanks
You are making a mistake, you aren't meant to replace n with an actual number.
The proper syntax in your case would be ←t$
Explanation: the manual says "ESC t n", n referring to the page sheet, however you don't replace n with a number rather with the ASCII character n, so in your example 36 = $ because $ is the 36th character on the ASCII table.
How can I search for control characters in unix ed(1)?
For example
ed somefile.log <<EOF
1,$s/.*\015//
w
q
EOF
doesn't work. Neither does \r. Obviously sed(1), awk(1) and other editors can do this, however ed has the very useful line move (m) command which is all I need within the bash script I am using.
I am able to accomplish what I want within the script by entering the control character directly (escaping it with C-v in vi, C-q in emacs for example), but this means that binary characters must be present in my otherwise printable text script.
ed Transport2SVN-W0177.log <<EOF
g/^M/s/.*^M//p
w
q
EOF
The ^M is actually character 0x0d.
ed doesn't provide any support for converting control characters.
The way you have found of inserting control-characters directly into the script (using Ctrl-V at the keyboard) is portable and it works.
It's possible that particular implementations of ed might support this, but it would not be portable.
I'm on German Windows 8.1 64Bit with gnuplot 4.6.5, using the svg terminal. If I plot datafiles that have big numbers, like "one million", gnuplot does not print a digit grouping sign.
For example, if my datafile has values in the order of one million, I want the numbers at the y-axis be displayed as 1.000.000 (with . being the group sign, not the decimal sign!), but gnuplot gives me just 1000000.
The option set decimalsign locale just changes the decimal sign (separator between whole number and fractional part, like 1+1/2 = 1,5 with , being the decimal sign). But neither setting decimalsign nor not calling this command at all shows digit grouping signs in the plot. I only get ugly 1000000 or 1500000 instead of 1.000.000 or 1.500.000.
I also tried
set decimal locale
set format y "%'f"
which just gives me at all tics the label "%'f", instead of the numbers! Each tic has just "%'f", again and again. It just prints the format string as is into the plot and no numbers at all. The console output is decimal_sign in locale is , which is correct for german locale, so gnuplot recognizes it correctly. In my control panel of Windows the thousand separator is set correctly to . and the decimal sign to , too.
Setting tic by tic by hand is no option. I.e. set ytics add ('1.000.000' 1e6) for dozenz of dozenz tics is no option for me.
How do I automatically get thousand separators in gnuplot?
That seems not to work on Windows. From the gnuplot documentation
Internationalization (locale settings): Gnuplot uses the C runtime library routine setlocale() to control locale-specific formatting of input and output number, times, and date strings. The locales available, and the level of support for locale features such as "thousands’ grouping separator", depend on the internationalization support provided by your individual machine.
And judging from questions like How can I add a thousands separator to a double in C on Windows? Printing integers with thousands separators in Windows using C it is not possible since the apostrophe in the format string is a Unix specialty and not a C standard.
I think there is no workaround to get this working on Windows with autoscaling.
For the records: The following script works fine on Linux:
set format "%'.0f"
set xrange [0:1e6]
plot x
Only ., , and are possible as separator (at least Linux). E.g. "french" gives a space:
set decimalsign locale "french" # thousand separator becomes ` `
set decimalsign "."
set format "%'.2f"; # `'` activates the thousand separator
pl [0:1e5] x
Not the most glamorous of solutions, especially if you've got a lot of tics but you could do something like
set ytics ("1.000.000" 1e6, "1.500.000" 1.5e6, etc.)
I'd be interested to hear of anything nicer!
Just for fun and feasibilty... If you absolutely need thousand separators, you can construct a workaround for Windows (with some complexity and limitations). Tested with gnuplot 5.2.6.
Basic recipe:
define a function which converts numbers into text with thousand separators.
set the tic labels yourself using text with thousand separators
place the tic labels by trying to "mimic" gnuplot's setting of tic labels. For this, use gnuplot's suggestions about the scaling by plotting to a dummy terminal first. For this, this post of #Christoph is very helpful.
Code:
### add thousand separators to tic labels for Windows
reset session
# settings for thousand separator
ts = "'" # thousand separator
ThousandSeparator(a,ts) = abs(a)>=1000 ? (TS_a=sprintf("%.0f",a), TS_b=strlen(TS_a), \
TS_c=strstrt(TS_a,'-')+1, TS_d=TS_c>1?'-':'', (sum[TS_i=TS_c:TS_b] \
(TS_d=((TS_b-TS_i)%3==0&&(TS_i<TS_b)?TS_d.TS_a[TS_i:TS_i].ts:TS_d.TS_a[TS_i:TS_i]),\
0), TS_d)) : sprintf("%g",a)
# settings for (auto-)tics
range(axis) = axis eq "y" ? abs(GPVAL_Y_MAX-GPVAL_Y_MIN) : abs(GPVAL_X_MAX-GPVAL_X_MIN)
power(axis) = 10.**int(sprintf("%.15e",range(axis))[strstrt(sprintf("%.15e",range(axis)),"e")+1:])
rangenorm(axis) =range(axis)/power(axis)
posns(axis) = 20.0 / rangenorm(axis)
tics(axis) = \
posns(axis)>40?0.05:posns(axis)>20?0.1:posns(axis)>10?0.2:posns(axis)>4? \
0.5:posns(axis)>2?1:posns(axis)>0.5?2:ceil(range(axis))
ticstep(axis) = tics(axis) * power(axis)
set xrange[0:1e6]
set terminal push # save current terminal
set terminal unknown
plot x lc rgb "web-green"
set terminal pop # restore terminal
# set xtics
do for [i=0:ceil(range("x")/ticstep("x"))+1] {
set xtics add (ThousandSeparator(GPVAL_X_MIN+i*ticstep("x"),"'") GPVAL_X_MIN+i*ticstep("x"))
}
# set ytics
do for [i=0:ceil(range("y")/ticstep("y"))+1] {
set ytics add (ThousandSeparator(GPVAL_Y_MIN+i*ticstep("y"),"'") GPVAL_Y_MIN+i*ticstep("y"))
}
replot
### end of code
Limitations:
if the begin of the axis (e.g. GPVAL_X_MIN) is not identical with the first tic label, the above procedure doesn't work (yet).
However, I haven't yet found the value which gnuplot sets as first tic value. There seems to be no GPVAL_... variable for this. Maybe it can be extracted somehow?
Example 1: (works ok)
set xrange[0:1e6]
Example 2: (doesn't work, because GPVAL_X_MIN=-50000 but first tic should be at 0)
set xrange[-50000:1e6]
This is a continuation of my older thread.
I have a file from different code, that I should parse to use as my input.
A snippet from it looks like:
GLOBAL SYSTEM PARAMETER
NQ 2
NT 2
NM 2
IREL 3
*************************************
BEXT 0.00000000000000E+00
SEMICORE F
LLOYD F
NE 32 0
IBZINT 2
NKTAB 936
XC-POT VWN
SCF-ALG BROYDEN2
SCF-ITER 29
SCF-MIX 2.00000000000000E-01
SCF-TOL 1.00000000000000E-05
RMSAVV 2.11362995016878E-06
RMSAVB 1.25411205586140E-06
EF 7.27534671479201E-01
VMTZ -7.72451391270293E-01
*************************************
And so on.
Currently I am reading it line by line, as:
Program readpot
use iso_fortran_env
Implicit None
integer ::i,filestat,nq
character(len=120):: rdline
character(10)::key!,dimension(:),allocatable ::key
real,dimension(:),allocatable ::val
i=0
open(12,file="FeRh.pot_new",status="old")
readline:do
i=i+1
read(12,'(A)',iostat=filestat) rdline!(i)
if (filestat /= 0) then
if (filestat == iostat_end ) then
exit readline
else
write ( *, '( / "Error reading file: ", I0 )' ) filestat
stop
endif
end if
if (rdline(1:2)=="NQ") then
read(rdline(19:20),'(i)'),nq
write(*,*)nq
end if
end do readline
End Program readpot
So, I have to read every line, manually find the value column corresponding to the key, and write that(For brevity, I have shown for one value only).
My question is, is this the proper way of doing this? or there is other simpler way? Kindly let me know.
If the file has no variability you scarcely need to parse it at all. Let's suppose that you have declared variables for all the interesting data items in the file and that those variables have the names shown on the lines of the file. For example
INTEGER :: nq , nt, nm, irel
REAL:: scf_mix, scf_tol ! '-' not allowed in Fortran names
CHARACTER(len=48) :: label, text
LOGICAL :: semicore, lloyd
! Complete this as you wish
Then write a block of code like this
OPEN(12,file="FeRh.pot_new",status="old")
READ(12,*) ! Not interested in the 1st line
READ(12,*) label, nq
READ(12,*) label, nt
READ(12,*) label, nm
READ(12,*) label, irel
READ(12,*) ! Not interested in this line
READ(12,*) label, bext
READ(12,*) label, semicore
! Other lines to write
CLOSE(12)
Fortran's list-directed input understands blanks in lines to separate values. It will not read those blanks as part of a character variable. That behaviour can be changed but in your case you don't need to. Note that it will also understand the character F to mean .false. when read into a logical variable.
My code snippet just ignores the labels and lines of explanation. If you are of a nervous disposition you could process them, perhaps
IF (label/='NE') STOP
or whatever you wish.