#define LPT1IRQ 7
#define TICKS 5
#define BANNERWIDTH 10000
+#define MSGMAX 1000
#define MAXX 20
RT_TASK intrtask, drawtask;
RTIME tocks[TICKS+1];
unsigned char data[BANNERWIDTH];
-char* message;
+char message[MSGMAX];
+char inputmsg[MSGMAX];
unsigned int pointer = 0;
unsigned int msglen;
//Register as interrupt handler
RT_INTR intr;
rt_intr_create(&intr, NULL, LPT1IRQ, 0);
- rt_printf("Interrupt created\n");
+ //rt_printf("Interrupt created\n");
//Initialize and declare the timer variables
RTIME tick = rt_timer_read();
rt_task_create(&drawtask, NULL, 0, 50, 0);
period = ticks[TICKS]+tocks[TICKS];
rt_task_start(&drawtask, &taskd, &period);
- rt_printf("tocks is the short stretch\n");
+ //rt_printf("tocks is the short stretch\n");
}
rt_intr_wait(&intr, TM_INFINITE);
rt_task_create(&drawtask, NULL, 0, 50, 0);
period = ticks[TICKS]+tocks[TICKS];
rt_task_start(&drawtask, &taskd, &period);
- rt_printf("ticks is the short stretch\n");
+ //rt_printf("ticks is the short stretch\n");
}
rt_intr_wait(&intr, TM_INFINITE);
//Print average
}
}
-int main(int argc, char* argv[])
+void make_message(char *msg)
{
- if(argc != 2){
- printf("Usage: %s \"Message\"\n", argv[0]);
- return 1;
- }
- message = argv[1];
- rt_print_auto_init(1);
- mlockall(MCL_CURRENT | MCL_FUTURE);
-
- unsigned int i;
- for(i=0; i<BANNERWIDTH; i++){
- data[i] = 0;
- }
-
- i=20;
+ unsigned int i=20;
unsigned char s = 0;
- while(i<BANNERWIDTH && s < strlen(message)){
- char c = message[s];
- printf("processing: '%c'\n", c);
+ while(i<BANNERWIDTH && s < strlen(msg)){
+ char c = msg[s];
switch(c){
case 'A':
case 'a':
case 'Z':
case 'z':
data[i++] = 0x19; data[i++] = 0x15; data[i++] = 0x13; break;
+ case '0':
+ data[i++] = 0xe; data[i++] = 0x11; data[i++] = 0xe; break;
+ case '1':
+ data[i++] = 0x12; data[i++] = 0x1f; data[i++] = 0x10; break;
+ case '2':
+ data[i++] = 0x12; data[i++] = 0x19; data[i++] = 0x16; break;
+ case '3':
+ data[i++] = 0x15; data[i++] = 0xa; break;
+ case '4':
+ data[i++] = 0x7; data[i++] = 0x4; data[i++] = 0x1f; break;
+ case '5':
+ data[i++] = 0x17; data[i++] = 0x15; data[i++] = 0x9; break;
+ case '6':
+ data[i++] = 0xe; data[i++] = 0x15; data[i++] = 0x9; break;
+ case '7':
+ data[i++] = 0x1; data[i++] = 0x1f; break;
+ case '8':
+ data[i++] = 0x1f; data[i++] = 0x15; data[i++] = 0x1f; break;
+ case '9':
+ data[i++] = 0x12; data[i++] = 0x15; data[i++] = 0x1e; break;
case '.':
data[i++] = 0x10; break;
case ',':
case '\'':
case '"':
data[i++] = 0x1; break;
+ case ':':
+ data[i++] = 0xa; break;
+ case '(':
+ data[i++] = 0xe; data[i++] = 0x11; break;
+ case ')':
+ data[i++] = 0x11; data[i++] = 0xe; break;
+ case '-':
+ data[i++] = 0x4; data[i++] = 0x4; break;
case ' ':
i++;
break;
s++;
}
msglen = i;
+ pointer = 0;
+}
+
+int main(int argc, char* argv[])
+{
+ rt_print_auto_init(1);
+ mlockall(MCL_CURRENT | MCL_FUTURE);
+ unsigned int i;
+ for(i=0; i<BANNERWIDTH; i++){
+ data[i] = 0;
+ }
+
// Get permission to write to parallel port
ioperm(0x37A, 1, 1);
ioperm(0x378, 1, 1);
outb(inb(0x37A) | 0x10, 0x37A);
+ make_message("abcdefghijklmnopqrstuvwxyz1234567890,.\"()");
+
rt_task_create(&intrtask, NULL, 0, 50, 0);
rt_task_start(&intrtask, &taski, 0);
- pause();
+ printf("CRTL+C to exit\n");
+ printf("legal characters: abcdefghijklmnopqrstuvwxyz1234567890,.\"()\n");
+ while(1){
+ printf("Type your message(max %d chars): ", MSGMAX);
+ scanf("%[^\n]", inputmsg);
+ getchar();
+ make_message(inputmsg);
+ sleep(0.1);
+ }
}