Jump to content
 

N9WXU

Member
  • Content Count

    106
  • Joined

  • Last visited

  • Days Won

    37

Blog Comments posted by N9WXU


  1. More Data!

    I just got a Teensy 4 and it is pretty fast.

    Compiling it in "fastest" and 600Mhz provides the following results.

    image.png

    Strangely compiling it in "faster" provides the slightly better results. (6ns)

    image.png

     

    This is pretty fast but I was expecting a bit more performance since it is 6x faster than the Teensy 3.2 tested before.

    There is undoubtedly a good reason for this performance, and I expect pin toggling to be limited by wait states in writing to the GPIO peripherals.  In any case this is still a fast result.

    • Like 1

  2. Standby for a introduction to embedded... the ASM version.

    But suffice to say, the PIC assembler (MPASM) does understand #define for creating macro's just like in C.

    Setting breakpoints works the same way as in C but it is a bit more clear because you can set the breakpoint on exactly the instruction you want to stop at.

    The biggest hassle with ASM programming is the lack of any kind of support anything not supported by the ISA.


  3. Fantastic.  I "unfortunately" remember those olden days of writing DLL's for use in Windows 3.1.  One of my first JAVA experiences was writing a DLL to call a JAVA program to access hardware for an embedded system.  There is a long list of things that don't "quite" work the same in C++ and C, never mind the differences between the different revision.


  4. Here is the advanced course version in assembly language

    bank0	udata
    delayLow	res 1
    delayHigh	res 1
        
    RES_VECT  CODE    0x0000            ; processor reset vector
        GOTO    START                   ; go to beginning of program
    
    MAIN_PROG CODE                      ; let linker place main program
    
     #define delayValue 10000
      
    go_slow
       banksel  delayLow
       movlw    low delayValue
       movwf    delayLow
       movlw    high delayValue
       movwf    delayHigh
    slow_loop
       decfsz   delayLow
       goto	    slow_loop
       decfsz   delayHigh
       goto	    slow_loop
       return
     
    START
    
        BANKSEL TRISA
        CLRF    TRISA
    
    loop
        BANKSEL PORTA
        BSF	    PORTA,2
        call    go_slow
        BANKSEL PORTA
        BCF	    PORTA,2
        call    go_slow
        GOTO    loop
    
        END

    It works exactly the same way as the C version.


  5. If you experience strange behavior with MPLAB double check your simulator stimulus files for bad syntax.  I just created a stimulus file for a blog post that will hit tomorrow morning.  I inadvertently placed two sequential quotation marks at the start of a string.  like this:

    ""lots of stuff to send"

    As soon as the simulation was started, MPLAB went into the weeds.  Some stuff could be clicked on, but in the end I had to kill the process and restart.  Only by checking everything with a second pair of eyes was the problem detected.

  6. The Story of Mel


    This brings back memories.  As I developed as a programmer, the role of Mel (and his suitability as a role model) has also shifted.  Of course we all strive to be Mel when we start out.  The idea that we have such in-depth knowledge of our system that we can create the tightest possible code and take advantage of the most esoteric of "features" seems like the epitome of super programmers.  Of course as I matured, I learned that this knowledge was incredibly powerful and certainly the ability to use it was an asset but like the old saw, "with great power comes great responsibility".  Today, I think the best analogy would be "absolute power corrupts absolutely". I would love to manage a software team with the knowledge and experience of Mel, but I would hate to manage Mel, because in the end, he would cost me a huge amount in future maintenance costs as only another Mel + lots of time could possibly support his work and no program ever survives contact with the users so the inevitable new feature would be a disaster.

     

    That aside, be sure to read the detailed explanations.  They are as fascinating as the original story.

    https://jamesseibel.com/the-story-of-mel/

    https://medium.freecodecamp.org/macho-programmers-drum-memory-and-a-forensic-analysis-of-1960s-machine-code-6c5da6a40244

     

    • Wow 1
×
×
  • Create New...