This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

8051 hexapod problem

hi. i have several problems with my project(hexapod walker).one is when the code jumps into an ISR when an interrupt occurs for the front sensor,it wont back in the main program.it will only jump into the ISR after that when the interrrupt pin is enabled. another problem does anyone know what F0 does.general purpose flag????

Parents Reply Children
  • o.k sorry. im doing my code in ASM.
    this is Part of the code:

    ORG 0
    USING 0
    JMP main
    ORG 0013H
    JMP external1ISR
    main:
    MOV TMOD,#10H
    CLR F0 SETB EX1
    SETB IT1
    SETB EA
    foward: CLR P1.0
    CALL delay
    JNB F0,skip1
    JMP main
    skip1: SETB P1.0
    *
    *
    *
    BUSY WAITING DELAY
    *
    *
    external1ISR: ;reverse and turn code
    CLR P1.3
    CALL delay
    SETB P1.3
    SETB F0
    RETI
    END


    ok in the main program the hex is walking forward. whats happening now is that. when it jumps into the ISR,it will not jump into the main program when the ISR is complete. it keeps jumping into the ISR every time u apply a negitive edge to P3.3(external interrupt)

  • you call delay from both main and ISR. Just visualize that the interrupt happen while delay is executed from main

    Erik

  • i forced the timer overflow at the end of the ISR. the problem was it was jumping back into the delay and waiting. not thats solved. i need a way of keeping track of the motors position.