|
THS
|
Robots /
Letters on the Cricket DisplayBeing slightly bored, I decide that it would be useful if I could somehow display letters on the cricket display. Using a bit of internet research I stumbled upon a site that described the codes needed to give the user arbitrary control of the digits on the display. Using this information I created a function to take four inputs, one for each digit, and make the display change. The inputs would be in the form of an 8-bit number, where bits 0-6 control the state of their corresponding part in the display. bit 0
----------
| |
| |
5 | | 1
| 6 |
----------
| |
| |
4 | | 2
| 3 |
----------
For example, the number 0x76 (01110110) is: 7 6 5 4 3 2 1 0 0 1 1 1 0 1 1 0 Resulting in the letter 'H': | |
| |
5 | | 1
| 6 |
----------
| |
| |
4 | | 2
| |
Numerous other letters and symbols can be created using different patterns. Code for the function is below: void cr8_interface(uint8_t b1, uint8_t b2, uint8_t b3, uint8_t b4)
{
uint8_t waittime = 2;
uint8_t option = 64;
// Turn off timer
TIMSK1 = 0x00;
TIMSK1 = 0x02;
cr8_delay(waittime); // Significant Wait required between bytes
TIMSK1 = 0x00;
// Send value
crkbus_send_byte(16,1); // Command Byte
TIMSK1 = 0x02;
cr8_delay(waittime);
TIMSK1 = 0x00;
crkbus_send_byte(option,0); // Option Byte
TIMSK1 = 0x02;
cr8_delay(waittime);
TIMSK1 = 0x00;
crkbus_send_byte(b1,0); // 1st panel
TIMSK1 = 0x02;
cr8_delay(waittime);
TIMSK1 = 0x00;
crkbus_send_byte(b2,0); // 2nd panel
TIMSK1 = 0x02;
cr8_delay(waittime);
TIMSK1 = 0x00;
crkbus_send_byte(b3,0); // 3rd panel
TIMSK1 = 0x02;
cr8_delay(waittime);
TIMSK1 = 0x00;
crkbus_send_byte(b4,0); // 4th panel
// Turn on timer
TIMSK1 = 0x02;
cr8_delay(waittime);
}
|