DT-Ints latency and other interrupt conciderations


Closed Thread
Results 1 to 40 of 59

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,623


    Did you find this post helpful? Yes | No

    Default

    Ioannis,
    Nah, it should be doable with the 18F series - I'm almost there now. Like I said earlier I have a comercially available drive that is based on the 18F2431 and it works fine, step-rate specified to 400kHz (not verified) and USB interface thru some FTDI-chip.

    I've got the code from AN744 working "inside" a very simple PBP program - 5 lines of PBP code and 200 lines of ASM. Now I only need to figure out HOW it works so I get it to do what I need. I may opt for interrupt driven RX and polled TX though.

    Anyway, I think I'll start a separate thread for that...

    Thanks!
    /Henrik.

  2. #2
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,170


    Did you find this post helpful? Yes | No

    Default

    The AN I think is 774 not 744. The driver you have might be based on pure assembly. What clock does it have?

    Ioannis

  3. #3
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,623


    Did you find this post helpful? Yes | No

    Default

    Of course, you're right! I've mentioned it twice now and managed to get it wrong both times.

    Obviously I don't have access to the source code for the drive but I was told by the developer that he was using MPLAB+BOOSTC (that probably means ASM for the time critical stuff and C for the rest). I don't know what oscillator speed it uses but I suspect it's 10*4MHz.

    /Henrik.

  4. #4
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,170


    Did you find this post helpful? Yes | No

    Default

    It makes sense to be so. Are you clocking at this speed too?

    Ioannis

  5. #5
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,623


    Did you find this post helpful? Yes | No

    Default

    The protoype, on which I managed to get 60kHz+ yesterday, is still running on 20Mhz which makes me believe I should be able to reach my target of 100Khz even after adding the "front end" and some other features.

    But right now these serial routines is making me go nuts....

  6. #6
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,170


    Did you find this post helpful? Yes | No

    Default

    Well, if you go from 20 to 40 MHz then your nice 60KHz is made with no pain 120KHz. That is more than 20% of your target, leaving you with a margin for the serial communication.

    Why not try this first, to ease the pain?

    Ioannis

  7. #7
    Join Date
    Dec 2009
    Location
    Kalamazoo
    Posts
    42


    Did you find this post helpful? Yes | No

    Default one more question for Mr Henrik;

    once again, thanks for the wonderful pid filter. im still troubleshooting, and my main problem is this;
    Code:
     MAIN:                                             
         IF POSITION < SETPOINT THEN                  ;decreasing the setpoint                
         pid_Error = setpoint - position            ;calculate error
         ENDIF
         IF POSITION > SETPOINT THEN                  ;increasing the setpoint
         PID_ERROR = 65535-(POSITION - SETPOINT)    ;calculate error                                                              
         endif         
         gosub pid                                  ;take error to pid filter  
         DIRECTION = pid_out.15                     ;determine direction
         PID_TEMP = ABS PID_OUT
         DUTY = PID_TEMP                            ;load duty cycle from pid_out
         select case DIRECTION                      ;direction bit to control    
         case 0                                     ;  hpwm 1 for forward or hpwm2     
         GOSUB FORWARD                              ;  for reverse to corresponding
         case 1                                     ;  h-bridge circuit 
         GOSUB BACKWARD                             ;
         END SELECT
         LCDOUT $FE, $80, "POS=" ,DEC5 POSITION, " SP=" ,DEC5 SETPOINT; temporary
         LCDOUT $FE, $C0, "DT=" ,DEC5 DUTY, " ERR=" ,DEC5 PID_ERROR   ; temporary                 
         goto Main
    my calculated pid_error jumps from 65534 to 00001 , skipping two numbers; 65535, and 00000. i have the recommended position calculation,
    Code:
     position = 256*poscnth + poscntl
    this runs from a dt_interrupt (thanks Darrel Taylor). i tried to change setpoint and position variables to byte, instead of word, but pid filter works on word variables, and all calculations get messed up. any solutions? this has been my biggest headache on this project, for the last three weeks. and any help from anyone will be highly appreciated. thanks in advance.
    NAG CON WIFE!
    WIFE VAR MOOD

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts