![]() |
Forum Index : Microcontroller and PC projects : (MM-DM) Measuring duty cycle on a 1kHz PW
![]() ![]() |
|||||
Author | Message | ||||
twofingers![]() Guru ![]() Joined: 02/06/2014 Location: GermanyPosts: 1576 |
There is still no mmBasic 4.6 available for Maximites (and Duinomites). We all still hope Geoff will provide it some day. ![]() How about a slave micromite connected (RS232, I2C, SPI) to your Duino? Should be pretty easy to do. Regards Michael EDIT: PIC32MX695/795 MCU System Features 512K Flash (plus 12K boot Flash)
128K RAM (can execute from RAM) PIC32MX170/256 MCU System Features 256KB Flash memory (plus an additional 3 KB of Boot Flash)
64K SRAM memory MMBsic manual: Drive “A:” is a virtual drive using the PIC32’s internal flash memory and has a size of about 180KB on the monochrome Maximite (a bit less with colour or CAN).
IMO is the drive "A:" almost useless. Except for MOD files. An SD card can have up to 10 files open simultaneously
while the internal flash drive has a maximum of one file open at a time. And of course I love my Maximites! ![]() causality ≠correlation ≠coincidence |
||||
bobo2 Newbie ![]() Joined: 26/10/2012 Location: SwedenPosts: 36 |
Yes, everything points to a separate MCU - I think I will do it with ATtiny and a comparator - just sampling.... Thanks all for the help! I learned a lot today. |
||||
bigmik![]() Guru ![]() Joined: 20/06/2011 Location: AustraliaPosts: 2949 |
Bobo2, Does the PWM input vary dramatically, what I mean is can it be 10% now and 1sec later it is 90% and you need to know that instant? Could you not configure a pin for period measurement, setting an interrupt (H-L or L-H) and directly reading the period of the pulse? That routine should be in the DM version of 4.5 that you have The command is: SETPIN pin, cfg , target You will have to workout which pins are suitable on the DM for period measurement and interrupts. Regards, Mick Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<< |
||||
bobo2 Newbie ![]() Joined: 26/10/2012 Location: SwedenPosts: 36 |
According to the manual: So how can I use a measurement in ms to get a value that is supposed to be in the us range? Am I missing something? Edit: In another section of the same manual: hmmm... SETPIN 5, 4, 2000 2000 pulseWidth=PIN(5) 2010 IRETURN What is the value of pusleWidth when the pulse is 30 microseconds? |
||||
bigmik![]() Guru ![]() Joined: 20/06/2011 Location: AustraliaPosts: 2949 |
Hi bobo2, That is the idea... But having never used period testing I can't really say for sure.. Of course it could return in ms as .030 ms Maybe someone with experience can jump in here.. Or try it out.. But be careful you cannot put pulses that go higher than 3.3v or 5v if the pin is 5v tolerant. Mick Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<< |
||||
twofingers![]() Guru ![]() Joined: 02/06/2014 Location: GermanyPosts: 1576 |
Please remember: Wikipedia EDIT: I can't find this in my manuals? ![]() It will not help to find out the duty cycle. EDIT2: On a Micromite 4.6b Pulsin() would definitely solve this problem: PWM2a_PIN=26
Pulsin_Pin=10 setpin(Pulsin_Pin), din setpin(PWM2a_Pin), dout PWM 2, 1000, 33 do print pulsin(Pulsin_Pin,1) pause 1000 loop PWM2a_PIN=26 and Pulsin_Pin=10 are connected, of course! OUTPUT (breadboard): 328 327.5 327.5 328 327.5 328 327.5 327.5 328 328 327.5 328 327.5 328 327.5 328 328 328 328 328 328 328 327.5 327.5 328 328 causality ≠correlation ≠coincidence |
||||
bobo2 Newbie ![]() Joined: 26/10/2012 Location: SwedenPosts: 36 |
Thanks twofingers for the clarification and the sample code. We established couple of posts ago that pulsin would work, but MMBasic 4.6 is not available for duinomite yet. |
||||
twofingers![]() Guru ![]() Joined: 02/06/2014 Location: GermanyPosts: 1576 |
I'm totally aware of this but perhaps will Geoff read this and be motivated to work on the Maximite code if he sees how urgent we need a Maximite MK2? ![]() causality ≠correlation ≠coincidence |
||||
![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |