The Museum of HP Calculators

HP Forum Archive 01

[ Return to Index | Top of Index ]

HP48SX program HELPPPP...
Message #1 Posted by Tal on 8 Nov 1999, 1:23 a.m.

Hi There, I tried to write a simple program that receives ASCII characters (from RS232 port), and performs any task according to it (for the HP48SX calculator). I spent lots of time programing it and I don't understand why the program dosn't performs the CASE loop instructions. I will appreciate very much if you can help my to solve the problem. The program is:

%%HP: T(1)A(D)F(.); CLLCD ERASE DO @ START INFINITY LOOP.

1 SRECV DROP NUM A @ RECEIVE CHARACTER TO LOCAL VAR. A.

CASE @ START CASE LOOP.

A 50 SAME @ ASCII 50 IS 2 KEY?.

THEN

"TWO" @ PRINT "TWO" IF 2 KEY IS PRESS.

END

A 50 @ IF OTHER KEYS PRESS?.

THEN

A 1 * @ PRINT ASCII CHR. OF A KEY.

END

END

UNTIL 0 @ INFINITY LOOP. END

Thank you, Best regards, Tal. email: td@chem.ch.huji.ac.il

      
Re: HP48SX program HELPPPP...
Message #2 Posted by Joe Panico on 8 Nov 1999, 9:32 a.m.,
in response to message #1 by Tal

Tal,

Your second test "A 50" doesn't have a test condition, so the CASE takes the 50 from the stack as the flag condition for the statement. (Remember, many languages test as follows : 0 = FALSE; All other numbers = TRUE ).

Also, you should remember to OPENIO at the start of the program and CLOSEIO at the end. I read that closing the I/O extends battery life. Change your IOPAR variable, fourth value to 1 so that handshake is on between the PC and the 48.

I have tried something like this before using the 48 User code with limited success. The input buffer reads only 255 characters, you have no direct control over the serial port, etc,etc.etc. Keep trying but expect some challanges.

Joe

      
Re: HP48SX program HELPPPP...
Message #3 Posted by Joe Panico on 8 Nov 1999, 1:47 p.m.,
in response to message #1 by Tal

To all;

There's more to this program that is causing problems. I MUST REMEMBER to check out the code and refer to the manuals before providing answers.

Joe


[ Return to Index | Top of Index ]

Go back to the main exhibit hall