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

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:

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.

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

1 Like

Is that mean Port D can only do RS485 signals?

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&type=documentation

1 Like

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 (;:wink: {// 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.

1 Like
[
#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
1 Like

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

It should be for ( with two ;

1 Like

Thank you soooooooooooooo much. Now, I am able to read the in coming bytes correctly.
:slight_smile:
XOXOXOXOXOXOXO
@}}ā€“}}------