EasyManua.ls Logo

Digital Design EVOLUTION II - Page 83

Digital Design EVOLUTION II
102 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
20 EVOLUTION 1 SYSTEM MANUAL Issue Issue 1.1 20 Dec 2006
Example written in C to send a line speed to a print station
// Send Print Head Address 2 Line Speed of 100 feet per minute.
putchar(0x1b); // Send out ESC
putchar(0x02); // Send out STX
putchar(0x30); // Send out upper nibble of address
putchar(0x32); // Send out lower nibble of address
putchar(0x26); // Send out '&' command
putchar(0x36); // Send out upper nibble for Line Speed 100
putchar(0x34); // Send out lower nibble for Line Speed 100
putchar(0x04); // Send out EOT
// Get results from print station
{
unsigned char dummy;
dummy = getchar(); // Get ESC
dummy = getchar(); // Get STX
dummy = getchar() << 4; // Get upper nibble of address
dummy |= getchar() & 0x0f; // Get lower nibble of address
if(dummy == our_address)
{
dummy = getchar(); // Get command
dummy = getchar(); // Get ACK for print station
if(!dummy == ACK)
{
// error handler (didn't get acknowledgement from printer)
} else {
dummy = getchar(); // Get EOT
}
} else {
// error handler (not our address)
}
}

Table of Contents