Hi all - I have 2 questions that I am separating into different posts to
hopefully avoid any confusion.
First:
I have a circuit that reads in 8 bits of serial data, then shifts them
over to an 8 pin register that can be read in parallel. I would like to
read in the data and send each byte read out the com1 port.
Here is how I am currently doing it:
call openqueue(outputQ, 10) 'Only transferring 1 byte at a time
call openqueue(inputQ, 10) 'Only used because there needs to be 2
queues. It is ignored
call opencom(1, 19200, inputQ, outputQ) ' inputQ will be ignored
dim x as byte
do
call waitforinterrupt(bxpinrisingedge)
call putbit(x, 0, getpin(13))
call putbit(x, 1, getpin(14))
call putbit(x, 2, getpin(15))
call putbit(x, 3, getpin(16))
call putbit(x, 4, getpin(17))
call putbit(x, 5, getpin(18))
call putbit(x, 6, getpin(19))
call putbit(x, 7, getpin(20))
call putqueue(outputq, x, 1)
loop
I know I could use a loop to read this instead of 8 separate line. But
- isn't there a better way? This way works, but I feel it is VERY
amateurish. Is there some command that would grab all 8 pins as a byte?
Even better - could all 8 pins be grabbed and then sent out the com
port?
Feel free to critique my code - because I honestly am quite new to this.
[Non-text portions of this message have been removed]

(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )
> call putbit(x, 0, getpin(13))
> call putbit(x, 1, getpin(14))
> call putbit(x, 2, getpin(15))
> call putbit(x, 3, getpin(16))
> call putbit(x, 4, getpin(17))
> call putbit(x, 5, getpin(18))
> call putbit(x, 6, getpin(19))
> call putbit(x, 7, getpin(20))
>
Those eight instructions can be replaced with
x = Register.PinA
which reads the eight pins simultaneously, except that the LSB is on pin 20.
Tom

(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )