View previous topic :: View next topic |
Author |
Message |
philipp2084
Joined: 06 Aug 2007 Posts: 5
|
VRef & USART Issue |
Posted: Mon Aug 27, 2007 7:39 am |
|
|
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? |
|
![](templates/subSilver/images/spacer.gif) |
philipp2084
Joined: 06 Aug 2007 Posts: 5
|
|
Posted: Mon Aug 27, 2007 8:02 am |
|
|
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? |
|
![](templates/subSilver/images/spacer.gif) |
philipp2084
Joined: 06 Aug 2007 Posts: 5
|
|
Posted: Mon Aug 27, 2007 8:11 am |
|
|
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? |
|
![](templates/subSilver/images/spacer.gif) |
|