# Is port D on BL1800 JackRabbit Single-Board Computer different from other ports (A,B,C)?

**URL:** <https://forums.digi.com/t/is-port-d-on-bl1800-jackrabbit-single-board-computer-different-from-other-ports-a-b-c/9768>\
**Category:** Rabbit\
**Created:** [January 19, 2012, 4:09pm UTC](https://forums.digi.com/t/is-port-d-on-bl1800-jackrabbit-single-board-computer-different-from-other-ports-a-b-c/9768 "2012-01-19T16:09:13Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![homersimpson](https://avatars.discourse-cdn.com/v4/letter/h/cab0a1/32.png) [@homersimpson](https://forums.digi.com/u/homersimpson)\
**Post date:** [January 19, 2012, 4:09pm UTC](https://forums.digi.com/t/is-port-d-on-bl1800-jackrabbit-single-board-computer-different-from-other-ports-a-b-c/9768/1 "2012-01-19T16:09:13Z")

</div>

I am having terrible time trying to figure out how to read and write to Port D on BL1800 JackRabbit Single-Board Computer right from within the Processor. I have searched through documentations and found very few useful information but the following:

```auto
This library contains 3 RS485 serial interface functions for the JackRabbit
    board. These functions are to be used with the serial port D library functions
    in rs232.lib because serDopen utilizes PC0 (TXD) and PC1 (RXD), which are
    connected to pin 4 and pin 1 of the RS485 chip. This chip is half duplex
    requiring pin 3 (Data Enable) to be high for pins 6 and 7 to act as output and
    low for those pins to act as input.

                               -------------------------
                               | |    
                               | DI 4|------- (PC0 on JackRabbit)
   (485+ on JackRabbit) -------|6 DO/RI RO 1|------- (PC1 on JackRabbit)
                               | |    
                               | ____ |
   (485- on JackRabbit) -------|7 DO/RI |    
                               | DE 3|------- (PD5 on JackRabbit)
                               | RE 2|O-----------|
                               ------------------------- |
                                         SP483EN |
                                                                    \/

   void Jr485Init(); Setup parallel port D pins for 485 use                                                                     

    void Jr485Tx(); Sets (high) pin 3 (DE) of the RS485 chip to disable Rx, enable Tx

    void Jr485Rx(); Resets (low) pin 3 (DE) of the RS485 chip to disable Tx, enable Rx

```

Apparently, I can write and read to Port D from a PC, but I can only write to Port D from within the processor and not able to read. Am I missing a key information about Port D?

This is how I write on Port D from Dynamic C program:

Jr485Tx();

waitfordone { cof\_serDwrite(&dxout[0],5) };

while(BitRdPortI(SDSR,SS\_TFULL\_BIT) != 0);  
while(BitRdPortI(SDSR,SS\_TPRG\_BIT) == 1);

This is how I read on Port D from Dynamic C program:

Jr485Rx();

waitfordone { dxin[0] = cof\_serDgetc() };

if(dxin[0] == 0xff) // if-1  
{ waitfordone { myret = cof\_serDread(&dxin[1],5,20) };

Again, these codes can communicate flawlessly with a PC through port D but not when the Jackrabbit itself is trying to read the incoming bytes from an external device. Is Port D meant for RS232 communication only?

Any help or hints will be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![MargaretK](https://avatars.discourse-cdn.com/v4/letter/m/d9b06d/32.png) [@MargaretK](https://forums.digi.com/u/MargaretK)\
**Post date:** [May 10, 2013, 6:46pm UTC](https://forums.digi.com/t/is-port-d-on-bl1800-jackrabbit-single-board-computer-different-from-other-ports-a-b-c/9768/2 "2013-05-10T18:46:18Z")

</div>

The schematic shows that RS232 signals are only on Ports B and C, not on port D

---

<div class="post-metadata">

**Author:** ![homersimpson](https://avatars.discourse-cdn.com/v4/letter/h/cab0a1/32.png) [@homersimpson](https://forums.digi.com/u/homersimpson)\
**Post date:** [July 15, 2014, 3:29pm UTC](https://forums.digi.com/t/is-port-d-on-bl1800-jackrabbit-single-board-computer-different-from-other-ports-a-b-c/9768/3 "2014-07-15T15:29:47Z")

</div>

Is that mean Port D can only do RS485 signals?

---

<div class="post-metadata">

**Author:** ![MargaretK](https://avatars.discourse-cdn.com/v4/letter/m/d9b06d/32.png) [@MargaretK](https://forums.digi.com/u/MargaretK)\
**Post date:** [July 15, 2014, 3:35pm UTC](https://forums.digi.com/t/is-port-d-on-bl1800-jackrabbit-single-board-computer-different-from-other-ports-a-b-c/9768/4 "2014-07-15T15:35:03Z")

</div>

The Jackrabbit has one RS-485 serial channel, which is connected to the Rabbit 2000  
serial port D through U6, an RS-485 transceiver.

Documentation and schematics can be found at the following link:

[http://www.digi.com/support/productdetail?pid=4513&amp;type=documentation](http://www.digi.com/support/productdetail?pid=4513&amp;type=documentation)

---

<div class="post-metadata">

**Author:** ![MargaretK](https://avatars.discourse-cdn.com/v4/letter/m/d9b06d/32.png) [@MargaretK](https://forums.digi.com/u/MargaretK)\
**Post date:** [July 15, 2014, 3:50pm UTC](https://forums.digi.com/t/is-port-d-on-bl1800-jackrabbit-single-board-computer-different-from-other-ports-a-b-c/9768/5 "2014-07-15T15:50:51Z")

</div>

Please try the following sample for the Jackrabbit:  
#define DINBUFSIZE 15  
#define DOUTBUFSIZE 15  
void main( void ){  
int nEcho,nReply;  
char cChar;  
Jr485Init ();// Init RS485 Control (PD5)  
serDopen ( 9600 );// Open Serial Port D  
for (;😉 {// Forever  
for (cChar=‘a’;cChar\<=‘z’;++cChar){  
// Send Alphabet  
Jr485Tx ();// Enable RS485 Transmitter  
serDputc ( cChar );// Send Byte  
while ((nEcho = serDgetc ()) == -1);  
// Wait for Echo  
Jr485Rx ();// Disable RS485 Transmitter  
while ((nReply = serDgetc ()) == -1);  
// Wait for Reply  
printf ( "%02x -\> %02x  
",nEcho,nReply ); } } }

If the characters are not coming out correctly then you may not have the baud rate correct.

---

<div class="post-metadata">

**Author:** ![MargaretK](https://avatars.discourse-cdn.com/v4/letter/m/d9b06d/32.png) [@MargaretK](https://forums.digi.com/u/MargaretK)\
**Post date:** [July 15, 2014, 3:52pm UTC](https://forums.digi.com/t/is-port-d-on-bl1800-jackrabbit-single-board-computer-different-from-other-ports-a-b-c/9768/6 "2014-07-15T15:52:53Z")

</div>

```auto
[
#define DINBUFSIZE 15
#define DOUTBUFSIZE 15
void main( void ){
  int nEcho,nReply;
  char cChar;
  Jr485Init ();// Init RS485 Control (PD5)
  serDopen ( 9600 );// Open Serial Port D
  for (;;) {// Forever
    for (cChar='a';cChar&lt;='z';++cChar){
                  // Send Alphabet
    Jr485Tx ();// Enable RS485 Transmitter
    serDputc ( cChar );// Send Byte
    while ((nEcho = serDgetc ()) == -1);
                  // Wait for Echo
    Jr485Rx ();// Disable RS485 Transmitter
    while ((nReply = serDgetc ()) == -1);
                        // Wait for Reply
    printf ( "%02x -&gt; %02x
",nEcho,nReply ); } } }

]
I hope the copied text comes out better with this try
```

---

<div class="post-metadata">

**Author:** ![MargaretK](https://avatars.discourse-cdn.com/v4/letter/m/d9b06d/32.png) [@MargaretK](https://forums.digi.com/u/MargaretK)\
**Post date:** [July 15, 2014, 3:54pm UTC](https://forums.digi.com/t/is-port-d-on-bl1800-jackrabbit-single-board-computer-different-from-other-ports-a-b-c/9768/7 "2014-07-15T15:54:27Z")

</div>

the following line is not copying correctly:  
for (;;

It should be for ( with two ;

---

<div class="post-metadata">

**Author:** ![homersimpson](https://avatars.discourse-cdn.com/v4/letter/h/cab0a1/32.png) [@homersimpson](https://forums.digi.com/u/homersimpson)\
**Post date:** [July 16, 2014, 9:46am UTC](https://forums.digi.com/t/is-port-d-on-bl1800-jackrabbit-single-board-computer-different-from-other-ports-a-b-c/9768/8 "2014-07-16T09:46:08Z")

</div>

Thank you soooooooooooooo much. Now, I am able to read the in coming bytes correctly.  
🙂  
XOXOXOXOXOXOXO  
@}}–}}------
