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 support@ccsinfo.com

why rs232 transmission will let the programm out of control

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



Joined: 22 Jul 2004
Posts: 25

View user's profile Send private message

why rs232 transmission will let the programm out of control
PostPosted: Thu Jan 06, 2005 4:00 pm     Reply with quote

I am working on Wireless sensors project. So when I used the ICD2 as the debugger and debug the program everything run good(including RS232). But When I burn the program into MCU, and power up, It will be out of control when printf some string(Such as "Self-Calibration Succeed"!)

When I cut the printf, putc command, the program looks work. So Someone can tell me how to solve this problem. I had to use Rs232 to connecting with PC(shut down the interrupts(Int_TBE)?or when I check the RCSTA, i will find FERR is set, but I can not clear it cause I don't where my program had been after the command "printf"?

whether I can try to write something in the #int_tbe RS232_TX_Handler()?

By Using the C language, i sometimes will confused whether the after sending the data through RS232, and TX_buffer is empty, whether it will cause interrupts by MCU?

Or the baudrate I used is only 9.6kb, So when I printf a string(30bytes). how it will cause OERR set (transmission of RS232 is over speed )?

Thank u for your idea:)
Ttelmah
Guest







Re: why rs232 transmission will let the programm out of cont
PostPosted: Fri Jan 07, 2005 3:22 am     Reply with quote

garyzheng wrote:
I am working on Wireless sensors project. So when I used the ICD2 as the debugger and debug the program everything run good(including RS232). But When I burn the program into MCU, and power up, It will be out of control when printf some string(Such as "Self-Calibration Succeed"!)

When I cut the printf, putc command, the program looks work. So Someone can tell me how to solve this problem. I had to use Rs232 to connecting with PC(shut down the interrupts(Int_TBE)?or when I check the RCSTA, i will find FERR is set, but I can not clear it cause I don't where my program had been after the command "printf"?

whether I can try to write something in the #int_tbe RS232_TX_Handler()?
By Using the C language, i sometimes will confused whether the after sending the data through RS232, and TX_buffer is empty, whether it will cause interrupts by MCU?

Or the baudrate I used is only 9.6kb, So when I printf a string(30bytes). how it will cause OERR set (transmission of RS232 is over speed )?

Thank u for your idea:)

OERR, and FERR, are _receive_ status bits.
It sounds as if the receive line coming into the processor, is floating low, or seeing noise, thereby giving a continuous 'error' state on the receive (not the transmit). I'd be looking at the ground connection between the RS232 tranceiver circuiot, and the processor. The probability is that the ICD wiring, is making a connection, and preventing this problem. Presumably your code has perhaps a receive interrupt, with no handler present, or the data not being read (and without the 'ERRORS' directive in the RS232 setup line), so the system is sitting looping in the receive handler, and can never transmit.

Best Wishes
GARYzhengabc
Guest







I had to #int_RDA handler
PostPosted: Sat Jan 08, 2005 3:51 pm     Reply with quote

I think the problem laid on the RS232 TX mode right now, someone used int_tbe before? I want to know the int_tbe working procession.

let me guess the procession: when the TXREG is empty, it will set the interrupt flag on INTCON register and go into int_tbe handler? So what I do is to clear the interrupt flag for int_tbe,right? whether I should write some program to handle the RS232 transmission?

Formerly, I just used putc() or printf() function. it totally can work. but right now, i combined several interrupts together,such as int_ext,int_rda,int_timer1 together, it can work great under debugger mode, but i can not work when I burn program into MCU:)

your idea is I should connect the "ground" between PC and RS232(max3232) and MCU?
Ttelmah
Guest







Re: I had to #int_RDA handler
PostPosted: Sun Jan 09, 2005 3:00 am     Reply with quote

GARYzhengabc wrote:
I think the problem laid on the RS232 TX mode right now, someone used int_tbe before? I want to know the int_tbe working procession.

let me guess the procession: when the TXREG is empty, it will set the interrupt flag on INTCON register and go into int_tbe handler? So what I do is to clear the interrupt flag for int_tbe,right? whether I should write some program to handle the RS232 transmission?

Formerly, I just used putc() or printf() function. it totally can work. but right now, i combined several interrupts together,such as int_ext,int_rda,int_timer1 together, it can work great under debugger mode, but i can not work when I burn program into MCU:)

your idea is I should connect the "ground" between PC and RS232(max3232) and MCU?


The interrupt handler automatically clears the interrupt flag for you. All you need to do, is write the next character to the chip.
Yes, connecting the grounds between circuits, is _vital_ (unless you are using certain types of differential signalling).
What you are describing, is a 'classic' problem, where if the ICD, is attached, there is automatically a ground connection made, but without this connection the system is now dependant on there being a seperate connection.

Best Wishes
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