Assembly PWM
jfk
Posts: 7
First, an observation. The example for the 8 bit ADC in the SX/B help file works in Turbo mode but not in compatible mode. After viewing the assembly listing, I can find the loop values that control the timing. These change when you change the Freq directive, but they do NOT change if you don't use Turbo mode. A bug in the PWM function?
Now for my real question. I have coded an assembly version of the PWM function basically exactly like the basic version. And it works exactly the same as the basic version if in Turbo mode. But I need my code to run at 4MHz in compatible mode (not Turbo), and it does not work right in that configuration. I'm using the same circuit as in the example. Does any one know the loop values to use for this configuration?
Yes, I'm lazy. Right now I don't have time to sit down and figure out the timing of each instruction.
The variables in the assembly listing of the basic PWM function are:
_PARAM1 is the time in milliseconds (#1 in the example program)
_PARAM3 is the first timing value (#2 in the example)
_PARAM4 is the second timing value (#108 in the example)
Thanks for any help.
Now for my real question. I have coded an assembly version of the PWM function basically exactly like the basic version. And it works exactly the same as the basic version if in Turbo mode. But I need my code to run at 4MHz in compatible mode (not Turbo), and it does not work right in that configuration. I'm using the same circuit as in the example. Does any one know the loop values to use for this configuration?
Yes, I'm lazy. Right now I don't have time to sit down and figure out the timing of each instruction.
The variables in the assembly listing of the basic PWM function are:
_PARAM1 is the time in milliseconds (#1 in the example program)
_PARAM3 is the first timing value (#2 in the example)
_PARAM4 is the second timing value (#108 in the example)
Thanks for any help.
Comments
Usually you can set the FREQ to 1MHz and use TURBO then compile, then edit the SRC file and take out TURBO and change the freq to 4MHz.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"SX-Video·Module" Now available from Parallax for only $28.95
http://www.parallax.com/detail.asp?product_id=30012
"SX-Video OSD module" Now available from Parallax for only·$49.95
http://www.parallax.com/detail.asp?product_id=30015
Product web site: www.sxvm.com
Those that would give up freedom for security will have neither.
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Greetings from Germany,
G
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·1+1=10
Post Edited (Paul Baker) : 11/20/2005 7:28:29 PM GMT
Thanks. I tried the values from the 1MHz listing and they don't work in 4MHz non-turbo!
"I'm just curious: Is there any specific reason why you need to run your code in "Compatibility Mode"?"
I'm using a lot of timed routines that, unfortunately, I used years ago. I just didn't want to go in and change all that, but it looks like I may have to.
So, Paul, I could use a 1MHz osc. in turbo mode and it should execute the same as 4MHz non-turbo, right? I may try that or may just rewrite all my other timing code.
And, I am not using SX/B, I'm using assembly. I'm just using the assembly version of the SX/B PWM function.
Thanks everyone!