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

PIC16F689 Multiple PIN RS 232 Lock up

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



Joined: 25 Mar 2008
Posts: 13

View user's profile Send private message

PIC16F689 Multiple PIN RS 232 Lock up
PostPosted: Mon Apr 21, 2008 2:51 pm     Reply with quote

Anyone used these commands with PIC16F689 for talking to multiple devices?

#use rs232(baud=9600,xmit=PIN_B7,rcv=PIN_B5,BITS=8,ERRORS,STREAM=COM_A) // COM A Meter
#use rs232(baud=9600,xmit=PIN_B6,rcv=PIN_B4,BITS=8,ERRORS,STREAM=COM_B) // COM B C3I 485

When the handler for COM B is enabled, problems occur.


Last edited by superflycfi on Mon Apr 21, 2008 3:53 pm; edited 1 time in total
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Apr 21, 2008 3:14 pm     Reply with quote

1. Post the #fuses statement.
2. Post the compiler version.
3. Post a list of your external circuits. Specifically, do you have a
pull-up on the MCLR pin ? Do you have a 100 nF (0.1 uF) ceramic
capacitor on the Vdd pin, to ground ?
superflycfi



Joined: 25 Mar 2008
Posts: 13

View user's profile Send private message

Problem may be solved....Very Strange Issue?
PostPosted: Mon Apr 21, 2008 7:36 pm     Reply with quote

I removed the ERRORS portion from the second #USE RS232 directive and everything works. What I want to know is WHY? The documentation from CCS needs work here, I spent 10 hours on this problem today. It was intermittent as it worked on some of the PIC's and not others. It now works on all, but will I have any possibilites of the UART overflow not resetting if it occurs with only the ERRORS in one of the statements?

Thanks!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Apr 21, 2008 7:57 pm     Reply with quote

Quote:
1. Post the #fuses statement.
2. Post the compiler version.
3. Post a list of your external circuits. Specifically, do you have a
pull-up on the MCLR pin ? Do you have a 100 nF (0.1 uF) ceramic
capacitor on the Vdd pin, to ground ?

No response, so I am giving up.
superflycfi



Joined: 25 Mar 2008
Posts: 13

View user's profile Send private message

Fuses, etc.
PostPosted: Mon Apr 21, 2008 8:40 pm     Reply with quote

Code is below: Power pins are decoupled with .1 caps.

Code:

#include "16F689.h"
#fuses NOWDT
#use delay(internal=4M,restart_wdt)

#use rs232(baud=9600,xmit=PIN_B7,rcv=PIN_B5,ERRORS,STREAM=COM_A) // COM A Meter
#use rs232(baud=9600,xmit=PIN_B6,rcv=PIN_B4,STREAM=COM_B) // COM B C3I 485


This is the code that functions correctly. Note that ERRORS is removed from the second #use rs232 directive.

The first code segment posted for basic oscillator testing had an error which I found. No hardware problems seem present and power supply is clean on oscilloscope. MLCR has internal pull up, I do not pull these pins up in hardware on this particular hardware.

So... The question I have is why the ERRORS parameter being removed allowed the code to operate correctly. Before, it only operated on some of the chips, all identical lot#s.
superflycfi



Joined: 25 Mar 2008
Posts: 13

View user's profile Send private message

Compiler Version is 4.071
PostPosted: Mon Apr 21, 2008 8:42 pm     Reply with quote

Version 4.071
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Apr 22, 2008 1:42 am     Reply with quote

Make a test program like this, which is essentially the same as your
code, except that it has some fputc() and fgetc() statements in it so that
the compiler will instantiate the Tx and Rx portions of the library code:
Code:

#include <16F689.h>
#fuses NOWDT
#use delay(internal=4M, restart_wdt)

#use rs232(baud=9600,xmit=PIN_B7,rcv=PIN_B5,ERRORS,STREAM=COM_A) // COM A Meter
#use rs232(baud=9600,xmit=PIN_B6,rcv=PIN_B4,STREAM=COM_B) // COM B C3I 485

#int_rda
void rda_isr(void)
{
char c;

c = fgetc(COM_A);
fputc(c, COM_A);

}

//====================================
void main()
{
char c;

c = fgetc(COM_B);
fputc(c, COM_B);

while(1);
}

Compile it with vs. 4.071, with and without the ERRORS parameter
in the COM_B stream. Save the .LST file from the first compilation
in a different directory before you do the 2nd compilation.

Now compare the two .LST files with a file comparison utility such
as ExamDiff:
http://www.prestosoft.com/edp_examdiff.asp#download

The only differences between the 'ERRORS' version and the non-ERRORS
version are the top line which has a different time of compilation (only
one minute apart), and the #use rs232() lines which have the ERRORS
directive, or not.

This means the problem is somewhere else. The 2nd #use rs232()
statement is for a software UART. CCS never generates any ERRORS
code for a soft UART. This is why I asked about other things.

You should do this test with your own code, and see if the difference is
limited to only the two lines.
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