HP Forums
HP48SX program HELPPPP... - Printable Version

+- HP Forums (https://archived.hpcalc.org/museumforum)
+-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html)
+--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html)
+--- Thread: HP48SX program HELPPPP... (/thread-2758.html)



HP48SX program HELPPPP... - tal - 11-08-1999

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... - Joe Panico - 11-08-1999

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... - Joe Panico - 11-08-1999

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