From: Hársfalvi Levente (levente_at_terrasoft.hu)
Date: 2003-10-01 21:08:50
Hi All!, Once upon a time, Maciej Witkowiak wrote: > ..Now, the only thing missing is the detection of when SID starts the measuring > cycle. In the document from funet the POTX line is connected to uC interrupt > input so when it changes from high to low there is an interrupt triggered. > I tried using it in my design, but it failed to work. ... I was a little curious about this situation (last but not least, after Bogax' comments). Moreover, conditions have changed a little bit since creating the original mouse document; since a few weeks, I'm a happy owner of a trusty old Tektronix 2235, a 2 channel 100Mhz analog oscilloscope :-). So... I don't know how it has failed in your design, but at least I know how it did in mine. It was _my_ fault =-). As usual. Software bug. Remember these rows? bsf STATUS,RP0 movlw 0ffh - ((1<<POTX) | (1<<POTY)) movwf TRISB ;Drive POTX and POTY, to detect the computer bcf STATUS,RP0 ;pulling POTX low ...Now remember, how to setup a portbit to output in the PIC (and also, the AVR)? Yes. By setting the respective data direction register bit to '1'. Of which, I happily did the opposite :-). If it was movlw ((1<<POTX) | (1<<POTY)) or even movlw (1<<POTX) it should have worked with whatever microcontroller versions. (Unfortunately, I can't currently try it out right now -- I have no PIC programmer hardware here :-( ). What I've seen on the oscilloscope, that the signal is 0v for half a period, as expected, and it rises slowly to slightly below 2.3-2.4 Volts in the other half period. This is in the short period when the unit has just been switched on. After the unit has been initialized (ie. it receives the first bytes from the mouse), the signal is still pretty similar (you see the modulation effect, of course :-) ), but it rises up to Vcc (5V) without problems. As you could guess, the microcontroller doesn't drive the POT lines in the first case. Better said, it does, but through a resistor in the order of 100K (the built-in pullup resistor, that is activated when the pin is input, and the output buffer is "1"). It's a weak pullup. Still not clear, if the leakage current is caused mainly by this weak pullup, or the SID itself. With the PIC16C84, there were still no problems with the startup, since its IRQ' input is TTL compatible. For such inputs, 2v is enough to sense a "high" logical level. But as the signal level (obviously) never rises above 2 and a few tenth volts, the Schmitt-Trigger input of the '16F84 was just out of luck. Since it could never get past this point in the program (the only point, where the POT lines are pulled up, is in the IRQ routine), it stuck with never turning the pullups on. That's all. However, that shows that it should be possible to trigger interrupts on the AVR, using its regular external interrupt inputs. Just make sure, the POTX line is driven before :-). The SID (as I see the signal) is definitely strong enough to pull the POT lines low, even against both the external load (pull-up by the microcontroller) and the capacitor next to it. At least, the negative edges of the signal are sharp. Also, the signal should well rise up to Vcc in the other half a period, without problems, just in few cycles, provided that the microcontroller drives the line through the series resistor (seen in the design). Hmm... It became a little long. As usual :-E. Hope this helps... :-) Best regards, L. Message was sent through the cbm-hackers mailing list
Archive generated by hypermail pre-2.1.8.