|
Forum Index : Microcontroller and PC projects : ArmH7 PIN HI-LO time
| Author | Message | ||||
| KeepIS Guru Joined: 13/10/2014 Location: AustraliaPosts: 1945 |
Just wondering if someone can measure the transition time HI -> LO -> HI, the width of a single low pulse. I'm generating a clock train to a device to read synchronous data using something simple like this: Const Clock_1 = 98 (or whatever you use) SetPin Clock_1,DOUT do Pin(Clock_1) = 0 Pin(Clock_1) = 1 loop Reason I'm asking: I have DSO screen shots from way back when I first started using the H7 and decoding the device, the width of each pulse was then 21us, it was 100us on the MM-100. Today I remeasured the width on the H7 and it's now 41us. Just wondering if anything could have changed the IO access time in firmware upgrades? I don't have the first release of the firmware go back and try. BTW Everything still works, just wondering why the transition time changed? Thanks. NANO Inverter: Full download - Only Hex Ver 8.1Ks |
||||
| JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 4135 |
The early release(s) look to be here John |
||||
| seco61 Senior Member Joined: 15/06/2011 Location: AustraliaPosts: 205 |
Hi. Using the following code on my H7 using the latest v5.05.06 firmware (2019-05-10_231917_Armmite1.3.zip): SetPin 111,DOUT do Pin(111)=0:Pin(111)=1 loop I have a positive pulse of 6.3uS, a negative pulse of 5.2uS and a total period of 11.5uS. With the following code: Const Clock_1=111 SetPin Clock_1,DOUT do Pin(Clock_1)=0 Pin(Clock_1)=1 loop I have a positive pulse of 8.2uS, a negative pulse of 7.1uS and a total period of 15.3uS. Regards Gerard (vk3cg/vk3grs) |
||||
| matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 10572 |
MMBasic does a sequential search through the variable list to find a variable, the variable names are not sorted but are in the order of declaration (I think). In a large program with lots of variables this will take time. For time critical variables declare them first and keep names short. Using a number, as per seco61 demonstrates, is likely to be the fastest even if bad programming practice. If Geoff is listening, it would be great to convert all variable names to two byte hash tokens together with in-built functions and commands and user functions. This would make stored programs much smaller and faster but would be a huge change to the MMbasic core. |
||||
| KeepIS Guru Joined: 13/10/2014 Location: AustraliaPosts: 1945 |
Hi and thanks Gerard for taking the time to test that (I'm not going mad) and Peter for the explanation and reminding me what I'm programming under. FYI: 1: The pin declarations are right at the head of the file. 2: Changing to a 3 letter name reduced the Neg Pulse by 8us to 33us. 3: Using pin numbers directly (thanks Gerard) dropped the negative pulse time from 41us to 6.2us. The program is big and complex, but I will hard code the pin numbers for the two data decoders as they are clocking in up to 52 bits of data in each packet. It has to be clocked and read in a tight loop as any stretching of the LO pulse past 100us is seen as a request for a new packet (start). Early on I had a big fight with touch interrupts as these are out of my control in MMBasic, I abort any packet that is interrupted by Touch using a flag set in the Touch UP/Down ISR. You can imagine how long the LO pulse is stretched when a Touch ISR fires BTW: My Touch ISR only sets 3 flags and a global key code and exits, can't get much shorter than that. FYI Now at: 1150 variables 202 GUI elements 14 GUI pages 8,374 lines of code 24 Functions 81 Subs 33 IO pins - Above those already dedicated to the LCD, SD, COM etc. I know I've said this before, but I'm going to repeat it, with the ARM H7 it's easy to forget that you are running under MMBasic. Once again, what a fantastic job Geoff has done with MMBasic and with Peters fantastic work and coding skills with his port of MMbasic to the ARM, programs that would have been to big and slow on the MM100 are blazing fast on the H7. I'm just blown away with this platform for us weekend hobbyist coders. Thank you all again. Mike. NANO Inverter: Full download - Only Hex Ver 8.1Ks |
||||
| Tinine Guru Joined: 30/03/2016 Location: United KingdomPosts: 1646 |
Sounds like a pre-processor might be in order with options to shorten names and replace constants with literals(?) |
||||
| The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |