kapiaba Posted April 9, 2014 Report Share Posted April 9, 2014 Buenas Galera, ajuada ahi: Como converter comandos ASC em Basic, para ASC do Five? Sample Program (Basic) PRINT #1, CHR$(&H1B);"@"; 'Initializes the printer (ESC @) PRINT #1, CHR$(&H1B);"a";CHR$(1);'Specifies a centered printing position (ESC a) PRINT #1, CHR$(&H1B);"!";CHR$(0); 'Specifies font A (ESC !) PRINT #1, "January 14, 2002 15:00"; PRINT #1, CHR$(&H1B);"d";CHR$(3); 'Prints and 3 line feeding (ESC d) PRINT #1, CHR$(&H1B);"a";CHR$(0); 'Selects the left print position (ESC a) PRINT #1, CHR$(&H1B);"!";CHR$(1); 'Selects font B PRINT #1, "TM-U210B $20.00";CHR$(&HA); PRINT #1, "TM-U210D $21.00";CHR$(&HA); PRINT #1, "PS-170 $17.00";CHR$(&HA); PRINT #1, CHR$(&HA); 'Line feeding (LF) PRINT #1, CHR$(&H1B);"!";CHR$(17); 'Selects double-height mode PRINT #1, "TOTAL $58.00"; CHR$(&HA); PRINT #1, CHR$(&H1B);"!";CHR$(0); 'Cancels double-height mode PRINT #1, "------------------------------";CHR$(&HA); PRINT #1, "PAID $60.00";CHR$(&HA); PRINT #1, "CHANGE $ 2.00";CHR$(&HA); PRINT #1, CHR$(&H1D);"V";CHR$(66);CHR$(0); 'Feeds paper & cut ’Drawer Kick (ESC p) PRINT #1, CHR$(&H1B); CHR$(&H70); CHR$(&H0); CHR$(60); CHR$(120); Quote Link to comment Share on other sites More sharing options...
vagner Posted April 9, 2014 Report Share Posted April 9, 2014 Fala Kapi,o H1B - é o 27CHR(27)+"@" kapiaba 1 Quote Link to comment Share on other sites More sharing options...
kapiaba Posted April 9, 2014 Author Report Share Posted April 9, 2014 E esse Vagner: CHR$(&H1D) Tem alguma tabela para a gente saber? abs, Quote Link to comment Share on other sites More sharing options...
vagner Posted April 9, 2014 Report Share Posted April 9, 2014 Olá Kapi,Se não me engano o &H significa Hexadecimal, então provavelmente se eu não estiver errado,. seria Chr(29) Quote Link to comment Share on other sites More sharing options...
vagner Posted April 9, 2014 Report Share Posted April 9, 2014 Antes que pergunte CHR$(&HA) = Chr(10) - Line Feed Quote Link to comment Share on other sites More sharing options...
kapiaba Posted April 9, 2014 Author Report Share Posted April 9, 2014 Vagner, tem como fazer algo assim em five? c Consegue? abs. '************************************** ' Name: ASCII_TO_EBCDIC ' Description:Convert ASCII strings into ' EBCDIC code to upload into an IBM mainfr ' ame. This code may be used also as a bas ' ic encrypting method. Both ASCII to EBCD ' IC and EBCDIC to ASCII are included in t ' his code. ' By: Aldo Vargas ' ' ' Inputs:None ' ' Returns:None ' 'Assumes:None ' 'Side Effects:None 'This code is copyrighted and has limite ' d warranties. 'Please see http://www.Planet-Source-Cod ' e.com/xq/ASP/txtCodeId.5902/lngWId.1/qx/ ' vb/scripts/ShowCode.htm 'for details. '************************************** Function ascii_to_ebcdic(ByVal buffer As String) As String Dim ascii As Variant Dim i As Long, bufferlen As Long ascii = Array( _ &H0, &H1, &H2, &H3, &H37, &H2D, &H2E, &H2F, &H16, &H5, &H25, &HB, &HC, &HD, &HE, &HF, _ &H10, &H11, &H12, &H13, &H3C, &H3D, &H32, &H26, &H18, &H19, &H3F, &H27, &H1C, &H1D, &H1E, &H1F, _ &H40, &H4F, &H7F, &H7B, &H5B, &H6C, &H50, &H7D, &H4D, &H5D, &H5C, &H4E, &H6B, &H60, &H4B, &H61, _ &HF0, &HF1, &HF2, &HF3, &HF4, &HF5, &HF6, &HF7, &HF8, &HF9, &H7A, &H5E, &H4C, &H7E, &H6E, &H6F, _ &H7C, &HC1, &HC2, &HC3, &HC4, &HC5, &HC6, &HC7, &HC8, &HC9, &HD1, &HD2, &HD3, &HD4, &HD5, &HD6, _ &HD7, &HD8, &HD9, &HE2, &HE3, &HE4, &HE5, &HE6, &HE7, &HE8, &HE9, &H4A, &HE0, &H5A, &H5F, &H6D, _ &H79, &H81, &H82, &H83, &H84, &H85, &H86, &H87, &H88, &H89, &H91, &H92, &H93, &H94, &H95, &H96, _ &H97, &H98, &H99, &HA2, &HA3, &HA4, &HA5, &HA6, &HA7, &HA8, &HA9, &HC0, &H6A, &HD0, &HA1, &H7, _ &H20, &H21, &H22, &H23, &H24, &H15, &H6, &H17, &H28, &H29, &H2A, &H2B, &H2C, &H9, &HA, &H1B, _ &H30, &H31, &H1A, &H33, &H34, &H35, &H36, &H8, &H38, &H39, &H3A, &H3B, &H4, &H14, &H3E, &HE1, _ &H41, &H42, &H43, &H44, &H45, &H46, &H47, &H48, &H49, &H51, &H52, &H53, &H54, &H55, &H56, &H57, _ &H58, &H59, &H62, &H63, &H64, &H65, &H66, &H67, &H68, &H69, &H70, &H71, &H72, &H73, &H74, &H75, _ &H76, &H77, &H78, &H80, &H8A, &H8B, &H8C, &H8D, &H8E, &H8F, &H90, &H9A, &H9B, &H9C, &H9D, &H9E, _ &H9F, &HA0, &HAA, &HAB, &HAC, &HAD, &HAE, &HAF, &HB0, &HB1, &HB2, &HB3, &HB4, &HB5, &HB6, &HB7, _ &HB8, &HB9, &HBA, &HBB, &HBC, &HBD, &HBE, &HBF, &HCA, &HCB, &HCC, &HCD, &HCE, &HCF, &HDA, &HDB, _ &HDC, &HDD, &HDE, &HDF, &HEA, &HEB, &HEC, &HED, &HEE, &HEF, &HFA, &HFB, &HFC, &HFD, &HFE, &HFF) bufferlen = Len(buffer) For i = 1 To bufferlen Mid$(buffer, i, 1) = Chr$(ascii(Asc(Mid$(buffer, i, 1)))) Next ascii_to_ebcdic = buffer End Function Function ebcdic_to_ascii(ByVal buffer As String) As String Dim ebcdic As Variant Dim i As Long, bufferlen As Long ebcdic = Array( _ &H0, &H1, &H2, &H3, &H9C, &H9, &H86, &H7F, &H97, &H8D, &H8E, &HB, &HC, &HD, &HE, &HF, _ &H10, &H11, &H12, &H13, &H9D, &H85, &H8, &H87, &H18, &H19, &H92, &H8F, &H1C, &H1D, &H1E, &H1F, _ &H80, &H81, &H82, &H83, &H84, &HA, &H17, &H1B, &H88, &H89, &H8A, &H8B, &H8C, &H5, &H6, &H7, _ &H90, &H91, &H16, &H93, &H94, &H95, &H96, &H4, &H98, &H99, &H9A, &H9B, &H14, &H15, &H9E, &H1A, _ &H20, &HA0, &HA1, &HA2, &HA3, &HA4, &HA5, &HA6, &HA7, &HA8, &H5B, &H2E, &H3C, &H28, &H2B, &H21, _ &H26, &HA9, &HAA, &HAB, &HAC, &HAD, &HAE, &HAF, &HB0, &HB1, &H5D, &H24, &H2A, &H29, &H3B, &H5E, _ &H2D, &H2F, &HB2, &HB3, &HB4, &HB5, &HB6, &HB7, &HB8, &HB9, &H7C, &H2C, &H25, &H5F, &H3E, &H3F, _ &HBA, &HBB, &HBC, &HBD, &HBE, &HBF, &HC0, &HC1, &HC2, &H60, &H3A, &H23, &H40, &H27, &H3D, &H22, _ &HC3, &H61, &H62, &H63, &H64, &H65, &H66, &H67, &H68, &H69, &HC4, &HC5, &HC6, &HC7, &HC8, &HC9, _ &HCA, &H6A, &H6B, &H6C, &H6D, &H6E, &H6F, &H70, &H71, &H72, &HCB, &HCC, &HCD, &HCE, &HCF, &HD0, _ &HD1, &H7E, &H73, &H74, &H75, &H76, &H77, &H78, &H79, &H7A, &HD2, &HD3, &HD4, &HD5, &HD6, &HD7, _ &HD8, &HD9, &HDA, &HDB, &HDC, &HDD, &HDE, &HDF, &HE0, &HE1, &HE2, &HE3, &HE4, &HE5, &HE6, &HE7, _ &H7B, &H41, &H42, &H43, &H44, &H45, &H46, &H47, &H48, &H49, &HE8, &HE9, &HEA, &HEB, &HEC, &HED, _ &H7D, &H4A, &H4B, &H4C, &H4D, &H4E, &H4F, &H50, &H51, &H52, &HEE, &HEF, &HF0, &HF1, &HF2, &HF3, _ &H5C, &H9F, &H53, &H54, &H55, &H56, &H57, &H58, &H59, &H5A, &HF4, &HF5, &HF6, &HF7, &HF8, &HF9, _ &H30, &H31, &H32, &H33, &H34, &H35, &H36, &H37, &H38, &H39, &HFA, &HFB, &HFC, &HFD, &HFE, &HFF) bufferlen = Len(buffer) For i = 1 To bufferlen Mid$(buffer, i, 1) = Chr$(ebcdic(Asc(Mid$(buffer, i, 1)))) Next ebcdic_to_ascii = buffer End Function Quote Link to comment Share on other sites More sharing options...
emotta Posted April 9, 2014 Report Share Posted April 9, 2014 Abra a calculadora do windows, coloque ela sendo PROGRAMADOR, coloque em modo HEXA, e ai digite o numero hexa que deseja e depois coloque em modo DECIMAL. Quote Link to comment Share on other sites More sharing options...
emotta Posted April 9, 2014 Report Share Posted April 9, 2014 veja imagem kapiaba 1 Quote Link to comment Share on other sites More sharing options...
kapiaba Posted April 9, 2014 Author Report Share Posted April 9, 2014 Valew() Eduardo, entendi. Agora é possivel, converter. Obg. abs. Quote Link to comment Share on other sites More sharing options...
sambomb Posted April 11, 2014 Report Share Posted April 11, 2014 HexToDec( ) -> Converte o texto hexadecimal para decimal Quote Link to comment Share on other sites More sharing options...
emotta Posted April 11, 2014 Report Share Posted April 11, 2014 Boa idéia, poderia fazer assim: HexChr("H1B") //CHR$(&H1B) Function HexChr(cHex) Return Chr(Val(Substr(cHex,2))) ou HexChr("1B") // CHR$(&H1B) Function HexChr(cHex) Return Chr(Val(cHex,2)) HexToDec( ) -> Converte o texto hexadecimal para decimal kapiaba 1 Quote Link to comment Share on other sites More sharing options...
sambomb Posted April 11, 2014 Report Share Posted April 11, 2014 Boa idéia, poderia fazer assim: HexChr("H1B") //CHR$(&H1B) Function HexChr(cHex) Return Chr(Val(Substr(cHex,2))) ou HexChr("1B") // CHR$(&H1B) Function HexChr(cHex) Return Chr(Val(cHex,2)) Function HexChr(cHex) Return HexToDec( SubStr(cHex,3)) ) //CHR$(&H1B) ? HexChr("&H1B") //-- 27 kapiaba 1 Quote Link to comment Share on other sites More sharing options...
kapiaba Posted April 11, 2014 Author Report Share Posted April 11, 2014 Function HexChr(cHex) Return HexToDec( SubStr(cHex,3)) ) //CHR$(&H1B) ? HexChr("&H1B") //-- 27 ceis são os caras.. vou testar, assim que possivel. obg. abs. Quote Link to comment Share on other sites More sharing options...
kapiaba Posted April 14, 2014 Author Report Share Posted April 14, 2014 Uma idéia do Daniel Garcia, mas não é bem o que eu queria... Mas ficou legal. http://forums.fivetechsupport.com/viewtopic.php?f=6&t=28302 Obg. Abs. Quote Link to comment Share on other sites More sharing options...
Daniel Garcia-Gil Posted April 14, 2014 Report Share Posted April 14, 2014 Hola como te comenta Vagner es la solucion al topic CHR(0x1B)+"@" // 'Initializes the printer (ESC @) CHR(0x1B)+"a"+CHR$(0x01) // 'Specifies a centered printing position (ESC a) CHR(0x1B)+"!"+CHR$(0x00) // 'Specifies font A (ESC !) ... kapiaba 1 Quote Link to comment Share on other sites More sharing options...
kapiaba Posted April 14, 2014 Author Report Share Posted April 14, 2014 Hola como te comenta Vagner es la solucion al topic CHR(0x1B)+"@" // 'Initializes the printer (ESC @) CHR(0x1B)+"a"+CHR$(0x01) // 'Specifies a centered printing position (ESC a) CHR(0x1B)+"!"+CHR$(0x00) // 'Specifies font A (ESC !) ... Gracias Daniel. Salu2 Quote Link to comment Share on other sites More sharing options...
vagner Posted April 14, 2014 Report Share Posted April 14, 2014 Kapi,Troque o &H... para 0x... e use como o Daniel, disse Chr(0x...) kapiaba 1 Quote Link to comment Share on other sites More sharing options...
emotta Posted April 14, 2014 Report Share Posted April 14, 2014 aprendi mais uma... excelente ! kapiaba 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.