Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : Pause command rounding ARM 7 / CMM2
Page 2 of 2 | |||||
Author | Message | ||||
KeepIS Guru Joined: 13/10/2014 Location: AustraliaPosts: 1336 |
Hi lizby, this is what I'm doing here. Actually it's pretty simple once you understand a pulse train, or in this case, a square wave and how the array is used for the timing and / or duty cycle of the waveform or pulse train. In it's simplest form, like I'm using here, I simply wanted to generate a one cycle square wav of an accurate varying durations of X milliseconds. I could have simply generated a single pulse of the required duration, but as above, I wanted to generate 2 pulses each half the period required to make a one cycle square wave, a Square wave has a duty cycle of 50%, IE 50% HI 50% LO. Bitbang Bitstream 32,2,A() means generate a Pulse on pin 32, generate 2 transitions for the periods defined in first two values in array A() If Pin 32 is currently at zero, then the first transition will be a positive transition for a period of X us A(0), the second transition will obviously be a negative transition with period of X us A(1) before the waveform terminates and Bitbang return to the program. As the bitbang timing is in microseconds, and my required period is in milliseconds, multiply ms * 1000 to convert to us. However as I generating a one cycle square wave, two transition periods produce one cycle, I multiply each half of the cycle period by 500 (each pulse). For a square wave, increasing the period of the 1st transition and decreasing the period of the second by the same amount will simply change the duty cycle of the waveform, the duration will be same, varying that on the fly is basically Pulse Width Modulation (PWM). Obviously you can generate long complex timing bit streams, or an accurate synchronous pulse train for decoding an incoming data stream, by using the bit stream pin as a source into an input pin set as an Interrupt procedure, you cold decode various Data streams. Usage only limited by your imagination. Mike . Edited 2021-06-16 16:22 by KeepIS It's all too hard. Mike. |
||||
KeepIS Guru Joined: 13/10/2014 Location: AustraliaPosts: 1336 |
To almost finalise this thread, the test release of the FM has a slight bug when setting an option, in the mean time just to keep the initial topic of the pause command rounding and strange random long delay up to date. I've been running a test via the console (no LCD screen) for around 20 minutes and so far it's perfect. The bitbang command has also been added and works a treat. The Pause command appears to be perfect, I just need to test a big app that initially revealed the problem, it needs the LCD option to work as it's total GUI. I know I keep saying this, but a huge thankyou again to matherp for his great enhancements to the existing Code and seemingly tireless work in giving us MM Basic on the ARM series. Mike . It's all too hard. Mike. |
||||
lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 2989 |
Thank you for the explanation. Clever. PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
Page 2 of 2 |
Print this page |