I fixed the @var MSB's problem. Just had to add a ZEROX instruction:
callptrh mov vbase,x ' d e set vbase to ptr
rdlong pbase,vbase ' d e read pbase from vbase
callinit mov v,vbase ' d e g get sub index from vbase[31:20]
shr v,#20 ' d e g
zerox vbase,#19 ' d e g clear vbase msb's so they don't show up in @var
jmp #calloffh ' d e g
v34p - 2020.03.28 - CORDIC operations in interpreter now protected from interrupts
REG changed to now support PASM symbols: REG[pasm_register]
Upper bits of VBASE cleared for clean @var addresses
More constant symbols added to bring current with doc file
Wasn't adding an automatic infinite loop to the Spin2 main method discussed at one time?
Does Spin2 do this now?
I think this catches a lot of people off guard in Spin1...
Wouldn't it do people good to teach them that your program only does what you tell it to do, and that you need to tell it to do it again if you want it to do it again? It would help teach people something, as opposed to just letting them live in the ignorance of Arduino's setup() and main().
Today has been frustrating: the local pharmacy screwed up my prescription (again!) and now, I can't get a handle on pulse output from a smart pin. I know it works because I tested through TAQOZ. Reading the docs, it doesn't seem like it should be complicated.
For example, I want to output five, 100us pulses with a 100us gap on pin 38. This is the code.
pub main() | pin, x, y
pin := 38
x.word[0] := US_001 * 200 ' period
x.word[1] := US_001 * 100 ' off time
y := 5
pinstart(pin, P_PULSE | P_OE, x, y)
pinl(56)
repeat
waitct(0)
I know the pin works and my 'scope is configured properly because I can sub in this loop and it's fine:
Again, the docs make it seem quite straightforward, and I dug through the TAQOZ source to compare. What am I missing? BTW, I am running at 200MHz so I know I am no overflowing the high and low words of x in my setup (I've also tried constant values in x).
That did the trick, thank you. Question: Since the Y does act like a trigger mechanism for some smart pin modes, should the instruction that updates y in pinstart() come after the drvl instruction?
org
fltl pin
wrpin mode, pin
wxpin x, pin
drvl pin
wypin y, pin
end
That did the trick, thank you. Question: Since the Y does act like a trigger mechanism for some smart pin modes, should the instruction that updates y in pinstart() come after the drvl instruction?
org
fltl pin
wrpin mode, pin
wxpin x, pin
drvl pin
wypin y, pin
end
For some modes, Y needs to be set up during reset. There are a few counting modes in which the LSBs of Y are used to set a sub mode. In the case of what you are doing, just use 0 for Y in the PINSTART instruction.
Hi Chip
I found an issue with PNut when referencing constants from an object.
If the constant doesn[t exist an error would be expected.
There was also an issue with underscores in constant name references being ignored. So for the constant VALUE_ONE you could use VALUEONE or VAL_UE_O_NE. I posted a comment a while back on this but can't find it now.
I found that NCO FREQ mode followed the P1 formula if we treat Y as the P1 FRQx register, and set X to one. Easy peasy; works great.
I'm now a bit frazzled because I thought NCO DUTY mode would similarly follow the P1 model. In the P1 the FRQx register is set to duty% * 2^32 for duty mode.
Here's a bit of test code that should give 25% duty cycle. There is no output
I found that NCO FREQ mode followed the P1 formula if we treat Y as the P1 FRQx register, and set X to one. Easy peasy; works great.
I'm now a bit frazzled because I thought NCO DUTY mode would similarly follow the P1 model. In the P1 the FRQx register is set to duty% * 2^32 for duty mode.
Here's a bit of test code that should give 25% duty cycle. There is no output
Still not getting anything out of NCO_DUTY mode. As you guys have suggested, and Andy pointed out in another thread, using frac simplifies things here.
The code becomes...
pinstart(38, P_NCO_DUTY | P_OE, 1, duty frac 100)
...but there is still nothing on the 'scope.
And just for sanity checking, I toss in a little pin wiggling to ensure my 'scope is working.
Comments
Yes, not a major issue. But I found it when I was trying to determine if the address was in a specific range during debugging. Thanks for fixing it.
Does Spin2 do this now?
I think this catches a lot of people off guard in Spin1...
Wouldn't it do people good to teach them that your program only does what you tell it to do, and that you need to tell it to do it again if you want it to do it again? It would help teach people something, as opposed to just letting them live in the ignorance of Arduino's setup() and main().
Next to document is method pointers and the SEND special method pointer.
I found an issue with PNut when referencing constants from an object.
If the constant doesn[t exist an error would be expected.
and
Not a deal breaker just FYI
Cheers
Brian
For example, I want to output five, 100us pulses with a 100us gap on pin 38. This is the code.
I know the pin works and my 'scope is configured properly because I can sub in this loop and it's fine: Again, the docs make it seem quite straightforward, and I dug through the TAQOZ source to compare. What am I missing? BTW, I am running at 200MHz so I know I am no overflowing the high and low words of x in my setup (I've also tried constant values in x).
For some modes, Y needs to be set up during reset. There are a few counting modes in which the LSBs of Y are used to set a sub mode. In the case of what you are doing, just use 0 for Y in the PINSTART instruction.
Has anyone else run into this ? Or is it maybe just something on my computer ?
Bean
Yep, I did. It's a false positive. It's save to use.
Thanks Chip!
Okay, Thanks.
Bean
I'm now a bit frazzled because I thought NCO DUTY mode would similarly follow the P1 model. In the P1 the FRQx register is set to duty% * 2^32 for duty mode.
Here's a bit of test code that should give 25% duty cycle. There is no output
Clearly, I've missed something, but I don't know what it is. I did try a wypin() command after pinstart() but that made no difference.
Hmm, this works Ok
Thanks, guys.
The code becomes... ...but there is still nothing on the 'scope.
And just for sanity checking, I toss in a little pin wiggling to ensure my 'scope is working. The pin wiggling shows up, but it's just low-level noise after (as if pin is floating).
Should pinstart( ) be modified to have two y values? (Before and after?)