Page 2 of 2

Re: UART interrupt problem

Posted: 20 Mar 2013 06:33
by Sparky1039

Code: Select all

GPSin==UART2_Read(); //store chracter of GPS data
Well line this is going to be a problem (same problem, multiple places)

The double equal sign "==" is the logical test for equality i.e. if x equals y then do something, or in code... if (x == Y) count++;.

A single equal sign "=" is the assignment operator i.e. X is assigned the value of 16, or in code... X = 16;

So...

Code: Select all

GPSin==UART2_Read(); 
really should be...

Code: Select all

GPSin = UART2_Read();  
Mixing up == with = is a common mistake and something you need be on the lookout for. :wink:

Re: UART interrupt problem

Posted: 05 Aug 2014 22:15
by yosyap
Hello

I'm not such a great programmer so I won't be surprised if I made ridiculous mistakes...

I'm trying to write to the terminal the GPGGA coordinates similarly to the code mentioned above here, but all I'm getting in the terminal is gibberish' so I can't know if the interrupt is working properly.

I've tried to set the error in the baud rate CLK with setting the spbrg=0x33 unsuccessfully.

does anyone know what other options I have?