PropBASIC - How to read pin array?
simonl
Posts: 866
Hi,
I'm trying to read an array of pins in PropBASIC, but the following results in me seeing 17 (the number of the final pin in the pin array)
I was expecting to see 2, as I have pin 19 high and the others low.
Anyone know how I should be doing this?
I'm trying to read an array of pins in PropBASIC, but the following results in me seeing 17 (the number of the final pin in the pin array)
DEVICE P8X32A, XTAL1, PLL16X XIN 5_000_000 src_addr PIN 19..14 INPUT PROGRAM Start Start: LOAD "C:\PropBASIC_Lib\vpterminal.lib" vp_dec src_addr vp_char 13 GOTO Start END
I was expecting to see 2, as I have pin 19 high and the others low.
Anyone know how I should be doing this?
Comments
PIN variables get passed to subroutines as their pin number. This allows you to write common subroutines that work with different pins.
You have the correct solution shown in your second post.
BTW: If you want to use a PIN number in your code (instead of the value ON the pins) you can use #pinname also @pinname will give the bitmask for the pin(s).
Bean