Sign in

username:

password:



Not a member?

Search rabbit-semi



Search tips

Subscribe to rabbit-semi



Ads

Discussion Groups

See Also

DSPFPGAElectronics

Discussion Groups | Rabbit-Semi | RCM3600 serial port


Advertise Here

This is a group for folks designing and programming embedded systems using the Rabbit Semiconductor C-programmable microcontroller. Rabbit Semi is a spin-off from Z-World who makes a variety of embedded modules and tools. This group is not affiliated with either Rabbit or Z-World, but is a user forum for sharing ideas, asking questions, flaunting knowledge, and other typical user group stuff. The Rabbit is a powerful uC, supported by a full-featured C-compiler.

RCM3600 serial port - thomuh - Oct 20 8:25:31 2009

Hello,

I am a newbie on programming Rabbit's. I am basically trying to run a very short program where I send a byte to the serial port C from the RCM3600 (using Hyperterminal) and then I want to check the received byte and take an action depending on bit 1 from received byte.

I am not sure what's going on with my program, but it does not check the bit and the data on SCDR register remains fixed.

#define CINBUFSIZE 15
#define COUTBUFSIZE 15
#define _232BAUD 19200
int print_bit ()
{
printf("bit 0 en posicion 1\n");
}

main()
{
auto int nIn1;
serCopen(_232BAUD);
serCwrFlush();
serCrdFlush();

while (1){
if ((nIn1=serCgetc()) == -1)
{
printf("Data not received on serial port C\n");
}
else
{
#asm
ioi ld a, (SCDR)
bit 1,a
jr NZ,test
call print_bit
test:
#endasm
printf("Data %c received on port C\n", nIn1);

}
}
}

I really appreciate your help,
Regards

------------------------------------



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


Re: RCM3600 serial port - mehiegl - Oct 20 20:10:20 2009

Why not just test the byte you read from the receive buffer? The serial port functions are interrupt driven, and I'm not sure you can guarantee that the last byte received will still be present in the data register after the ISR has read it.

What are you sending and what are you receiving?

Mark

--- In r...@yahoogroups.com, "thomuh" wrote:
>
> Hello,
>
> I am a newbie on programming Rabbit's. I am basically trying to run a very short program where I send a byte to the serial port C from the RCM3600 (using Hyperterminal) and then I want to check the received byte and take an action depending on bit 1 from received byte.
>
> I am not sure what's going on with my program, but it does not check the bit and the data on SCDR register remains fixed.
>
> #define CINBUFSIZE 15
> #define COUTBUFSIZE 15
> #define _232BAUD 19200
> int print_bit ()
> {
> printf("bit 0 en posicion 1\n");
> }
>
> main()
> {
> auto int nIn1;
> serCopen(_232BAUD);
> serCwrFlush();
> serCrdFlush();
>
> while (1){
> if ((nIn1=serCgetc()) == -1)
> {
> printf("Data not received on serial port C\n");
> }
> else
> {
> #asm
> ioi ld a, (SCDR)
> bit 1,a
> jr NZ,test
> call print_bit
> test:
> #endasm
> printf("Data %c received on port C\n", nIn1);
>
> }
> }
> }
>
> I really appreciate your help,
> Regards
>

------------------------------------



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

Re: RCM3600 serial port - Steve Trigero - Oct 20 20:42:06 2009

You have a bad program. THe serial ports are interrupt
driven. So when a data byte comes in, the interrupt
service routine provided by DC will remove the byte
and put it in the serial port's buffer. THe call
to serCgetc() reads bytes out of the serial port
buffer, not the serial port data register. Your
assembly language section is only screwing things up.

You should familiarize yourself with the serial port
example programs that come with DC.

________________________________
From: thomuh
To: r...@yahoogroups.com
Sent: Tue, October 20, 2009 4:35:36 AM
Subject: [rabbit-semi] RCM3600 serial port

Hello,

I am a newbie on programming Rabbit's. I am basically trying to run a very short program where I send a byte to the serial port C from the RCM3600 (using Hyperterminal) and then I want to check the received byte and take an action depending on bit 1 from received byte.

I am not sure what's going on with my program, but it does not check the bit and the data on SCDR register remains fixed.

#define CINBUFSIZE 15
#define COUTBUFSIZE 15
#define _232BAUD 19200
int print_bit ()
{
printf("bit 0 en posicion 1\n");
}

main()
{
auto int nIn1;
serCopen(_232BAUD) ;
serCwrFlush( );
serCrdFlush( );

while (1){
if ((nIn1=serCgetc( )) == -1)
{
printf("Data not received on serial port C\n");
}
else
{
#asm
ioi ld a, (SCDR)
bit 1,a
jr NZ,test
call print_bit
test:
#endasm
printf("Data %c received on port C\n", nIn1);

}
}
}

I really appreciate your help,
Regards



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

Re: Re: RCM3600 serial port - Pedro Torujo - Oct 21 12:30:48 2009

Hello,
Thanks for your feedback.

I did what you said using the dunamic C function bit and it worked.
If I would like to use an ISR, what would be the easiest code to read the incoming byte that caused the serial interrupt and test one bit from that byte?

Again,
thank you all for your help.

Regards,

________________________________
From: mehiegl
To: r...@yahoogroups.com
Sent: Tue, October 20, 2009 10:10:08 PM
Subject: [rabbit-semi] Re: RCM3600 serial port

Why not just test the byte you read from the receive buffer? The serial port functions are interrupt driven, and I'm not sure you can guarantee that the last byte received will still be present in the data register after the ISR has read it.

What are you sending and what are you receiving?

Mark

--- In rabbit-semi@ yahoogroups. com, "thomuh" wrote:
>
> Hello,
>
> I am a newbie on programming Rabbit's. I am basically trying to run a very short program where I send a byte to the serial port C from the RCM3600 (using Hyperterminal) and then I want to check the received byte and take an action depending on bit 1 from received byte.
>
> I am not sure what's going on with my program, but it does not check the bit and the data on SCDR register remains fixed.
>
> #define CINBUFSIZE 15
> #define COUTBUFSIZE 15
> #define _232BAUD 19200
> int print_bit ()
> {
> printf("bit 0 en posicion 1\n");
> }
>
> main()
> {
> auto int nIn1;
> serCopen(_232BAUD) ;
> serCwrFlush( );
> serCrdFlush( );
>
> while (1){
> if ((nIn1=serCgetc( )) == -1)
> {
> printf("Data not received on serial port C\n");
> }
> else
> {
> #asm
> ioi ld a, (SCDR)
> bit 1,a
> jr NZ,test
> call print_bit
> test:
> #endasm
> printf("Data %c received on port C\n", nIn1);
>
> }
> }
> }
>
> I really appreciate your help,
> Regards
>



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

Re: RCM3600 serial port - mehiegl - Oct 22 11:37:15 2009

In order to do that you would either need to modify the DC library ISR or you would need to write your own serial routines to initialize the hardware and use your own ISR. The custom library is probably the easier route but you will have to sift through the lib's assembly code to find just what you want.

--- In r...@yahoogroups.com, Pedro Torujo wrote:
>
> Hello,
> Thanks for your feedback.
>
> I did what you said using the dunamic C function bit and it worked.
> If I would like to use an ISR, what would be the easiest code to read the incoming byte that caused the serial interrupt and test one bit from that byte?
>
> Again,
> thank you all for your help.
>
> Regards,
>
> ________________________________
> From: mehiegl
> To: r...@yahoogroups.com
> Sent: Tue, October 20, 2009 10:10:08 PM
> Subject: [rabbit-semi] Re: RCM3600 serial port
>
>
> Why not just test the byte you read from the receive buffer? The serial port functions are interrupt driven, and I'm not sure you can guarantee that the last byte received will still be present in the data register after the ISR has read it.
>
> What are you sending and what are you receiving?
>
> Mark
>
> --- In rabbit-semi@ yahoogroups. com, "thomuh" wrote:
> >
> > Hello,
> >
> > I am a newbie on programming Rabbit's. I am basically trying to run a very short program where I send a byte to the serial port C from the RCM3600 (using Hyperterminal) and then I want to check the received byte and take an action depending on bit 1 from received byte.
> >
> > I am not sure what's going on with my program, but it does not check the bit and the data on SCDR register remains fixed.
> >
> > #define CINBUFSIZE 15
> > #define COUTBUFSIZE 15
> > #define _232BAUD 19200
> > int print_bit ()
> > {
> > printf("bit 0 en posicion 1\n");
> > }
> >
> > main()
> > {
> > auto int nIn1;
> > serCopen(_232BAUD) ;
> > serCwrFlush( );
> > serCrdFlush( );
> >
> > while (1){
> > if ((nIn1=serCgetc( )) == -1)
> > {
> > printf("Data not received on serial port C\n");
> > }
> > else
> > {
> > #asm
> > ioi ld a, (SCDR)
> > bit 1,a
> > jr NZ,test
> > call print_bit
> > test:
> > #endasm
> > printf("Data %c received on port C\n", nIn1);
> >
> > }
> > }
> > }
> >
> > I really appreciate your help,
> > Regards
>

------------------------------------



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

Re: Re: RCM3600 serial port - Scott Henion - Oct 22 12:18:49 2009

Pedro Torujo wrote:
> Hello,
> Thanks for your feedback.
>
> I did what you said using the dunamic C function bit and it worked.
> If I would like to use an ISR, what would be the easiest code to read
> the incoming byte that caused the serial interrupt and test one bit
> from that byte?
Stick with what you have. Writing interrupt routines for the rabbit
serial ports is not easy. The docs are vague in some areas and there are
timing issues to deal with. Ports A-D have no FIFO so the routines must
be very fast or you will lose characters.

The DC libs work well enough and are already interrupt driven.

--
------------------------------------------
| Scott G. Henion| s...@shdesigns.org |
| Consultant | Stone Mountain, GA |
| SHDesigns http://www.shdesigns.org |
------------------------------------------

today's fortune
In Brooklyn, we had such great pennant races, it made the World Series
just something that came later.
-- Walter O'Malley, Dodgers owner


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

Re: Re: RCM3600 serial port - Pedro Torujo - Oct 22 12:41:01 2009



Thanks for your reply!

With DC libs you mean using serXgetc() and all those functions right?

Regards,
________________________________
From: Scott Henion
To: r...@yahoogroups.com
Sent: Thu, October 22, 2009 2:18:25 PM
Subject: Re: [rabbit-semi] Re: RCM3600 serial port

Pedro Torujo wrote:
>
>
>Hello,
>>Thanks for your feedback.
>
>>I did what you said using the dunamic C function bit and it worked.
>>If I would like to use an ISR, what would be the easiest code to read
>the incoming byte that caused the serial interrupt and test one bit
>from that byte?
>
Stick with what you have. Writing interrupt routines for the rabbit
serial ports is not easy. The docs are vague in some areas and there
are timing issues to deal with. Ports A-D have no FIFO so the routines
must be very fast or you will lose characters.

The DC libs work well enough and are already interrupt driven.

--
------------ --------- --------- --------- ---
| Scott G. Henion| shenion@shdesigns. org |
| Consultant | Stone Mountain, GA |
| SHDesigns http://www.shdesign s.org |
------------ --------- --------- --------- ---

today's fortune
In Brooklyn, we had such great pennant races, it made the World Series
just something that came later.
-- Walter O'Malley, Dodgers owner

______________________________
controlSUITE™ software. Comprehensive. Intuitive. Optimized.
Real-world software for real-time control. Details Here!



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

Re: Re: RCM3600 serial port - Steve Trigero - Oct 22 13:42:02 2009



Yes.
______________________________
controlSUITE™ software. Comprehensive. Intuitive. Optimized.
Real-world software for real-time control. Details Here!



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