Announcement

Collapse
No announcement yet.

Loc() with PB3.5 and PBVision

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

  • Kerry Holmberg
    Guest replied
    Delay seems to suspend com port processing
    Instead of using Delay .15, make a Sub as follows then call it instead of using the Delay.

    Sub ComDelay
    Etime=Timer+.15
    Do
    If Timer>=Etime then Exit Sub
    Loop
    End Sub

    Note that there is one problem with this, If the Etime value goes over 86400 (when the timer recycles to 0 at midnight) the value of Etime will never be reached and the loop wil never exit. There are ways to work around this but thats a whole other program, this should get you past your current problem.




    ------------------

    Leave a comment:


  • Tom Hanlin
    replied
    PB/DOS 3.5 has been out for more than five years now and is often
    used for telecommunications work. There are no known problems with
    the comm handling. Odds are, there's something that's changed in
    your code.

    ------------------
    Tom Hanlin
    PowerBASIC Staff

    Leave a comment:


  • Mike Burgett
    replied
    Tom,

    Thanks for the reply. I have other code elsewhere in the program
    that I tried when this routine fails. So I can confirm that the port
    is opened and that communications are possible. Like I described above,
    I can send the command "P" out the serial port then DELAY .15 then
    INPUT #3, dummy$. And that works. But the program hangs when I attempt
    to wait until there is something in the buffer. The same code works
    in PB3.2 without vision. Hmmmmmmmm


    Thanks

    ------------------
    Michael Burgett

    Leave a comment:


  • Tom Hanlin
    replied
    LOC is fine. Make sure your serial cables are firmly attached and,
    don't forget to check ERR, especially after opening the COM port.

    ------------------
    Tom Hanlin
    PowerBASIC Staff

    Leave a comment:


  • Mike Burgett
    started a topic Loc() with PB3.5 and PBVision

    Loc() with PB3.5 and PBVision



    I am converting an older program written in PB3.2 to PB3.5 and
    PBVision. I am communicating with a Jaguar Scale Unit via Serial
    Port COM1. To describe my process, I send a "P" to the scales and
    it send back a String containing the current weight. The function
    is needed to make sure that a response is received from the scales.
    This function works fine under PB3.2 but just appears to stall out
    when compiled under PB3.5 and PBVision. The program hangs (or never
    leaves) the DO:LOOP routine. This code did work until updated. I
    removed the LOC code and utilized just a .15 second delay and then
    read the port and thats fine. But I still need to have some way to
    know when to resend the "P" so the main program does not hang. Is
    LOC the problem here?

    FUNCTION ReadWt 'send a 'p' to the scale and it will send back
    ST=TIMER
    PRINT #3,"P";
    DO
    IF LOC(3) > 5 THEN EXIT DO ' Exit Do when something comes in from port
    IF TIMER > ST+0.5 THEN
    PRINT #3, "P"; ' IF TIMER TIMES OUT THEN SEND ANOTHER P
    ST = TIMER
    ITERATE
    END IF
    LOOP
    INPUT #3,X$
    ReadWt = VAL(MID$(X$,9,7)) - zeromv
    END FUNCTION

    ------------------
    Michael Burgett
Working...
X