Announcement

Collapse
No announcement yet.

How uart work in picbasiprofessional

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How uart work in picbasiprofessional

    I am developing a serial transmission with a HARDWARE module. I use two pic 18F26K20, one to send one to receive. The software to transmit is OK. The software to receive is not OK. In the PIC received, there is a MAIN .. GOTO MAIN loop that sends the received characters to the COMPUTER. When the bytes arrive on the serial line, the interrupt is triggered and the receiving PIC reads the bytes. Every time it receives the bytes avveien a flashing of an LED for 10 ms. After having read the incoming bytes for 28 times, the receiving PIC locks and the LED stays on as the PIC is blocked. .


  • #2
    Sorry, i attach software
    Attached Files

    Comment


    • #3
      I don't see how the line:

      If rx_ok=1 = 1 Then '

      will even compile.
      Dave Purola,
      N8NTA
      EN82fn

      Comment


      • #4
        I copied and pasted the software from the source. here is a gluing error on the forum.
        he correct writing is:

        MAIN:

        If rx_ok=1 Then '


        The software reads data well from serial and the LED flashes every time it receives data. After 28 receptions the LED stays on (strange) and all the PIC is nailed. I probably do not handle the UART at the buffer level or anything else.

        Comment


        • #5
          Lupo18, What processor are you using? I see NO return from your interrupt handler. There should be "RETFIE" at the end to return from it. The stack is probably being overloaded with the lack of returns. You should NEVER return from an interrupt with a GOTO statement. This topic is covered in section 6.2 of the PBP manual at about page 248.
          Dave Purola,
          N8NTA
          EN82fn

          Comment


          • #6
            I use two PIC18F26K20, first to transit secondo to receive. How can i exit from interrupt not using go to? Thanks

            Comment


            • #7
              Originally posted by lupo18 View Post
              I use two PIC18F26K20, first to transit secondo to receive. How can i exit from interrupt not using go to? Thanks
              "There should be "RETFIE" at the end to return from it."
              If your interrupt is ASM (Assembly Code), then the Return From Interrupt Command is RETFIE. If you are using the Daryl Taylor DT_INTs, then the command is @ INT_RETURN. If using the standard PBP Interrupt, RESUME is the command that takes you back to Earth. Once in an Interrupt, there are several States that are saved to specific registers. When using the appropriate Return command, these Registers restore previous operating states and Return to the address (Program Pointer) from the Stack (Stack is covered in the Data Sheets). A GOTO command keeps loading the Stack. Eventually you get what is called a Stack Overflow, which causes a RESET (if you enable it in the CONFIG Registers).

              Instead of trying to learn a bunch about the PIC architecture, figure out which of the Return-type commands you need and replace your GOTO with it. See if it works.
              We can crack this cotton PIC'n thang!

              Comment

              Working...
              X