How to keep the text always in the center of the line on the LCD? - 8051

How to keep the text always in the center while putting other words on LCD like in MS Word using assembly? Thanks in advance.

Assuming it's a 16*2 Lcd, there are address associated with each character that you display on lcd which is given in the datasheet.
Usually, to set the cursor on start position of line 1, the command is 0x80 and it goes on, for 0x81 will move the cursor to next position on line 1 and last position on line one will have address 0x8F.
Similarly for second line, the address will range from 0xC0 to 0XCF.
This might help you in aligning the text in center of LCD.

Related

how correctly set the label positioned in the middle of the label with zpl code

My code is here:
http://staging.advanced-technology-group.com/?density=8&quality=grayscale&width=4&height=6&units=inches&index=0&zpl=%5EXA%0A%0A%5ECI28%0A%5ECWZ%2CE%3ATT0003M_.FNT%0A%5EFS%5EXZ%5EXA%5EFWN%5EFO70%2C50%5EA0%2C30%2C25%5EFH%5EFD_ce_8e%0A%5EFS%5EFO70%2C90%5EBY2%5EB3%2C%2C100%5EFDtestprodcuct%5EFS%5EXZ
The problem i face, is that i calibrate the zebra printer (gc 420t) with the following:
hold the feed button, the led blinks once, then twice, then i release the feed button.
Then i notice that half of the label is not printed. Given that i use the above offsets. What should one do? There are two ways to make the label print correctly. Either with the printer make it print the label in the middle, or with putting instead of 70, a larger value in the FS command. How would you suggest i should proceed? If i use the code, is there a command to use instead of FS, a command that would tell the printer to print the label in the middle of the paper?

How do I change the Zebra ZP 450 left position with OS X?

Please Help! I'm trying to print to a 1.5"x1.0" label on a Zebra ZP 450. The printer is connect to a Mac. When I print the label the printout is way over to the left. Only as small part of the bar code print out on the left side of the label. I'm guessing this is cause by the 'left position' in the printer settings. I tried calibrate (two flash and four flash) with no luck. I tried using zebrasetuputil app also with no luck (don't may not know enough of the programming to write it correctly).
Is there a terminal command I could use to change the default left position setting within the printer?
Sorry I'm new to all of this. Any help would be great!
OSX 10.11.1
Zebra ZP 450
Label Size: 1.5"x1.0"
Send this command to the printer:
^XA^LS0^XZ
^XA Starts the format (always required)
^LSa sets the offset where a = offset
^XZ End format (always required)
See the ZPL Programming Guide
Additionally, there is a command you can set to prevent other labels from setting these offsets. (Sorry, don't know off the top of my head) It's a very good idea because ideally these offset should only be used for printers that are exhibiting wear, and need an offset to account for physical differences.
Using it for label formats will cause all sorts of problems with label formats that don't set it, because the labels that do set it will cause the ones that don't to be offset.

Why does the text that is read in from a text file get turned into a black square and then the first letter?

The folder names should not have black squares for example the 'j' folder should actually be joshua.murray and not have a black square in front of it.
I was just wondering if anyone else has ever had this problem?
It's the unicode byte order mark (BOM). It a two or three byte header that says what type of unicode it is.
 ■K e i
is what a UTF 16 (notepad's unicode format) looks like as OEM in a command prompt.

ZPL Center text vertically

Is there a way in ZPL to center text vertically?
I know I can use ^FO0,0^ASN,50^FB200,3,0,C,0^FD TEXT ^FS. But how can I make that print on the 2nd line if it's short enough?
There isn't a vertical centering feature, but you can fake it, if you know in advance that your string is short enough to fit on the middle line.
Your ^FB defines a field block that is three lines. So your best option is to determine if your string fits on one line... and if it does, insert a "\&" before your string.
^FO0,0^ASN,50^FB200,3,0,C,0^FD\&TEXT^FS

Position of Text in a TextBox

Hi I have a textbox containing some text. I am looking to replicate the red spelling mistake squiggle type behaviour.
Using WinAPI I can
draw the squiggle between 2 points.
find out the height and width of
the word to be "squiggled".
What is the api call (or perhaps the methodology if it is more than a single api call) to find the position of that word in the text box so that I can position the sqiggle undeneath it.
Also, what are the messages I need to trap to ensure that the squiggle is redrawn. I'm currently only using WM_PAINT, which obviously isn't good enough.
EDIT (3 Sept 2012):
FYI, Here's where I got to so far. Needs a lot of refining but shows basic principles
https://gist.github.com/3607272
Many thx
S
What might work is using an auto-sized label. Make sure the fonts in the label and textbox are identical.
Detect the number of rows that are before the sentence containing the misspelled word.
Fill the label caption with the number linefeeds (vbcrlf) you got from question 1.
Append the words from the misspelled line (up to the misspelled word) to the labels caption.
The label size should now be identical with the beginning of the misspelled word.
Example text:
This is my first line.
And my second line.
And over here i have my mispeled word.
Label caption output should be (ignore the dots, they are empty lines):
.
.
And over here i have my
The labels height and width should match the position in the textbox, unless you have scrollbars. If the textbox has borders then you should add a fixed value to the height and width to get an exact match.

Resources