CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

RS-232 receive locking up chip

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
jrd
Guest







RS-232 receive locking up chip
PostPosted: Tue Nov 20, 2001 8:07 pm     Reply with quote

I have tried decreasing the baud rate from 9600 to 2400. I have
these routines:

portio_getch() waits for a character to appear in the FIFO
portio_kbhit() checks whether the FIFO has characters in it
send_char() sticks a char in the transmit FIFO
send_string() sends several chars to the transmit FIFO

and I have queue_add() and queue_fetch() to put characters
into FIFOs and to pull chars back out.

This works fine in a fast moving loop (such as the main() in
this file) where I type slowly. But in a complex loop where
the FIFO accumulates more than 10 or so characters between
samples, the PIC freezes!

The file is at <a href="http://max.jrd.com/ser.c" TARGET="_blank">http://max.jrd.com/ser.c</a>. The serial input
and output FIFOs are 70 characters each, respectively.

Any hints on what's going on here? I checked the older
archives and found something on interactions between the
interrupt and delay(), but changing the delay_ms(1000) in the
complex loop to a for() loop of delay_us()'s doesn't seem
to change it. It is related to how fast I type characters
from the PC.

Thank you very much. This bulletin board has been quite
helpful in getting me up to speed.
___________________________
This message was ported from CCS's old forum
Original Post ID: 1268
Tomi
Guest







Re: RS-232 receive locking up chip
PostPosted: Wed Nov 21, 2001 12:15 pm     Reply with quote

Huhhhh, it is a sofisticated source code. I think you are very good in UNIX.
But PICs are not Turin machines. They have limited ROM and RAM space and only one indirect address register for pointer-based operations. Unfortunately this FSR (File Select Register) is used sometimes by IT handlers, the delay_ms() routines, and so on.
It would be better to forget the unnecessary pointer arithmetics.

Next problem is the usage of the pointers in your functions as input parameters. If you have only two or four global structs it would be better to use them directly in your functions. Or it would be more better to forget the entire struct and use global string arrays and indexes for them. See the "ex_sisr.c" example file for more details. Based on that code I can use 57600 Bd comm. with 11.0592MHz xtal without problems.

:=I have tried decreasing the baud rate from 9600 to 2400. I have
:=these routines:
:=
:=portio_getch() waits for a character to appear in the FIFO
:=portio_kbhit() checks whether the FIFO has characters in it
:=send_char() sticks a char in the transmit FIFO
:=send_string() sends several chars to the transmit FIFO
:=
:=and I have queue_add() and queue_fetch() to put characters
:=into FIFOs and to pull chars back out.
:=
:=This works fine in a fast moving loop (such as the main() in
:=this file) where I type slowly. But in a complex loop where
:=the FIFO accumulates more than 10 or so characters between
:=samples, the PIC freezes!
:=
:=The file is at <a href="http://max.jrd.com/ser.c" TARGET="_blank"> <a href="http://max.jrd.com/ser.c" TARGET="_blank">http://max.jrd.com/ser.c</a></a>. The serial input
:=and output FIFOs are 70 characters each, respectively.
:=
:=Any hints on what's going on here? I checked the older
:=archives and found something on interactions between the
:=interrupt and delay(), but changing the delay_ms(1000) in the
:=complex loop to a for() loop of delay_us()'s doesn't seem
:=to change it. It is related to how fast I type characters
:=from the PC.
:=
:=Thank you very much. This bulletin board has been quite
:=helpful in getting me up to speed.
___________________________
This message was ported from CCS's old forum
Original Post ID: 1276
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group