Chicago Mike
01-26-2008, 10:17 PM
I'm trying to run two serial ports independently, both however using extended_full duplex serial. So I'm trying to have multiple instances of this object.... After reviewing the prop manual, I noticed that you can call build an array of the same object, so I gave that a shot (As shown below). (Please ignore the "//" below. I can't seem to display array references in this forum text editor without it, they are not there in real code).
OBJ
serial[//1] : "Extended_FDserial"
PUB Main | input1, input2
serial[//0].start(1,2,%0000,9600)
serial[//1].start(3,4,%0000,9600)
input1:=serial[//0].rxcheck
input2:=serial[//1].rxcheck
Now, my understanding of the above code would be that I would be running two instances of the Extended_FDserial object (Yes, DAT sections are shared, but the variables, including the rxbuffer are separate), which would give me two exclusive and different receive buffers. This does not seem to be the case. If I send in a string such as "hello" on the first serial line, and run the above code input1 will be "h", and input 2 will be "e". My goal is to have input1=="h" and input2==-1 (Because there was no input on the second port, to the second instance of the object). Perhaps my understanding of an array of objects is wrong. I also tried just duplicating the object reference such as below
OBJ
serial1 : "Extended_FDserial"
serial2 : "Extended_FDserial"
This did not work so well, when I attempted to do a serial2.rxcheck, it would consistently reboot the prop.
I'm sure someone has done this before? Any tips? To add to this I would also like to use the fullduplex object for RX and TX on the same pin. After I figured out the above, I wanted to to tie the RX,TX together and the DERE lines together. (I'm talking to 75176 RS485 transceiver). I want to keep the DERE line low normally to receive on the data line. Then when I needed to transmit, I would set the DERE line high and transmit on the dataline. Has anyone used the Extended_FullDuplex object this way?
Any help would be great! Thanks again!
Post Edited (Chicago Mike) : 1/26/2008 3:27:10 PM GMT
OBJ
serial[//1] : "Extended_FDserial"
PUB Main | input1, input2
serial[//0].start(1,2,%0000,9600)
serial[//1].start(3,4,%0000,9600)
input1:=serial[//0].rxcheck
input2:=serial[//1].rxcheck
Now, my understanding of the above code would be that I would be running two instances of the Extended_FDserial object (Yes, DAT sections are shared, but the variables, including the rxbuffer are separate), which would give me two exclusive and different receive buffers. This does not seem to be the case. If I send in a string such as "hello" on the first serial line, and run the above code input1 will be "h", and input 2 will be "e". My goal is to have input1=="h" and input2==-1 (Because there was no input on the second port, to the second instance of the object). Perhaps my understanding of an array of objects is wrong. I also tried just duplicating the object reference such as below
OBJ
serial1 : "Extended_FDserial"
serial2 : "Extended_FDserial"
This did not work so well, when I attempted to do a serial2.rxcheck, it would consistently reboot the prop.
I'm sure someone has done this before? Any tips? To add to this I would also like to use the fullduplex object for RX and TX on the same pin. After I figured out the above, I wanted to to tie the RX,TX together and the DERE lines together. (I'm talking to 75176 RS485 transceiver). I want to keep the DERE line low normally to receive on the data line. Then when I needed to transmit, I would set the DERE line high and transmit on the dataline. Has anyone used the Extended_FullDuplex object this way?
Any help would be great! Thanks again!
Post Edited (Chicago Mike) : 1/26/2008 3:27:10 PM GMT