RE: Signal Monitoring
"Jonathan Sharret" <j.sharret-vt2K7lilQm9Wk0Htik3J/[email protected]>
| Newsgroups | gmane.comp.hardware.microcontrollers.tini |
|---|---|
| Message-ID | <[email protected]> |
Hi, So I read up on External Interrupts and indeed they are the solution to my problem. I coded up the PushButton example in Don's book and hooked it up to External Interrupt 5, P1.7 on the DS400 rev B socket board I have. The program worked well. I then added the very same code to my SNMP agent code. The code captures socket 161 and 162 for traps and for queries. It then starts threads which call the blocking read() method on each socket. When I press the push button at this point interrupts are caught and I see the print out statement from the PushButton code. However, after I send the agent a query packet and it responds with a packet of its own the external interrupts are no longer caught. I have to kill and restart the program in order to get my external interrupts back. But again, once a packet is received and sent, interrupts no longer work. Since I couldn't find any info about this, I decided to just try a different external interrupt pin. I modified my hardware slightly to be positive edge triggered and connected it to External Interrupt 0, P3.2 (setting the interrupt to be edge triggered). This time it worked perfectly both before the packet is received and a new one sent, and after. So the question is, is P1.7 somehow connected to the Ethernet port? Why did it stop working? How can I get it to continue working as I will most likely require its use later in development? Is there anything else I need to look out for if I decide to use External Interrupts 1-4? Thanks, Jonathan Sharret TELEGRID Technologies, Inc. -----Original Message----- From: Jonathan Sharret [mailto:j.sharret-vt2K7lilQm9Wk0Htik3J/[email protected]] Sent: Tuesday, February 24, 2004 11:38 AM To: 'tini-6tN4nzCoH/[email protected]' Subject: Signal Monitoring Hi, I'm using TINIs400 rev B socket board with the TINIm400 verification module with TINIOS 1.12. I am writing code that will allow the TINI to serve as an SNMP agent. The TINI will be connected to 3 devices which each have 4 status signals to be read and 4 control signals to be written. Writing and checking the control signals is not an issue since it is done "slowly" by user input. My question is how can I monitor the 12 different status signals without overloading the TINI? Right now I'm creating a demo unit which will simulate monitoring and controlling just 1 device. I've made a separate board which has 4 LEDs (to simulate the 4 control signals) and 4 switches (to simulate the 4 status signals). This board is connected to the TINI's RS-232 driver/receiver chip (U7 MAX560CAI) through both serial ports (NOTE: I am NOT using the serial port, just the RS-232 chip). The TINI will thus read/write port pins P.14, P1.5, P1.6, P3.0, P3.1 and P3.3. Three of these signals are on driver pins and 3 are on receiver pins. In each set of three, 2 signals will be used to address the 4 switches/LEDs and 1 signal will be used as a status bit. To issue a control signal (turn on/off a LED) the TINI sets the address lines for that LED and changes the status bit to turn the LED on or off. When a switch is thrown, the board I've developed changes the address lines to that switch and changes the status bit to the current position of the switch. My question is how can I detect a change in these 3 status signals efficiently? My initial idea was to have a separate thread simply poll these signals every XXX milliseconds. This might work for this demo, but when I scale this up to monitoring several devices at once I think it would fail. Also, I worry that the CPU would be overloaded with the constant checking. I don't need that great time resolution, checking every 500 milliseconds would probably be enough. What I'd like to know is what is the proper way to do event handling, event listening and event firing. I find it hard to believe that my PC's CPU polls my mouse or keyboard constantly to determine whether I'm moving the mouse or typing. Or when I issue a read() on the Ethernet port and it blocks until a packet is available, how does it wake up? Is the Ethernet port polled constantly? Is this what an external interrupt is? If so, how do I use this on the TINI? Thanks in advance, Jonathan Sharret TELEGRID Technologies, Inc. _______________________________________________ TINI mailing list TINI-6tN4nzCoH/[email protected] To UNSUBSCRIBE, edit your profile, or see list archives: http://lists.dalsemi.com/mailman/listinfo/tini