Viewport Ultimate verifies I am passing values between cogs, yet values cannot
scidog
Posts: 4
Hello,
In the attached SPIN files I use "BAX_POT2LTC12982MOTS_09.spin" to call "bax_LTC1298_getADC.spin" .
I used Viewport Ultimate to verify that the values for variables ADCX and ADCY are indeed being passed from the first cognew to the second cognew.
For some reason, any attempt to use the values of ADCX and ADCY in a waitcnt command just gags.
The SPIN file compiles an runs just fine, but if I use a line like
deltaTclicksMotX := clkfreq/ADCX
I simply get zeros for the Viewport monitired quantities "v1" and "v2".
On the other hand
deltaTclicksMotX := clkfreq/1000
works just fine, and my stepper motors turn correctly as the !outa[noparse]/noparse commands click off pin state changes at the rate dictated by the waitcnt commands.
My intent is to adjust the rate at which the !outa[noparse]/noparse statements execute via use of the value ADCX, but ADCX does neither seem to behave as a long.
I am new to this stuff, so my attached files should clear up any gaps in the above explanation.
Any help is appreciated in advance,
scidog
In the attached SPIN files I use "BAX_POT2LTC12982MOTS_09.spin" to call "bax_LTC1298_getADC.spin" .
I used Viewport Ultimate to verify that the values for variables ADCX and ADCY are indeed being passed from the first cognew to the second cognew.
For some reason, any attempt to use the values of ADCX and ADCY in a waitcnt command just gags.
The SPIN file compiles an runs just fine, but if I use a line like
deltaTclicksMotX := clkfreq/ADCX
I simply get zeros for the Viewport monitired quantities "v1" and "v2".
On the other hand
deltaTclicksMotX := clkfreq/1000
works just fine, and my stepper motors turn correctly as the !outa[noparse]/noparse commands click off pin state changes at the rate dictated by the waitcnt commands.
My intent is to adjust the rate at which the !outa[noparse]/noparse statements execute via use of the value ADCX, but ADCX does neither seem to behave as a long.
I am new to this stuff, so my attached files should clear up any gaps in the above explanation.
Any help is appreciated in advance,
scidog
Comments
1.) The values ADCX and ADCY are being passed from one cog to the other.
2.) The values for ADCX and ADCY behave as numbers and can be divided, multiplied, etc. within the second cognew's called method.
3.) Since ADCX and ADCY are indeed acting as numbers, one should (should) be able to use them in a waitcnt command to dictate the time between successive !outa[noparse]/noparse statements, and thus control the rate at which the pin changes state. (The rate of pin state change hi/lo dictates how fast my stepper motors turn because that's the kind of circuit I have hooked up.
BUT...
4.) When I try to use the values ADCX or ADCY in commands like those below, the motors do not turn and monitired values v1 and v2 show up as zero and stay at zero, the motors do not turn, but the program compiles and runs...it just does nothing.
deltaTclicksMotX := clkfreq/ADCX (a typical value for ADCX is about 2200)
waitcnt (TclicksMotX += deltaTclicksMotX)
In short, I cannot use ADCX or ADCY in any waitcnt calculations and have the program work as intended.
I hope that helps.
scidog