硬汉嵌入式论坛

 找回密码
 立即注册
查看: 600|回复: 2
收起左侧

思普瑞特L36打印机

[复制链接]

16

主题

22

回帖

70

积分

初级会员

积分
70
发表于 2023-10-28 17:47:47 | 显示全部楼层 |阅读模式
有没有人用过思普瑞特L36便携打印机,可编程的,可以使用蓝牙,WiFi和USB连接通信,我是用蓝牙连接,目前连接是没问题,通过蓝牙发送数据,打印一些基本的汉字,以及设置汉字的格式等都可以,但是如何打印线条,二维码,条形码呢,按照那个编程手册,打印机一点反应都没有,求助求助!!!
回复

使用道具 举报

1万

主题

6万

回帖

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
106997
QQ
发表于 2023-10-28 17:49:19 | 显示全部楼层
没用过,看看坛友有用过的没
回复

使用道具 举报

16

主题

22

回帖

70

积分

初级会员

积分
70
 楼主| 发表于 2023-11-17 18:26:51 | 显示全部楼层
eric2013 发表于 2023-10-28 17:49
没用过,看看坛友有用过的没

void converToPrintInstruction(uint16_t decimalData[],uint8_t size)
{
    static uint16_t Remember_Data = 0;
    static uint8_t flag = 0;
    //static uint8_t DataSendPrintf[100] = {0};
    //uint8_t *DataSendPrintf = (uint8_t*)MemMalloc(1000*sizeof(uint8_t));
    uint16_t i = 0, j = 0, decimalValue = 0, m_g = 0;
    uint16_t buwei = 0;
    uint8_t binaryData[358] = {0};
    uint16_t position[NUMBER_DATA] = {0};
    if(size >= NUMBER_DATA)
    {
        //printf("Error:Input data Number error.\n");
        return;
    }
    if(flag != 0)return;
   // DataSendPrintf = (uint8_t*)MemMalloc(1000*sizeof(uint8_t));
    for(m_g = 0; m_g < size; m_g++)
    {
        if(decimalData[m_g] < 0 || decimalData[m_g] > 4096)
        {
            //printf("Error:Input data out of range.\n");
            return;
        }
        for(i = 0; i < 384; i++)
        {
            binaryData = 0;
        }

        position[m_g] = decimalData[m_g] * 384 / 4096;
        binaryData[position[m_g]] = 1;

        if(m_g >= 1)
        {
            if(position[m_g] != position[m_g-1])
            {
                if(position[m_g] > position[m_g-1])
                {
                    buwei = position[m_g] - position[m_g-1];
                    for(i = 1; i <= buwei; i++)
                    {
                        binaryData[position[m_g]-i] = 1;
                    }
                }
                else
                {
                    buwei = position[m_g-1] - position[m_g];
                    for(i = 1; i <= buwei; i++)
                    {
                        binaryData[position[m_g]+i] = 1;
                    }
                }
            }
            else
            {
                if(decimalData[m_g] != decimalData[m_g-1])
                {
                   if(decimalData[m_g] > decimalData[m_g-1])
                   {
                      binaryData[position[m_g]+1] = 1;
                   }
                   else
                   {
                      binaryData[position[m_g]-1] = 1;
                   }
                }
            }
        }
        //printf("1630 ");
        #if 0
        *BlueSendPrintfer.SendData = 0x16;
        BlueSendPrintfer.SendData++;
        BlueSendPrintfer.flag_num++;
        *BlueSendPrintfer.SendData = 0x30;
        BlueSendPrintfer.SendData++;
        BlueSendPrintfer.flag_num++;
        #else
        BlueSendPrintfer.DataSendPrintf[Remember_Data++] = 0x16;
        BlueSendPrintfer.DataSendPrintf[Remember_Data++] = 0x30;
        #endif
        for(i = 0; i < 48; i++)
        {
            decimalValue = 0;
            for(j = 0; j < 8; j++)
            {
                 decimalValue += binaryData[(i * 8) + j] << (7 - j);
            }
            //printf("%02X ",decimalValue);
            //printf("%lld ",convertDecimalToBinary(decimalValue));
            //将每一位十六进制数存储在数组中
            while(decimalValue != 0)
            {
                int remainder = decimalValue % 16;
                if(remainder < 10)
                {
                    BlueSendPrintfer.DataSendPrintf[Remember_Data++] = remainder + '0'; //转换成字符
                    //BlueSendPrintfer.SendData++;
                    BlueSendPrintfer.flag_num++;
                }
                else
                {
                    BlueSendPrintfer.DataSendPrintf[Remember_Data++] = remainder - 10 + 'A';   //转换成大写字母       
                    //BlueSendPrintfer.SendData++;
                    BlueSendPrintfer.flag_num++;

                }
                decimalValue /= 16;
            }
        }
        //printf("\r\n1501\r\n");
    }
    flag = 1;
}

这段函数意思是什么
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|小黑屋|Archiver|手机版|硬汉嵌入式论坛

GMT+8, 2024-5-13 21:21 , Processed in 0.184536 second(s), 26 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表