Qaudrature In / NSTC out; to see Quad. Values????
$WMc%
Posts: 1,884
· I'm tryin to send a QAUDRATURE input to a "TV". I'm using " Quadrature Encoder v1.0 "by "Author: Jeff Martin ""(C) 2005 Parallax, Inc."...I thought I Had the OBJ. placement down PAT. But I keep getting an ERROR in the " cognew(@entry, @freq) " statement. """· cognew(@entry,@freq) """(This is in the third line of the 1st " PUB " Statement of what I thing? Is the·NSTC driver INT./start???.....I'm Back hard in the books, But I'm not seeing It....(Whats Wrong w/ the code)???. I have moved the "CON" & "VAR" Statements around so much I'm not sure were they should go.
································································· $Struggle$ing____ $WMc%_____
································································· $Struggle$ing____ $WMc%_____
Comments
(hm - strange alias...) OK anyway
I took a look into the original code of Quadrature_Encoder.spin
there the cognew command is
in your code you took the Quadrature_Encoder.spin which should be seen as an OBJECT-file
and be used in the same way as the tv_text.spin-file: meaning using it as an objectfile
you are are using it as a main-file
you should create THIRD file wich is the main-file where you define an object QuadEnc and an object tv.
the cognew should be done INSIDE the objectfile
and then you call the START-method from your mainfile
this is the quasi standard how it should be done
you tried to start the PASM-cog by
but inside your modified Quadrature_Encoder.spin-code
in the PASM-section the LABEL is still named "Update"
so your cognew-command uses a label named "entry" which is not defined at all
This was a very quick look into your code as I have not much time at the moment.
I did NOT analyze what has to be done with your freq-variable and how this variable works
But one thing is valid in general: variables are only known INSIDE that object where they are defined
OTHER objects can NOT access these variable DIRECTLY
as a first attempt create your OWN mainfile with two objects
object QuadEnc and
object object tv
that uses the original code from the obex or library
then inside the MAIN write a routine that uses
QuadEnc.start(...
and
tv.start(....
and then a repeat-loop
which contains
tv.dec(freq) 'display the value (in Hz)
what I'm wondering about is: the original Quadencoderobject gives back
a POSITION you named your var freq like a FREQUENCY
how could this object give back a frequency ?
best regards
Stefan
··· Thank YouFor Your reply,I·kinda understand what Your suggesting,Makeing it happen is easyer said then done. I still don't fully understand the program flow,and it shows. I will try Your Suggestions....
································································· Thanks Again Walt McDonald__$WMc%__
······
Ie: First I added at the top:
then I modified the OBJ list to:
and finally deleted the last repeat and replaced it with:
This allowed me to quickly monitor my wiring and prove the 5 volt to 3.3 volt translation.
Thank You for Your reply; I made the MOD. to "tv_text_Demo.spin" and the other program MOD.s you suggested. And I'm happy to say I now have A working "TV" term. w/ the quadrature encoder!!!...I gonna clean the code up a bit more and I'll post the final.
Thanks Again___Walt McDonald___$WMc%____out