Announcement

Collapse
No announcement yet.

OLED Logic Issues

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

  • #16
    Well, I managed to get it consistently and properly working with the array and everything. Still not working with the microcontroller, but I suspect that is now an issue with that particular piece of hardware, not the code nor the oled. Just in case I have been misinformed, and the microcontroler is actually putting out ASCII, I would appreciate it if you could let me know if you find anything on how to convert from an ASCII string of binary to a real number. Thanks for the help.

    Comment


    • #17
      Hi Patrick,

      You could connect the micro-controller to the Terminal in Workshop which is under the Tools tab. The programming adapter for the display could be connected to the micro-controller for this test. This will show exactly what is being sent and you could also post a screen shot here so we know how best to handle the data.

      Best regards

      Paul

      Comment


      • #18
        I have a secondary piece of hardware that I use to verify the output of the microcontroller. I'm a bit more interested in converting from an ASCII string to its numerical value. Even just using the terminal, I cannot get anything to return better than 00 without just assigning literal binary values where I need them. I suspect this is due to serin(). If I understand correctly, serin() is just going to assemble a string of the sent input, or rather, allow for the creation of a character array containing the characters sent as input to the OLED. Unless I am way off here or I am missing something, it would appear the final piece to this puzzle lies in conversion from an ASCII char array to each element's respective numerical value.

        Comment


        • #19
          Hi Patrick,

          I made this bit of code to convert two 8bit binary numbers to one value. The only problem is that the binary strings have to be 8 chars so it might be best to create an array from the sent ASCII string.

          Code:
           var a[8];
              var v;
              var n;
              var value;
              to(a);print("00000000");
              to(APPEND);print("00000010");
              v := 0x8000;
              for(n := 0; n < 8; n ++)
              if((a[n] & 0xff)== 49) value := value + v;
              v := v >> 1;
              if((a[n] >> 8)== 49) value := value + v;
              v := v >> 1;
              next
              print(value);
          It puts together two 8 bit binary strings into one 16 character string and then converts the whole 16 to a value.

          Best regards

          Paul

          Comment


          • #20
            That solves my problem exactly. Again, thank you so much for your help.

            Patrick

            Comment

            Working...
            X