|
From: | Andi |
Subject: | [avr-gcc-list] LX-800 Printer driver |
Date: | Thu, 17 Apr 2008 13:45:43 +0700 |
Hi,
Does anyone ever make a LX-800 printer
driver for AVR ?
I make a code but it didn't work at all. Here my code :
void
InitPrinter(void)
{ // // Set Data Printer Direction as output DDRB = 0xFF; PORTB = 0; // Set Input BUSY signal cbi(DDRD,BUSY); sbi(PORTD,BUSY); // Set Output INIT
signal
sbi(DDRD,INIT); sbi(PORTD,INIT); // Set Output Strobe
signal
sbi(DDRD,STROBE); sbi(PORTD,STROBE); asm("nop"); asm("nop"); asm("nop"); asm("nop"); asm("nop"); // Send INIT Signal cbi(PORTD,INIT); asm("nop"); asm("nop"); asm("nop"); asm("nop"); asm("nop"); sbi(PORTD,INIT); asm("nop"); asm("nop"); asm("nop"); asm("nop"); asm("nop"); } void SendCharToPrinter(unsigned char
data)
{ // unsigned int timeout_print; // Check busy timeout_print = 0; while ((PIND & _BV(BUSY)) == 0){ timeout_print++; if (timeout_print == MAX_BUSY_LOOP){ return; } } // Send Data PORTB = data; // Send Strobe Signal cbi(PORTD,STROBE); asm("nop"); asm("nop"); asm("nop"); asm("nop"); asm("nop"); sbi(PORTD,STROBE); asm("nop"); asm("nop"); asm("nop"); asm("nop"); asm("nop"); } void SendStringToPrinter(unsigned char
*datastring)
{ // InitPrinter(); while (*datastring) { SendCharToPrinter(datastring++); } } int
main(void)
{ SendStringToPrinter("System Ready !\r\n"); for (;;){ } } Anyone can help me
?
Thanks Andi
================================ |
[Prev in Thread] | Current Thread | [Next in Thread] |