Odd QBASIC error...
Posted on 2002-07-22
I'd really like to get some suggestions about this:
I wrote a small data acquisition program. The setup involves a 16-bit A/D converter card and a 3-axis geophone. The program gets the values from the 3 active channels, plots 3 curves and stores the values in a file in a comma-delimited text format. I used Z-Basic for this, a real oldie (end of the 80's) and it works quite OK. I figured QBASIC could give better graphics, so I adjusted the program for QB (a few small adjustments). One thing will not work:
VALUE = INP(&H225)*256 + INP(&H224)
This gets the 16 bit output fromt he card for further handling.
VALUE = (INP(&H225)*256) + INP(&H224)
This gives an "Overflow" error. Syntax adjustments (moving or deleting parenthesis) does not help. If I read only the low byte ( INP(&H224) ) it works, but the function is crippled.
This line works (no Overflow), but with odd behaviour:
VALUE = (INP(&H225)*256 AND &HF) + INP(&H224)
... and I cannot understand why.
Any input would be appreciated. I am not an experienced programmer - I just follow the manual - so don't hesitate to point out the obvious!