Select a PC to run VxWorks OS, and remember its IP address.
Create a new target in target manager:
From this point on you can work the same as with the simulator.
Note: All the VxWorks PCs have its stdin, stdout and stderr redirected to the serial port. You can use a Target Console Tool to redirect I/Os to your development PC. If you run a Host Shell, you can interact with the system, but application's I/O still go to the console (i.e. serial port or target console tool).
Task: Read the position of IRC sensor in the motor.
Documentation to the motor: slides-motor.pdf (only see pages 4 and 8).
HW interrupts IRQ0 through IRQ 15 are mapped to inerrupt vectors 20h through 2Fh. Parallel port (LPT) interrupt is thus mapped to the vector 27h.
#include <stdio.h> #include <syslib.h> #include <intLib.h> #include <iv.h> #define LPT_IRQ 0x7 #define LPT_PORT 0x378 /* task_IRC is IRQ handler routine, which handler LPT interrupts */ void task_IRC(int val) { unsigned char port; port = sysInByte(LPT_PORT+1); /* other things to do */ } void inter(void) { sysOutByte(LPT_PORT+2, sysInByte(LPT_PORT+2) | 0x10); /* allow parallel port to generate interrupts */ if (intConnect(INUM_TO_IVEC(0x20 + LPT_IRQ), task_IRC, 0) == OK) { printf("intConnect OK\n"); } else { printf("intConnect error\n"); } sysIntEnablePIC(LPT_IRQ); //enable IRQ7 in PC interrupt controller // something useful should be here or at least a long taskDelay() sysIntDisablePIC(LPT_IRQ); //disable IRQ7 }