Hi E,hi C,
This is a simple working bit of code, you should be able to add to it.
Every incoming RX char generates an Interrupt.
Run it,
Type in
$1234? or any other String starting with $ and ending with ? [ ==crlf], it should display the full string.
then type in a test string without the starting $, it should print Error.
Do you follow OK.?
E
Hi E,hi C,
Code in #72, sorry to say, it did not work correctly even with a simple message, a number of problems
The last one I posted was the remnants of #72
I saw the 'W' but why did you change from '?'
E
BTW: you are getting all these set backs by not sitting down and preparing a simple flow chart of events in the program sections and how they effect the program as a whole.
Of the 3 input sources, messages which do you have control over when they are be Read.? obviously not the GPS
hi C,means that if I curtail the message after the W I have all I need from the also different sentence from the original.
Hi E,hi C,
Just because you stop reading at 'W' does not mean that the $NMEA stops being sent, so if you do not read the remainder, they will cause a UART Overflow error set.
So when you next set Int Enable and get an interrupt you will have to clear the RX buffer etc...
E
Hi E,hi ,
So does the program I posted.
E
Hi E,hi,
From what I understand of your project, the NMEA message comes at a fixed interval of one second.
The other two data sources, your program requests data from these two sources.
Is that correct.?
E
Hi E,hi ,
So does the program I posted.
E
Do you know it is working?Hi,
I think this is working INTERRUPT and PARSE:
Use $Sentences in #74,for SIM.
C.
Computer hardware, software, programming is an engineering discipline.I was advised to start again and work through it step by step. I am not capable of flow charts, they just change to mush. My only way is to trial and error, till a working CODE appears out of the depths.
Hi Mr C,Computer hardware, software, programming is an engineering discipline.
Getting systems to work by trial and error is a direct path to frustration and failure.
Things may appear to work for wrong reasons. Two wrongs do not make it right.
It may work today. It will fail tomorrow.
Sorry to have to tell you this.
Hi J,Do you know it is working?
Did you get valid results?
Try only to parse one short sentence and look what you get from parsing.
No interrupts, because they should work now, no pin declarations only variable declarations and making a string from the buffer.
Hi JT,Hi C
OERR ( overflow error) is set when a new character is received before you read the last one received. There is no place to store the new character since RCREG still has the old one that hasn’t been read.
When OERR is set, the receiver shuts down and no more interrupts (or RCIF to poll) will be generated until you reset the USART by disabling then reenabling it.
OERR can be avoided only when you detect RCIF and read RCREG faster than the character rate (about 1ms/char at 9600 baud). Typical solutions include:
Lower the latency between RCIF set and reading the character just received. Interrupt driven buffers are common. Polling RCIF can be problematic.
Process characters faster.
Lower the baudrate.
Add some pacing - delay between characters - at the transmitter.
Use a flow control protocol like RTS/CTS, XON/XOFF etc.
Oshensoft may provide something too.
It is important to test OERR on each character received and take appropriate action whenever it is set i.e. reset the USART and discard any message in progress due to lost characters.