Announcement

Collapse
No announcement yet.

35DT uart with PIC18 problem

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

  • 35DT uart with PIC18 problem

    Hi Dear, I tried one month for this, so it's really a headache.
    I use GEN4-ULCD-35DT connect to PIC18F26K22, through UART (EUSART). It's beautiful to see ADC of PIC18 sends things to 35DT only , or PIC18 sends 6 bytes order to 35DT, working well.
    But problem starts when run TX and RX both.
    Because when PIC18 sends things to 35DT, 35DT will automatic send an ACK byte back (0x06 or 0x15), this ACK byte mess up things.
    For 35DT, ACK is Tx to Pic, and Button (i.e.) is Tx to Pic too, it mess the RCREG of Pic.
    I try to clear RCREG of Pic of one byte, then try to get 6 byte of an 35DT Tx (like a button press), it will never work properly.
    For the last, HOW, HOW can we stop 35DT to send the ACK byte ? That's the key of mess.

  • #2
    No the ACK does not mess things up, it's just as important as everything else. Notice how the ACK is 0x06 and the 6 byte code does not start with 0x06.

    I think what's happening is the 6 bytes are being lost because you have not set up a receive interrupt and buffer on your PIC. But that's a different problem, it has nothing to do with the ACK
    Mark

    Comment


    • #3
      Hi Mark, thank you. The problem is I do not know how many ACK bytes sent to PIC (i.e. at ADC reading continuously, and ADC send many info to 4D), You do not know how many ACK should be clear, it's a headache. How can I stop this ACK byte from 35DT? How to forbidden it sending out automatically, I do not need it.

      Comment


      • #4
        You get one ACK for each command you send to the display, you need to wait until you get the ACK before you send the next command. If you don't then there's a risk you will overrun the comms buffer and break everything.
        Mark

        Comment


        • #5
          Thank you Mike, Any possible way to STOP the ACK from 35DT?
          Your suggestion of "wait until you get the ACK before you send the next command" is not applicable, as I would like to see PIC ADC result continuously, and use 4D 35DT button to do other things in between, that's quite normal.
          Last edited by jyu3023; 12 June 2021, 09:44 AM.

          Comment


          • #6
            OK, dear, can you point me a site of "set up a receive interrupt and buffer on your PIC" ?
            From my understanding, no matter "0x06" or 6-bytes, anyone will cause an interrupt, why use interrupt. Thanks

            Comment


            • #7

              Good day!

              Based on the conversion above, I assume you are using the ViSi Genie environment.

              Since you are writing to the display, it's most likely that you are sending a WRITE_OBJ command. As you already know, this command is 6-bytes in length and after sending, you'll receive either an ACK or a NACK.

              Originally posted by jyu3023 View Post
              Any possible way to STOP the ACK from 35DT?
              It is not a good idea to stop the ACK from happening or even ignore it. As mentioned already, the ACK is necessary to ensure that the display wont be overrun by commands coming from the host (in your case, the PIC microcontroller).

              Originally posted by jyu3023 View Post
              Your suggestion of "wait until you get the ACK before you send the next command" is not applicable, as I would like to see PIC ADC result continuously, and use 4D 35DT button to do other things in between, that's quite normal.
              I don't see why waiting before sending the next command is not applicable. I assume you are thinking that while waiting for the ACK response, you can't do anything else. This not exactly true. You could still do other things while waiting for the ACK response. This will just be a matter of your program design.

              Setting up interrupt and buffer may help you better handle UART data being received from the display.

              Originally posted by jyu3023 View Post
              can you point me a site of "set up a receive interrupt and buffer on your PIC" ?
              From my understanding, no matter "0x06" or 6-bytes, anyone will cause an interrupt, why use interrupt. Thanks
              I'm not quite sure what you are asking about interrupts. Basically, interrupts are used to ensure the signal or event is acted upon immediately regardless of what the processor is doing. In this case, if you setup an RX interrupt, your program will immediate process all incoming data. Data received this way can then be stored into a buffer for when the main program is ready to process it. This method ensures that bytes are not missed (assuming the buffer is not overrun).

              Regarding how to configure interrupt and set up a buffer, you should be looking into PIC forums and Microchip resources. Here's one article I found that might help.


              Please keep in mind that your goal should be to ensure that you receive all data from display and not overrun the display's buffer. And the best way to do this is to ensure that the display is ready before you send the next command.

              I hope this gives you a better idea of what you need to consider and accomplish.

              Best Regards
              Juniel Cruz

              Comment


              • #8
                Thank you Juiel, seems I have to accept the ACK, and looking for solution in PIC side 🤣

                Comment

                Working...
                X