SX/B PWM command frequency
Hello everybody,
Does anyone know the frequency for the PWM command in SX/B. Also, is it constant, or dependant on clock speed?
Thanks,
Robert Schwartz
Does anyone know the frequency for the PWM command in SX/B. Also, is it constant, or dependant on clock speed?
Thanks,
Robert Schwartz

Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
If you set the interrupt rate at 1 MHz, then your wish is granted.
Cheers,
Peter (pjv)
Thanks,
Robert Schwartz
Post Edited (Robert Schwartz) : 7/8/2005 6:49:38 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
I see I should read more carefully Robert as your question was SX/B related. I missed that point, and answered a the question in an assembler reference....·thanks Paul for catching that.
As you all know, I am SX/B challenged, hence unqualified to comment; I should have kept my mouth shut.
Happy SX/B'ing,
Peter (pjv)
168 006B 0CFB MOV FSR,#TRIS_B ; PWM rb.0, 128, 3 006C 0024 169 006D 0400 CLRB IND.0 170 006E 005F MODE $0F 171 006F 0200 MOV !RB,IND 0070 0006 172 0071 0018 BANK $00 173 0072 0C03 MOV __PARAM1,#3 0073 0028 174 0074 0069 CLR __PARAM2 175 0075 0C02 MOV __PARAM3,#2 0076 002A 176 0077 0C41 MOV __PARAM4,#65 0078 002B 177 0079 0C80 ADD __PARAM2,#128 007A 01E9 178 007B 0703 MOVB rb.0,C 007C 0406 0603 0506 179 007F 02EB DJNZ __PARAM4,@$-6 0080 0010 0A79 180 0082 02EA DJNZ __PARAM3,@$-9 0083 0010 0A79 181 0085 02E8 DJNZ __PARAM1,@$-16 0086 0010 0A75 182 0088 0CFB MOV FSR,#TRIS_B 0089 0024 183 008A 0500 SETB IND.0 184 008B 005F MODE $0F 185 008C 0200 MOV !RB,IND 008D 0006 186 008E 0018 BANK $00 187Its too late to diasect it completely tonight, but its clear its a triple loop. 1st param is the # of cycles, 2nd·param is the accumulator which is incremented by the duty cycle each pass, the carry bit determines the output. 3rd and 4th params, Im not sure of, one of these probably determines the general frequency.
Since the duration parameter is in milliseconds, __PARAM3 and __PARAM4 create enough loops to last for 1 millisecond.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"SX-Video·Module" Now available from Parallax for only $28.95
http://www.parallax.com/detail.asp?product_id=30012
Product web site: www.sxvm.com
"One experiment is worth a thousand theories"
·