No announcement yet.

Why library right shift command before sending it

  • Filter
  • Time
  • Show
Clear All
new posts

  • Why library right shift command before sending it


    I was looking through the picaso driver library for ardunio and I notice the code always right shift the command by 8 bits before sending it. Why does it do this?

  • #2
    Writes to serial ports are only 8 bits wide, since the commands are 16 bites wide you need to right shift it to enable it to write the high byte first. (assuming I understand your question properly)


    • #3
      But you could stream data through the UART on the ATMEGA. Is the 8bit width a hardware issue on the uLCD modules?
      if I was to write all 4 bytes would the buffer on your module over flow?

      Better question would be what is the buffer size of your module? That is how many bytes can I stream to your processor before it over flows? Because if I am going to write my own driver code I won't be writing 8bits only. I would write an entire stream of data at once.


      • #4
        As I said, Serial is always transmitted as 8 bit bytes. Streaming is really just writing multiple bytes consecutively. Maybe an ATMEGA 'understands' how to turn 'all 4 bytes' into the appropriate stream, for ANSI strings it probably does, for a 32bit integer I doubt it as the 'endianness' of the target could vary.

        Our modules can buffer a single command in general, so you need to wait for the ACK's before sending another command.


        • #5
          Yup, I know how serial protocol works. But as per efficiency doing multiple calls is not efficient. I can pass a buffer directly into hardware and have GP run other task so I don't have it wasting clock cycles.
          As I have implemented my own UART in VHDL I can build the hardware to run how ever I want. That is the buffer size can be how ever big I choose given that I have enough fabric on my FPGA. Don't see the need for anything bigger than a 16byte single buffer FIFO. And Since it hardware I can stream with out having the processor do much.
          Anyway thanks for your help at first I thought that your hardware can only handle a 8bits before it over flows.