Announcement

Collapse
No announcement yet.

gen4-ULCD-50DT-SB gauge linking using visi

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

  • gen4-ULCD-50DT-SB gauge linking using visi

    Hi, I'm currently using the gen4-ULCD-50DT-SB with visi for different type of display with an Arduino Atmega 328 and I am not able to find any function or part of code to link a numerical value lets say a resistance or a temperature to different type of gauge. I'd like to know how I can do this thank you

  • #2
    Hi Alexandre,

    Basically, widgets and gauge can be boiled down to frames or states.
    For example, you have a coolgauge to show a temperature. The max value of this coolgauge is 100.
    This means that the coolgauge has 100 states or frames displaying the needle pointing to the number/value.

    Therefore, you need to do all calculations before providing your value to a widget.
    Note that the widgets cannot display negative values, and the maximum value denotes the highest number it can display (becuase there are no images/frames/states more than the max value)
    So you may need to map your numerical values, like for the example above, map your value from 0-100.

    Here are some projects that might help:

    Portable Breathalyzer
    http://4dmakers.net/projects/details...e-breathalyzer

    Fire Alarm
    http://4dmakers.net/projects/details/fire-alarm

    Temperature Indicating Controller
    http://4dmakers.net/projects/details...ing-controller

    Flow Indicating Controller
    http://4dmakers.net/projects/details...ing-controller

    Let me know if this solved your inquiry.

    Comment


    • #3
      Thank you it helped a lot!, is there any code example for SPI communication between the Diablo 16 and an arduino? I could not find one on the Appnote.

      Comment


      • #4
        Hi

        This is the code I used on an Arduino Leonardo. The Dispaly would be connected to the 6 way ICSP header on the Leonardo so the SS line would be controlled via a pin_Set from the display before sending a SPI value. It will be the Display as the SPI master polling the Arduino.

        Code:
        #include "SPI.h"
        
        void setup(){
          SPI.attachInterrupt();
        }
        
        void loop(){
        }
        
        ISR (SPI_STC_vect) {
          byte c = SPDR;  // grab byte from SPI Data Register
          if (c > -1 && c < 30) {
            SPI.transfer(spibuf[c]);
          }
          if (c == 241) {
            calInit();
          }
          if (c == 242) {
            saveCal = 1;
          }
          if (c > 29  && c < 132) {
            P0 = 950 + (c - 30);
          }
          if (c > 131 && c < 232) {
            P1 = c - 132;
            P1 = P1 / 100;
          }
          if (c > 233 && c < 238) {
            baud = c - 233;
            baudchng = 1;
            baudchange(3,baud);
          }
          if (c == 240) {
            full_Reset();
          }
          if (c == 238) {
            saveQfe();
          }
          if (c == 243) {
            SPI.transfer(fix);
          }
          if (c == 244) {
            SPI.transfer(gpsrx);
          }
        }
        And this is a function I used on the display to send a request


        Code:
        func GetHeading()
        
          if(calibmode == 0)
          pin_LO(PA0);  // Set SS Low
          SPI1_Write(1);
          SB[1] := (SPI1_Read());
          //pause(1);
          SPI1_Write(2);
          SB[2] := (SPI1_Read());
          heading := SB[1] + (SB[2] << 8);
          pin_HI(PA0);  // Set SS High
          endif
        
        endfunc
        I hope this helps

        Best regards

        Paul

        Comment


        • #5
          Thank you very much Paul ! Yess it heped a lot!

          Comment

          Working...
          X