久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费
標(biāo)題:
lpc1114熱敏打印機源程序
[打印本頁]
作者:
helloword
時間:
2017-4-14 13:00
標(biāo)題:
lpc1114熱敏打印機源程序
lpc1114單片機做的熱敏打印機程序
0.png
(61.52 KB, 下載次數(shù): 228)
下載附件
2017-4-14 18:41 上傳
完整源碼下載:
printer.rar
(807.16 KB, 下載次數(shù): 60)
2017-4-14 13:00 上傳
點擊文件名下載附件
代碼
下載積分: 黑幣 -5
主程序預(yù)覽:
//本文件主要定義可程序的入口函數(shù)main, main函數(shù)里主要對系統(tǒng)、參數(shù)、硬件接口進新初始化,之后等待讀取串口數(shù)據(jù)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "LPC11xx.h" /* LPC11xx definitions */
#include "uart.h"
#include "timer32.h"
#include"aw_print.h"
#include"aw_init_printHead.h"
#include "aw_config.h"
#include "aw_font.h"
#include"aw_key_led.h"
#include "user.h"
#include"aw_char_app.h"
#include"aw_graph_app.h"
#include"aw_barcode_app.h"
#include "aw_command.h"
#include "pmu.h"
//初始化系統(tǒng)中的部分全局變量
void init_Global_Variables(void)
{
current_char_index=0;
DealBuffer_counter=0;
memset((low_power_t *)&low_power_Paramter,0,sizeof(low_power_t));
memset((printer_work_Parameter_t *)&printer_work_Parameter,0,sizeof(printer_work_Parameter_t));
printer_work_Parameter.printer_work_model=PRINTER_IDLE;
feed_dot_step=0;
paper_out_flag=0;
head_up_flag=0;
clear_buffer();
memset((Key_IRQ_Parameter *)key_IRQ_Parameter,0,KEY_NUM*sizeof(Key_IRQ_Parameter));
}
int main(void)
{
#if UART_DEBUG
char buffer[1024];
uint32_t counter,timer;
SystemInit();
Init_Sys_Parameter();
init_Global_Varibles();
UARTInit(sys_Parameter.uart_para.baudrate);
#ifdef PROJECT_DEBUG
printf("\n\r-- Printer_Project V1.0 --\n\r");
printf("\n\r-- Serial Communication test --\n\r");
#endif
counter=0;
timer=0;
memset(buffer,0,1024);
while(1)
{
if(UartBuffer_read()==1)
{
timer=0;memcpy(buffer+counter,&DealBuffer,DealBuffer_counter);
counter+=DealBuffer_counter;
}
else
{
if(timer<10)
{
timer++;
}
else if(timer==10)
{
if(counter!=0)
{
#ifdef PROJECT_DEBUG
printf("%s",buffer);
#endif
counter=0;
memset(buffer,0,1024);
timer=11;
}
}
}
#elif SPIFLASH_DEBUG
uint32_t BaseAdd;
uint32_t Address;
uint8_t MSB=0xce,LSB=0xa1;
uint8_t dot[118];
SystemInit();
spi_flash_init();;
while(1)
{
BaseAdd=BASEADD_GB2312_11X12;
if(MSB>=0xA1&&MSB<=0Xa9&&LSB>=0xA1)
{
Address=((MSB-0xA1)*94+(LSB-0xA1))*24+BaseAdd;
}
else if(MSB>=0xB0&&MSB<=0xF7&&LSB>=0xA1)
{
Address=((MSB-0xA1)*94+(LSB-0xA1)+846)*24+BaseAdd;
}
read_spi_flash(Address,&dot[0],118); /*取點陣*/
LSB++;
}
#elif PRINTER_HEAD_DEBUG
int i,keyval,keyval_bak;
uint32_t j;
SystemInit();
Init_Sys_Parameter();
init_Global_Variables();
init_Printer_port();
init_key(); /*4、按鍵初始化*/
while(1)
{
}
#elif TIMER_TEST
uint16_t time;
uint8_t i;
SystemInit();
Init_Sys_Parameter();
init_Global_Variables();
UARTInit(115200);
common_timer(1,1000);
while(1);
#else
uint32_t timer=0; /*用于記錄連續(xù)讀不到串口數(shù)據(jù)的次數(shù)*/
uint16_t get_dot_count;
uint16_t effective_dot,num; /*可以用于打印的點的個數(shù)*/
SystemInit();
Init_Sys_Parameter();
Init_project_Parameter();
init_Global_Variables();
UARTInit(sys_Parameter.uart_para.baudrate); /*1、數(shù)據(jù)終端通訊串口初始化*/
init_Printer_port(); /*2、熱敏打印頭接口初始化 */
spi_flash_init(); /*3、字庫芯片通訊初始化 */
init_key(); /*4、按鍵led 初始化*/
init_led();
common_timer(1,COMMON_TIME); /*啟動公共定時器*/
for(timer=0;timer<0xf000;timer++) //延時,保證先前的初始化起作用
{
;
}
init_cutter_position(); /*讓切紙刀回到 限位開關(guān)的位置 */
motor_driver_step40(); /*讓電機先反正轉(zhuǎn)40 步*/
Hardware_flow_control(UART_FREE); /*初始化結(jié)束,允許串口接收數(shù)據(jù)*/
timer=0;
while(1)
{
current_char_index=0;
if(UartBuffer_read()==1) /*讀取串口數(shù)據(jù)*/
{
timer=0; /*串口有數(shù)據(jù)時,將此計數(shù)器復(fù)位*/
while(current_char_index<DealBuffer_counter)
{
switch(project_Parameter.print_type) /*處理串口讀出的數(shù)據(jù)*/
{
case DATA_TYPE_CHAR_COMMAND: /*字符或、命令*/
if(determine_data_command((uint8_t *)(DealBuffer+current_char_index))==0)
{
if(Save_char()==0)
{
continue;
}
if(printer_work_Parameter.printer_work_model==PRINTER_IDLE) /*空閑*/
{
if(calculate_get_char_num(&num,&get_dot_count)==1) /*有一行數(shù)據(jù)需要打印*/
{
start_print(PRINT_CHAR);
}
}
}
else /*命令處理*/
{
command_deal((uint8_t *)DealBuffer);
}
break;
#ifdef VERTICAL_GRAPH
case DATA_TYPE_VERTICAL_GRAPH: /*垂直取模圖形*/
if(save_graph()==DATA_ENOUGH) /*數(shù)據(jù)取完,恢復(fù)默認數(shù)據(jù)類型*/
{
project_Parameter.print_type=DATA_TYPE_CHAR_COMMAND;
}
break;
#endif
case DATA_TYPE_HORIZONTAL_GRAPH: /*水平取模圖形*/
if(save_graph()==DATA_ENOUGH) /*數(shù)據(jù)取完*/
{
graph_data.data_finish=1;
project_Parameter.print_type=DATA_TYPE_CHAR_COMMAND;
} /*空閑時,并且有一行以上的數(shù)據(jù)需要打印*/
if((printer_work_Parameter.printer_work_model==PRINTER_IDLE)&&(graph_data.buffer_counter/graph_data.horizontal_mode.horizontal_byteCount>0))
{
start_print(PRINT_HORIZONTAL_GRAPH);
}
else if((printer_work_Parameter.printer_pause==1)&&(printer_work_Parameter.printer_work_model==PRINT_HORIZONTAL_GRAPH))
{ /*從暫停狀態(tài)恢復(fù)打印*/ /* 數(shù)據(jù)接收結(jié)束*/
if((graph_data.data_finish==1)||((graph_data.buffer_counter-graph_data.printed_byteCount)/graph_data.horizontal_mode.horizontal_byteCount>0))
{ /*還有至少一整行數(shù)據(jù)*/
Resume_Print_from_pause(printer_work_Parameter.printer_work_model);
}
}
else if((graph_data.data_finish==1)&&(printer_work_Parameter.printer_work_model!=PRINT_HORIZONTAL_GRAPH))
{ /*圖片數(shù)據(jù)接收完,并且打印機還在做別的工作, 取消本次圖片打印*/
memset((graph_data_t *)&graph_data,0,sizeof(graph_data_t));
}
break;
//case DATA_TYPE_BARCODE: /*條形碼圖形*/
// num=save_barcode((uint8_t *)(DealBuffer+current_char_index));
//if(num==DATA_ENOUGH)
//{
// save_barcode_parity_bit(); /*數(shù)據(jù)取完開始打印*/
// while(printer_work_Parameter.printer_work_model!=PRINTER_IDLE)
// {
// ;
//} /*條形碼超出打印范圍不打印*/
//if(project_Parameter.cursor_position==0) /*本行還是空的*/
//{
// effective_dot=MAX_DOT_PERLINE-project_Parameter.print_position-project_Parameter.Limited_width_left_para-project_Parameter.Limited_width_right_para;
//}
//else
//{
// effective_dot=MAX_DOT_PERLINE-project_Parameter.Limited_width_right_para-project_Parameter.cursor_position;
//}
//if(get_barcode_dot_width()<=effective_dot)
//{
// start_print(PRINT_BARCODE);
//}
//else
//{
// memset((barcode_data_t *)&barcode_data,0,sizeof(barcode_data_t));
//}
//project_Parameter.print_type=DATA_TYPE_CHAR_COMMAND;
//}
//else if(num==DATA_ERROR) /*條碼數(shù)據(jù)出錯*/
//{
// goto barcode_error;
//}
//current_char_index++;
//break;
}
}
}
else /*串口中無數(shù)據(jù)*/
{
if(timer<5)
{
timer++;
continue;
}
switch(project_Parameter.print_type)
{
case DATA_TYPE_CHAR_COMMAND:
if((printer_work_Parameter.printer_work_model==PRINTER_IDLE)&&(char_data.printed_byteCount<char_data.buffer_counter))
{ /*空閑時,并且還有數(shù)據(jù)*/
start_print(PRINT_CHAR);
}
break;
#ifdef VERTICAL_GRAPH
case DATA_TYPE_VERTICAL_GRAPH: /*垂直取模圖形*/
project_Parameter.print_type=DATA_TYPE_CHAR_COMMAND; /*丟棄原來的數(shù)據(jù)*/
memset((graph_data_t *)&graph_data,0,sizeof(graph_data_t));
break;
#endif
case DATA_TYPE_HORIZONTAL_GRAPH:
project_Parameter.print_type=DATA_TYPE_CHAR_COMMAND; /*三次讀不到數(shù)據(jù),認為結(jié)束*/
graph_data.data_finish=1;
if((printer_work_Parameter.printer_pause==1)&&(printer_work_Parameter.printer_work_model==PRINT_HORIZONTAL_GRAPH)) /*圖片打印過程中暫停*/
{
Resume_Print_from_pause(printer_work_Parameter.printer_work_model);
}
break;
case DATA_TYPE_BARCODE:
barcode_error:
project_Parameter.print_type=DATA_TYPE_CHAR_COMMAND;
memset((barcode_data_t *)&barcode_data,0,sizeof(barcode_data_t));
break;
default:
break;
}
}
}
#endif
}
復(fù)制代碼
作者:
paulhe
時間:
2018-1-31 13:02
用的是哪款打印機機芯???
作者:
kxhui
時間:
2018-11-16 15:48
有沒有硬件圖紙
作者:
gyh02133
時間:
2018-12-6 15:01
這個不官網(wǎng)上的嗎?
作者:
eee123
時間:
2019-10-8 13:54
謝謝分享
作者:
6874577
時間:
2019-10-27 14:27
這個不官網(wǎng)上的嗎?
作者:
arickwang
時間:
2019-11-12 13:22
非常厲害
作者:
bingbing123
時間:
2019-12-16 15:58
熱敏打印機的選型是什么?
作者:
舞者人生
時間:
2019-12-18 08:25
用的是哪款打印機機芯
歡迎光臨 (http://m.zg4o1577.cn/bbs/)
Powered by Discuz! X3.1
主站蜘蛛池模板:
香蕉福利视频
|
国产精品海角社区
|
中文字幕专区
|
www久久久
|
色窝
|
四虎4hu永久免费网站影院
|
欧美国产精品一区二区
|
天天拍天天干
|
欧美一区二区三区不卡
|
免费国产网站
|
黄色激情视频在线观看
|
久久黄色网址
|
亚洲网站在线观看
|
日韩免费在线观看视频
|
一区二区三区网站
|
黄色欧美大片
|
国产在线www
|
日韩毛片在线播放
|
av在线播放网站
|
欧美成人精品一区二区三区在线看
|
久久精品综合
|
婷婷激情综合网
|
色草在线
|
特级丰满少妇一级aaaa爱毛片
|
久久午夜精品
|
免费在线观看黄
|
国产精品手机在线
|
国产色视频一区二区三区qq号
|
亚洲成人a v
|
午夜免费福利
|
亚洲最新视频
|
一级毛片在线免费观看
|
一级黄色片在线观看
|
av黄色在线观看
|
日日日日干
|
97国产精品人人爽人人做
|
日韩不卡一区
|
一区在线视频
|
欧美一级黄
|
成人在线精品
|
国产精品成人一区二区网站软件
|