EasyManua.ls Logo

Digital Design EVOLUTION II - Page 82

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...
19 EVOLUTION 1 SYSTEM MANUAL Issue Issue 1.1 20 Dec 2006
Example written in C to query a print station to determine the line speed.
// Query Print Station Address 7 for Line Speed
putchar(0x1b); // Send out ESC
putchar(0x02); // Send out STX
putchar(0x30); // Send out upper nibble of address 07
putchar(0x37); // Send out lower nibble of address 07
putchar(0x26); // Send out a '&' command
putchar(0x01); // Send out SOH
putchar(0x04); // Send out EOT
// Get results from print station
{
unsigned char dummy,speed;
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
speed = getchar() << 4; // Get upper nibble of speed
speed |= getchar() & 0x0f; // Get lower nibble of speed
dummy = getchar(); // Get EOT
} else {
// error handler (not our address)
}
}

Table of Contents