I recognize that my knowledge level is way waay below the normal discussions around here, but I’m hoping that by asking the embarrassingly basic questions, I can not only learn a little bit, but maybe help some others who don’t ask for fear of looking foolish… as a married man, I’ve overcome that fear years ago!
As my first project beyond the LED flashing version of “hello world” , I’m trying something a bit ambitious; at least at my level. I’m trying to put together one board with a 16F628A that will take input from a microphone and a couple of switches and then transmit instructions via 434 Mhtz to a second board (also with a 16F628A) that will the trigger one or both of two relays to control a 110 volt appliance. I’ve worked through everything on the first board up to the transmitting part. I have a pushbutton that is polled by the MCU, when it’s pressed, the MCU sends power to the microphone circuit. Then the MCU polls the output from a OP Amp/Comparator circuit until a signal from the microphone is received (think of a “clapper” switch circuit). Once the sound is detected the MCU checks two switches, and then sends a signal via USART to be transmitted to the second board and turn on the 110 v. circuits.
As I said, I have learned a tremendous amout using the try this, fail, try again method to build the circuit up to the USART. Now it’s time to admit that I need the guidance of an experienced hand. I’m hoping that your help with a couple of what may appear simple questions will get me jumpstarted again.
When I set up the MCU to output the signal to be xmitted - do I need to enable both the transmit and receive functions? (ie should I have both TXEN=1 and CREN=1 even though the MCU will only be xmitting?
Also, it seems that as soon as my MCU runs through the program section that initializes the USART, the TX pin (RB2, pin 8) goes high and stays there – an LED connected to the RB2 pin (along with the xmitter data in pin) turns on and stays on even though I have a full 1 second delay after each byte (an ascii character) is put into the TXREG. To make sure the code was correct, I changed it to send output to a different pin with each TXREG operation, and an LED on that pin blinked once per second, just as expected – thus I’m sure that the TX pin is getting a constant high signal… but I don’t know enough about what I’m doing to know if this is SUPPOSED to be this way – it seems like some sort of carrier signal, maybe; but I didn’t think that the USART would have a carrier signal.
Okay, this is supposed to be just a couple of questions, not a thesis - I appologize. The basic questions are:
a) do I need to enable both transmit and receive functions of the USART even if I’m only transmitting from one and receiving with the other? and
b) should the TX pin hold a constant high state once enabled, or do I need to review my initialization settings for a mistake?
I thank you for any help you can offer, and I’m sure others will appreciate your efforts even without acknowledging them.