Home  >  Support  >  Support Forum  >  Is port D on BL1800 JackRabbit Single-Board Computer different from other ports (A,B,C)?
Notice! We've recently migrated to using a new forum, we hope you enjoy it. If you are an existing member and this is your first time visiting our new forum, please reset your password to be able to sign in.
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

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

0 votes
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:
Code:
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.
asked Jan 19, 2012 in Rabbit by homersimpson New to the Community (12 points)

Please log in or register to answer this question.

5 Answers

+1 vote
 
Best answer
[ #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\n",nEcho,nReply ); } } } ] I hope the copied text comes out better with this try[code][
#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\n",nEcho,nReply ); } } }

]
I hope the copied text comes out better with this try
answered Jul 15 by MargaretK Veteran of the Digi Community (462 points)
selected Jul 16 by homersimpson
+1 vote
The schematic shows that RS232 signals are only on Ports B and C, not on port D
answered May 10, 2013 by MargaretK Veteran of the Digi Community (462 points)
Is that mean Port D can only do RS485 signals?
+1 vote
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
answered Jul 15 by MargaretK Veteran of the Digi Community (462 points)
+1 vote
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\n",nEcho,nReply ); } } }

If the characters are not coming out correctly then you may not have the baud rate correct.
answered Jul 15 by MargaretK Veteran of the Digi Community (462 points)
+1 vote
the following line is not copying correctly:
for (;;

It should be for ( with two ;
answered Jul 15 by MargaretK Veteran of the Digi Community (462 points)
Thank you soooooooooooooo much. Now, I am able to read the in coming bytes correctly.
:)
XOXOXOXOXOXOXO
@}}--}}------
Contact a Digi expert and get started today! CONTACT US
...