Shop OBEX P1 Docs P2 Docs Learn Events
Receving information through serial port — Parallax Forums

Receving information through serial port

diademdiadem Posts: 3
edited 2009-05-04 21:06 in General Discussion
Ok let me try and explain the project I'm working on. I have a javelin stamp demo board with a ds1620 connected to it. That is constantly sending data over the serial port to a VB terminal i have coded. The VB terminal displays the current temp and also sounds an alarm when my preset High and low thresholds are exceeded. I also have it set so that the javelin takes x number of samples of the temp and then reports the average temp. this is to eliminate the alarm from sounding if a spike in temperature occurs suddenly.

the problem I am having is when i try and send over the settings. I cant figure out how to make it so that the javelin stores the right values for each one of the settings. I can send a high threshold of 50 for example and it stores it fine. but any time i try to make it say 105 it moves the "5" down to the next setting. it seems incapable of storing anything with 1 digit or 3.

say for example im sending a High Threshold (HT)of 105, a Low threshold( LT)of 60 it would report it as HT 10 and LT 56
I cant seem to fix it.

I hooked up an LCD to my board just to verify that the numbers where being sent and no matter what I try i cant get it to work any help would be appreciated.


I attached a copy of my java code if you would like to see the vb code as well just ask

Comments

  • diademdiadem Posts: 3
    edited 2009-05-04 15:06
    so I just figured out that the VB is sending over the ASCII equivelent of the first decimal digit and ignoring the rest,· I am inputing. Is there a way to have it recive each bit besides breaking them up into 3 seperate digits on the vb and then reasembling it on the java side?? is there an Ascii to Decimal function i can use or something ?
  • diademdiadem Posts: 3
    edited 2009-05-04 20:49
    is there a reason, no ones helping me [noparse]:([/noparse]
  • jmspaggijmspaggi Posts: 629
    edited 2009-05-04 21:06
    Hi,

    I will try to help you [noparse];)[/noparse]

    I'm also using a DS1620 and here is what I'm using to display the temperature:

                int value = hotWaterTop.getTempRaw();;
                int tempHigh = value >> 1;
                int tempLow = value - (tempHigh << 1);                        
                Format.itoa(tempHigh, charBuff);
                screen.write("Hot W. Top: ");            
                screen.write(charBuff);
                System.out.println("<hotwatertop>");
                System.out.print(tempHigh);            
                if (tempLow > 0)
                {
                    screen.write(".5");
                    System.out.print(".5");
                }
                System.out.print(CR);
                screen.write("  ");
                System.out.println("</hotwatertop>");
    
    



    charBuff definition:
            char[noparse][[/noparse]] charBuff = new char[noparse][[/noparse]6];
    
    



    This code display the temperature on the LCD screen and also on the console with XML format. Then I retreive it on a compture for storage.

    Hope it helps.

    JM
Sign In or Register to comment.