In the following code I am sending a 'G' from RX, and I am getting G instead of ' 0 '. Then I am sending another character and I never gets the char ' 0 '. My PIC doesn't compare the value that it gets from RX. It always sends the char that it gets. again call RXget movwf temp xorlw 'G' bz send0 movf temp,W call TXsend goto again send0 movlw '0' call TXsend From PC INPUTS: GPRMC OUTPUTS OF PIC: GPRMC
take from RX, send to TX
Jun 27, 2006
6 Replies
I am using a GPS reciever to take the positon, And this gps reciever sends the positon data in a sentence which starts with $GPRMC,1,,12,3,23,3. If I cannot know if 'G' has come or not, then I cant take the posisiton data. So I must compare 'G' with incoming messages. I am sure that it sends all the chars without any compare.
If I initialize the usart wrongly, I think it also shouldnt send the other chars. And Do you know the software Proteus. It can simulate the circuit. I connect gps reciever to com 1 and simulate the circuit. It works correctly. But with my pic17f877, it doesnt fo the compare
Are you sure it's actually working and your terminal is not just supplying the echo?
What happens if you precede the first TXsend with movlw '1' or whatever...
Best regards, Spehro Pefhany
"it\'s the network..." "The Journey is the reward"
speff@interlog.com Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog Info for designers: http://www.speff.com
You're using a 16F pic, this series does not have the BZ instruction. I have no idea why your compiler doesn't pick this out for you, but if it just ignores this instruction, All your code does it echo the character.
I heard from someone that mplap compiler automatically creates a btfss and goto command. And I tried if it does or doesnot working. It works.
The GPS receiver probably sends several different sentences, all starting with "$GP", so you should first look for a "$", as that will only occur at the start of the sentence. You can then ignore the "GP" talker ID, and look for the "RMC". If you don't find "RMC", discard characters til you see the next "$". (Of course, you have to get the receive routine working correctly before you have to worry about these details....)
Peter Bennett VE7CEI
email: peterbb4 (at) interchange.ubc.ca
GPS and NMEA info and programs: http://vancouver-webpages.com/peter/index.html
Newsgroup new user info: http://vancouver-webpages.com/nnq
Join the Discussion
Have something to add? Share your thoughts — no account required.
Didn't find your answer?
Ask the community — no account required