masconejos
New Member
I am working on a project involving the pic16f877, programming using Hi-Tech C complier and MPLAB 6.x.
I have gotten the pic to send data just fine over the serial port. However, recieving is not working. When I first poer the pic on it will recieve several bytes of garbage and an overflow error on the serial recieve pin, even when the serial port to the computer is disconnected. Any attempts to actually recieve data do not work when polling the recieve register (interrupts disabled). When interrupts are enabled, when powering on the pic, it will generate exactly 3 interrupts, print off several bytes of garbage, and get an overflow error. This happens regardless of if it is connected to the serial or not. When it is connected to the serial, it won't generate or respond to serial data coming in. (This is after a lot of fuss to make sure all the error pins are clear, the recieve register, etc). It gets better though. In the interrupt, when I tell it to echo back serially to the computer what it receives, it generates exactly 12 interrupts of garbage, and a simple function I have at the very begining of the program to print a test string serially to the computer, which has been working fine all this time, no longer works correctly and will just print out garbage to the computer.
I've spent many hours trying everything I can think of to debug this, including using a second pic in-case mine is damaged (its not; second pic does the same thing). Any suggestions on solving this would be appreciated.
I have gotten the pic to send data just fine over the serial port. However, recieving is not working. When I first poer the pic on it will recieve several bytes of garbage and an overflow error on the serial recieve pin, even when the serial port to the computer is disconnected. Any attempts to actually recieve data do not work when polling the recieve register (interrupts disabled). When interrupts are enabled, when powering on the pic, it will generate exactly 3 interrupts, print off several bytes of garbage, and get an overflow error. This happens regardless of if it is connected to the serial or not. When it is connected to the serial, it won't generate or respond to serial data coming in. (This is after a lot of fuss to make sure all the error pins are clear, the recieve register, etc). It gets better though. In the interrupt, when I tell it to echo back serially to the computer what it receives, it generates exactly 12 interrupts of garbage, and a simple function I have at the very begining of the program to print a test string serially to the computer, which has been working fine all this time, no longer works correctly and will just print out garbage to the computer.
I've spent many hours trying everything I can think of to debug this, including using a second pic in-case mine is damaged (its not; second pic does the same thing). Any suggestions on solving this would be appreciated.