Search code examples
iosobjective-cprintinghexreceipt

Star micronics mpop iOS SDK - Save and print a character using the blank code page


I have the star micronics mpop. I have read the documentation (http://www.starmicronics.com/support/mannualfolder/starprnt_cm_en.pdf) Section 2-8 states that you can write to the blank code page. I have followed these instructions but I am still unable to get it to print as intended. I contacted support but they basically told me to use trial and error as they didn't know.

It always seems to prints a string of characters. Below is the sample code I am using, just for testing i'm sending a solid block for font A and zero data for font B.

[commands appendBytes:
         "\x1b\x1d\x3d\x00\x30"
         "\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00"
         "\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00"
         "\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00"
         "\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00"
         "\xff\x00\xff\x00\xff\x00\xff\x00"
         "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
         "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
         "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
         "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
         "\x00\x00\x00\x00\x00\x00\x00\x00"
         "\x1b\x1d\x74\xff\x80"
                                         length:sizeof("\x1b\x1d\x3d\x00\x30"
                                                         "\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00"
                                                         "\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00"
                                                         "\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00"
                                                         "\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00"
                                                         "\xff\x00\xff\x00\xff\x00\xff\x00"
                                                         "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
                                                         "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
                                                         "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
                                                         "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
                                                         "\x00\x00\x00\x00\x00\x00\x00\x00"
                                                         "\x1b\x1d\x74\xff\x80")-1];

Any help to get this working would be greatly appreciated.


Solution

  • I have finally managed to get this to work using the command ESC GS = n1 n2 da1 da2... to save a character and the command Esc % = n to print the character.

    The example below will save a character to position 7F on the blank code page. This should be done at the start of each app startup as it is stored in RAM, not NV.

    [commands appendBytes:
             "\x1b\x26\x01\x01\x7f" //Save the following to position 7F
             "\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00"
             "\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00"
             "\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00"
             "\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00"
             "\xff\x00\xff\x00\xff\x00\xff\x00" //end of character
             "\x1b\x25\x01\x7f" //Print the character
    length:sizeof("\x1b\x26\x01\x01\x7f"
             "\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00"
             "\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00"
             "\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00"
             "\xff\x00\xff\x00\xff\x00\xff\x00\xff\x00"
             "\xff\x00\xff\x00\xff\x00\xff\x00"
             "\x1b\x25\x01\x7f")-1];
    

    It is also a good idea to switch back to the normal code page after this otherwise you will have some weird side effects. This can be done using using the command Esc GS t n. Where n = 0.

    [commands appendBytes:
             "\x1b\x1d\x74\x00" //Switch back to normal code page
    length:sizeof("\x1b\x1d\x74\x00")-1];