TAQOZ pin state and assignment
VonSzarvas
Posts: 3,450
Looking for help with TAQOZ. Seems like a neat way to test some P2 boards if this can work !
I'm trying to read a pin with this code:
And getting these 3 replies, based on state.
0 when pin 33 is grounded, -1 when floating or high.
Is there some way to differentiate between floating and high ?
Also, about assignment. Is there a shorthand to set the output state of one pin according to the input value on another pin ?
I was doing this:
But I figured it could be simpler if the value of 33 PIN@ could be assigned to pin 56 directly. Is that possible ?
Quasi-code here...
Something like: 33 PIN@ > PIN 56
Reason being, then it could be looped, maybe along the lines of: 8 0 DO PIN I = I+1 PIN@ I++ LOOP
So set the first 4 pins to be the values of the neighbors. (yeah- it's a stinker of an effort that quasi code!)
I'm trying to read a pin with this code:
33 PIN@ .
And getting these 3 replies, based on state.
TAQOZ# 33 PIN@ . 0 ok TAQOZ# 33 PIN@ . -1 ok TAQOZ# 33 PIN@ . -1 ok
0 when pin 33 is grounded, -1 when floating or high.
Is there some way to differentiate between floating and high ?
Also, about assignment. Is there a shorthand to set the output state of one pin according to the input value on another pin ?
I was doing this:
3 NEWCOG : TESTAV BEGIN 33 PIN@ 0= IF 56 HIGH ELSE 56 LOW THEN AGAIN ; ' TESTAV 3 TASK W!
But I figured it could be simpler if the value of 33 PIN@ could be assigned to pin 56 directly. Is that possible ?
Quasi-code here...
Something like: 33 PIN@ > PIN 56
Reason being, then it could be looped, maybe along the lines of: 8 0 DO PIN I = I+1 PIN@ I++ LOOP
So set the first 4 pins to be the values of the neighbors. (yeah- it's a stinker of an effort that quasi code!)
Comments
From what we found with the P2D2 not all pins read the same when floating, unlike the P1 which always reads low when floating.
I am sure Peter can work out a sequence for you.
Freq. not especially fast. 50ms would probably be excessive.
The test code wants to replicate the button state on an LED (which is driven high on the P2 side and tied to gnd via another series R).
This explains the thought about setting the LED state directly from the button state, as high on the button would have the LED lit.
There's 4 buttons (pin 0,1,2,3) with 4 LEDs (pin 4,5,6,7) that could be scanned in a loop if direct assignment is possible. But that's not a deal-breaker.
I'll try adjusting the code to pulse that pin low for 1ms before reading the state- that might do the trick!
The newer version of TAQOZ which I boot from SD card reports back a little more information such as H for a high output or h for a high input etc.
TAQOZ should really have a PIN! to match the PIN@ but of course you can just create one.
Taking an example, of measure SysCLKs needed for (eg) 2e6 _/= edges on Pin31 ?
I think that is this in the DOCs ( X=2e6, Y = %00)
%10011 = For X periods, count time
%10100 = For X periods, count states
X[31:0] establishes how many A-input rise/edge to B-input rise/edge periods are to be measured.
Y[1:0] establishes A-input and B-input rise/edge sensitivity:
%00 = A-input rise to B-input rise
%01 = A-input rise to B-input edge
%10 = A-input edge to B-input rise
%11 = A-input edge to B-input edge
Note: The B-input can be set to the same pin as the A-input for single-pin cycle measurement.
Clock cycles or A-input trigger states are counted from each A-input rise/edge to each B-input rise/edge for X periods. If the A-input rise/edge is ever coincident with the B-input rise/edge at the end of the period, the start of the next period is registered. Upon completion of X periods, the measurement is placed in Z, IN is raised, and a new measurement begins. RDPIN/RQPIN can then be used to retrieve the completed measurement. Z will be limited to $80000000.
The first mode is intended to be used as an oversampling period measurement, while the second mode is a complementary duty measurement.
During reset (DIR=0), IN is low and Z is set to $00000000.
Result will be about 25M for 250MHz sysCLK, if 20MHz is applied to pin31
Can that print in a simplest spread sheet/terminal compatible manner - eg one number per line, whole decimal int32?