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

VRef & USART Issue

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



Joined: 06 Aug 2007
Posts: 5

View user's profile Send private message MSN Messenger

VRef & USART Issue
PostPosted: Mon Aug 27, 2007 7:39 am     Reply with quote

Hi,

I am having a little problem to which I can't find any solution.

I want to transmit data about the status of the comparator via RS485 to a PC. For this purpose I require to use the internal Vref, however everytime I try to use it it messes up my RS485 transmission. The code I am using is as followed:

Code:

#include <16F690.h>

#fuses INTRC_IO, NOWDT, NOPROTECT, NOPUT
#use delay(clock=8000000)
//#use standard_io(a)
#use rs232(baud=19200, xmit=pin_b7, rcv=pin_b5, enable=pin_b6, stream=RS485)



void main()
{
   
   set_tris_a(0b00000011);
   set_tris_c(0b00001111);
   setup_oscillator(OSC_8MHZ);
   
   //setup_vref(VREF_HIGH | 15);
   
   for (;;)
   {
      fprintf(RS485, "Hi");
      
      delay_ms(1000);
   }
}


I receive the string 'hi' ok when I have the setup_vref line commented out, as in teh code example, but as soon as I uncomment it, I just get rubish via my RS485 link.

Does anyone have an explanation for this?
philipp2084



Joined: 06 Aug 2007
Posts: 5

View user's profile Send private message MSN Messenger

PostPosted: Mon Aug 27, 2007 8:02 am     Reply with quote

the setup_vref also does not seem to set the referrence voltage correctly.

My suspicion is that it setup_vref does not write to the correct register.

Can anyone confirm this?
philipp2084



Joined: 06 Aug 2007
Posts: 5

View user's profile Send private message MSN Messenger

PostPosted: Mon Aug 27, 2007 8:11 am     Reply with quote

Ok, I am pretty sure this is a bug with the CCS compiler and the register it writes to when using the setup_vref.

Wen I set up the register by writing to it directly

*0x118 = 0x87;

It does set the referrence voltage correctly and the performance of the USART is not affected. I am using version 3.228, can someone tell me if this bug still exists in later versions?
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