What happen if you place
just before the PAUSE 1000?Code:GPIO=0
Did you tried to connect your PIC directly to your PC?
What happen if you place
just before the PAUSE 1000?Code:GPIO=0
Did you tried to connect your PIC directly to your PC?
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Thank you for your comment, I will try your suggestion. Just a note: the code works fine on an 16F688 using the same I/O pin GP4.(with minors modifications: TRISIO replaced by TRISA, ANSEL replaced by ADCON1, CMCON line removed)
Thank you for your comment, I will try your suggestion. Just a note: the code works fine on a 16F688 using the same I/O pin GP4.(with minors modifications: TRISIO replaced by TRISA, ANSEL replaced by ADCON1, CMCON line removed). I didn't try to connect directly to my PC.
Serout2 sends LSB first – your HSB appears to be the one that is corrupted. This screams “timing issue” to me. If you are using the Internal Oscillator (which it appears you are), you might want to switch to a XTAL for reliable timing. If that is not possible, consider a slower baud rate or get a good scope and play with the OSCAL value until the timing works (at the given temperature – it will change if the temperature changes).
HTH,
Paul Borgmeier
Salt Lake City, UT
USA
__________________
Paul,
Based on your comment, I assumed that the pic basic was reading the stop bit as the MSB of the data. My conclusion is that the pic clock was too fast. So I reduced the OSCCAL from its 3460h original value to 3450h and it worked on the first try! Now I´ll play a litle bit more with the OSCCAL to find the midpoint to (hopefully) garantee that the circuit will be stable over temperature changes.
Thank you for your valuable help!
>> Putting GPIO=0 have no effects on the output, but I can learn on the process. What is the purpose of this line?
Mister-E wanted to make sure you were idling low, which is good practice.
Paul Borgmeier
Salt Lake City, UT
USA
__________________
Bookmarks