Help with PWM Output
Svengali
Posts: 6
I am trying to generate a 10-bit word with variable pulse widths on one of my BS1 outputs. I thought this would be relatively easy using the PULSOUT and PAUSE commands. Problem is that the·PAUSE command time is in milliseconds, and·my·minimum pulse width is 0.52 ms (520 us). So, my timing is incorrect and consequently my word length is too long using·this method.
·
I'm·new to the BS and I'm still learning. So I'm not familiar with all the·syntaxes and operations yet.·Based on the description of the PWM command, I cannot use it to generate my pulses, because there are intermediate pulses do to the algorithm used (if I understood correctly). Can this be done? If so, I would appreciate some suggestions on a solution.
·
Sven
·
I'm·new to the BS and I'm still learning. So I'm not familiar with all the·syntaxes and operations yet.·Based on the description of the PWM command, I cannot use it to generate my pulses, because there are intermediate pulses do to the algorithm used (if I understood correctly). Can this be done? If so, I would appreciate some suggestions on a solution.
·
Sven
Comments
This information can be found in the PBASIC Help file or in the PBASIC Manual. There is untold information therein. If the PBASIC Manual doesn't have the answers you want, try the PBASIC Help file. If you don't read the PBASIC Manual carefully (including the TABLES) you may not find all the information you are seeking. The BS-1 has a 10 µs pulse duration and a maximum pulse width of 655.35 ms.
So, if the minimum duration is 10 µs then .52 ms (520 µs) is a piece of cake for the BS-1. Were you perhaps looking at micro-seconds as milliseconds?
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When all else fails, try inserting a new battery.
I did look in all those sources and the application notes, but I didn't see a solution. Perhaps I didn't explain clearly. I hav no problem using PULSOUT to generate the 520us pulse. That's easy. The problem is trying to delay the low cycle of the pulse for 520us using the PAUSE command. PAUSE can only do milliseconds. My pulse starts of high so I use PULSOUT to drive it low and PAUSE to keep it low for a while and then back up, etc. This is a variable pulse-width word. One and zero are both high but they have different pulse lengths and pulse separation. I didn't see a way to effectively do this that's why I posted this replay.
Even if I make the pin an input, pull it high, and the do PULSOUT, I still have the same problem - creating a 150 - 520 us delay. I looked at using COUNT, but that also won't work, and I don't see a timer that I can manipulate in any way. Perhaps I'm reading teh wrong thing
·
Another issue that I have is the SW latency for the PULSOUT command. It said it take a few microseconds, but didnt say exactly how long. I guess I can measure that on a scope.
Please give feedback while I keep looking. I was hoping to complete this project this weekend. I was so sure this was going to be so much easier than programming a PIC. Thanks.
·
Post Edited (Mike Green) : 11/27/2008 9:16:46 PM GMT
Thanks for the idea. I thought about this method too. However, it does not work. I just tried it and measured it on my scope. The output pin of interest still goes high/low (depending·on the original state) when I write to the other·pin. Also, the latency between PULSOUT·commands on alternate pins is on the order of milliseconds. The easiest method would be if I had access to the mcu timer.
I don't think the BS will work in the application. I will have to find another solution.