Announcement

Collapse
No announcement yet.

Converting from SGC to GFX

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

  • sspence65
    replied


    Here is a subset of the canned messages I need to put on the screen:

    Over MP390
    MP390
    MP340 MP390
    MP340
    MP280 MP340
    MP280
    MP230 MP280
    MP230
    MP200 MP230
    MP200
    Below MP200
    MP Match
    MP Sort
    MiniPump

    Let's say ID's 1-14 come across respectively (I can use numeric ID's, right?), how do I make a lookup table, and display the correct text at a given location?

    Leave a comment:


  • sspence65
    replied


    ok. I removed that gfx_Cls() in state IDLE and things worked a whole lot better.

    Leave a comment:


  • 4DSysFan
    replied


    Define a bunch of constants, like PART_OUTSIDE_ACCEPTED_RANGE, RETRY_PART_CALIBRATION, etc
    Then use those when you need to send the message, makes it self-documenting,,,,

    Leave a comment:


  • sspence65
    replied


    Ok I'm sending 3 variables as so:

    [HTML] int req = 5; //mic REQ line goes to pin 5 through q1 (arduino high pulls request line low)
    int dat = 2; //mic Data line goes to pin 2
    int clk = 3; //mic Clock line goes to pin 3
    int i = 0; int j = 0; int k = 0;
    byte mydata[14];
    int num;


    void setup(){
    Serial3.begin(9600);
    Serial.begin(9600);
    pinMode(req, OUTPUT);
    pinMode(clk, INPUT);
    pinMode(dat, INPUT);
    digitalWrite(clk, HIGH); // enable internal pull ups
    digitalWrite(dat, HIGH); // enable internal pull ups
    digitalWrite(req,LOW); // set request at LOW

    }
    void loop(){

    // get data from mic
    digitalWrite(req, HIGH); // generate set request
    for( i = 0; i < 13; i++ ) {
    k = 0;
    for (j = 0; j < 4; j++) {
    while( digitalRead(clk) == LOW) { } // hold until clock is high
    while( digitalRead(clk) == HIGH) { } // hold until clock is low
    bitWrite(k, j, (digitalRead(dat) & 0x1)); // read data bits, and reverse order )
    }
    // extract data
    mydata[i] = k;
    // sign = mydata[4];
    // decimal = mydata[11];
    // units = mydata[12];


    }

    // assemble measurement from bytes
    char buf[7];
    for(int lp=0;lp

    Leave a comment:


  • sspence65
    replied


    I'm just a simple mind, lol

    I could. There's about 49 canned strings to store. It's going to make the Arduino code unclear, unless I document well.

    Leave a comment:


  • 4DSysFan
    replied


    Ha Ha, great minds think alike......

    Leave a comment:


  • 4DSysFan
    replied


    Just to clarify, do you need to send text? You could define message ids to display canned text messages versus send the text over the com port....

    Leave a comment:


  • sspence65
    replied


    Would it be easier if I sent numeric codes for pre written strings on the uVGA?

    Wouldn't be as clear on the code side on the arduino though.

    Leave a comment:


  • 4DSysFan
    replied


    Yes, I saw the picture. Should be very easy to do.....
    Go through and eliminate all of the debugging print code, as well as the gfx_Cls() in state IDLE.
    Handling text requires more work to the existing code, as that was not part of the design intent of the original poster.
    1) Need to make sure that RX_MSG_MAX_SIZE is defined large enough so the buffer can hold the largest message.2) Need a method to determine what data is to be in each variable. I would recommend segregating all numeric messages to be between 'A' and 'Z', and all text to be between 'a' and 'z' (for example)3) easiest method would be to remove numeric validation from stateGETMSG. Then, set up stateGETMSG to continuously accept any data until a CR is received or the buffer length is reached.4) Set up Process_Msg to handle the data differently depending in what range the variable ID is in.

    Leave a comment:


  • sspence65
    replied


    Ok, I know have a flashing screen with the format string across the top and msg valid
    and I see A = 6665

    Which is correct. Did you see the photo of where I want to go with this?

    I'll go through my Arduino code and setup each of those screen elements as A, B, C, D, etc. and dump the bin numbers and Text into them. I assume I can send text strings the same way?

    Leave a comment:


  • 4DSysFan
    replied


    Silly question, but did you move your TX/RX wires to the other (com1) pins?

    Leave a comment:


  • 4DSysFan
    replied


    If you'd like, I could go through the code and take out all of the debugging related prints, etc, unless your fine with doing that....

    Leave a comment:


  • sspence65
    replied


    I'm using "A"

    Serial3.print("$");
    Serial3.print("A");
    Serial3.println(num, DEC);

    But not getting anything on the screen other than Com Test, Message Parser.

    I do get a

    Notice: local var 'mainloopcounter' in func 'main' is never used (line 39 file:ComStateMachine.4DG)

    when compiling. Why can't the errors/warnings/notices be "copied" to the clipboard?

    Leave a comment:


  • 4DSysFan
    replied


    I'd read through the code to make sure you hit all of the required com changes, like com_Error(), com_Count(), etc.....

    Leave a comment:


  • 4DSysFan
    replied


    The message format is:....
    So as long as println sends a decimal 13 at the end of the line, you should be ok....
    The ID can be any number other than '$', so your could use 'A', 'B', 'C', 'D' etc

    Leave a comment:

Working...
X